Documentation ¶
Overview ¶
Package geos is a wrapper around the spatial data types between the geo package and the GEOS C library. The GEOS library is dynamically loaded at init time. Operations will error if the GEOS library was not found.
Index ¶
- Constants
- func Area(ewkb geopb.EWKB) (float64, error)
- func Buffer(ewkb geopb.EWKB, params BufferParams, distance float64) (geopb.EWKB, error)
- func Centroid(ewkb geopb.EWKB) (geopb.EWKB, error)
- func ClipEWKBByRect(ewkb geopb.EWKB, xMin float64, yMin float64, xMax float64, yMax float64) (geopb.EWKB, error)
- func Contains(a geopb.EWKB, b geopb.EWKB) (bool, error)
- func ConvexHull(ewkb geopb.EWKB) (geopb.EWKB, error)
- func CoveredBy(a geopb.EWKB, b geopb.EWKB) (bool, error)
- func Covers(a geopb.EWKB, b geopb.EWKB) (bool, error)
- func Crosses(a geopb.EWKB, b geopb.EWKB) (bool, error)
- func EnsureInit(errDisplay EnsureInitErrorDisplay, flagLibraryDirectoryValue string) (string, error)
- func Equals(a geopb.EWKB, b geopb.EWKB) (bool, error)
- func InterpolateLine(ewkb geopb.EWKB, distance float64) (geopb.EWKB, error)
- func Intersection(a geopb.EWKB, b geopb.EWKB) (geopb.EWKB, error)
- func Intersects(a geopb.EWKB, b geopb.EWKB) (bool, error)
- func Length(ewkb geopb.EWKB) (float64, error)
- func MinDistance(a geopb.EWKB, b geopb.EWKB) (float64, error)
- func Overlaps(a geopb.EWKB, b geopb.EWKB) (bool, error)
- func PointOnSurface(ewkb geopb.EWKB) (geopb.EWKB, error)
- func Relate(a geopb.EWKB, b geopb.EWKB) (string, error)
- func RelatePattern(a geopb.EWKB, b geopb.EWKB, pattern string) (bool, error)
- func Touches(a geopb.EWKB, b geopb.EWKB) (bool, error)
- func Union(a geopb.EWKB, b geopb.EWKB) (geopb.EWKB, error)
- func WKTToEWKB(wkt geopb.WKT, srid geopb.SRID) (geopb.EWKB, error)
- func Within(a geopb.EWKB, b geopb.EWKB) (bool, error)
- type BufferParams
- type BufferParamsEndCapStyle
- type BufferParamsJoinStyle
- type EnsureInitErrorDisplay
- type Error
Constants ¶
const ( BufferParamsJoinStyleRound = 1 BufferParamsJoinStyleMitre = 2 BufferParamsJoinStyleBevel = 3 )
These should be kept in sync with the geos_c.h.in corresponding enum definition.
const ( BufferParamsEndCapStyleRound = 1 BufferParamsEndCapStyleFlat = 2 BufferParamsEndCapStyleSquare = 3 )
These should be kept in sync with the geos_c.h.in corresponding enum definition.
Variables ¶
This section is empty.
Functions ¶
func ClipEWKBByRect ¶
func ClipEWKBByRect( ewkb geopb.EWKB, xMin float64, yMin float64, xMax float64, yMax float64, ) (geopb.EWKB, error)
ClipEWKBByRect clips a EWKB to the specified rectangle.
func ConvexHull ¶
ConvexHull returns an EWKB which returns the convex hull of the given EWKB.
func CoveredBy ¶
CoveredBy returns whether the EWKB provided by A is covered by the EWKB provided by B.
func EnsureInit ¶
func EnsureInit( errDisplay EnsureInitErrorDisplay, flagLibraryDirectoryValue string, ) (string, error)
EnsureInit attempts to start GEOS if it has not been opened already and returns the location if found, and an error if the CR_GEOS is not valid.
func InterpolateLine ¶
InterpolateLine returns the point along the given LineString which is at a given distance from starting point. Note: For distance less than 0 it returns start point similarly for distance greater LineString's length. InterpolateLine also works with (Multi)LineString. However, the result is not appropriate as it combines all the LineString present in (MULTI)LineString, considering all the corner points of LineString overlaps each other.
func Intersection ¶
Intersection returns an EWKB which contains the geometries of intersection between A and B.
func Intersects ¶
Intersects returns whether the EWKB provided by A intersects the EWKB provided by B.
func MinDistance ¶
MinDistance returns the minimum distance between two EWKBs.
func PointOnSurface ¶
PointOnSurface returns an EWKB with a point that is on the surface of the given EWKB.
func RelatePattern ¶
RelatePattern whether A and B have a DE-9IM relation matching the given pattern.
Types ¶
type BufferParams ¶
type BufferParams struct { JoinStyle BufferParamsJoinStyle EndCapStyle BufferParamsEndCapStyle SingleSided bool QuadrantSegments int MitreLimit float64 }
BufferParams are parameters to provide into the GEOS buffer function.
type BufferParamsEndCapStyle ¶
type BufferParamsEndCapStyle int
BufferParamsEndCapStyle maps to the GEOSBufCapStyles enum in geos_c.h.in.
type BufferParamsJoinStyle ¶
type BufferParamsJoinStyle int
BufferParamsJoinStyle maps to the GEOSBufJoinStyles enum in geos_c.h.in.
type EnsureInitErrorDisplay ¶
type EnsureInitErrorDisplay int
EnsureInitErrorDisplay is used to control the error message displayed by EnsureInit.
const ( // EnsureInitErrorDisplayPrivate displays the full error message, including // path info. It is intended for log messages. EnsureInitErrorDisplayPrivate EnsureInitErrorDisplay = iota // EnsureInitErrorDisplayPublic displays a redacted error message, excluding // path info. It is intended for errors to display for the client. EnsureInitErrorDisplayPublic )