Documentation
¶
Overview ¶
Package geos provides an interface to GEOS. See https://trac.osgeo.org/geos/.
Index ¶
- Constants
- type Bounds
- func (b *Bounds) Contains(other *Bounds) bool
- func (b *Bounds) ContainsPoint(x, y float64) bool
- func (b *Bounds) Equals(other *Bounds) bool
- func (b *Bounds) Geom() *Geom
- func (b *Bounds) Height() float64
- func (b *Bounds) Intersects(other *Bounds) bool
- func (b *Bounds) IsEmpty() bool
- func (b *Bounds) IsPoint() bool
- func (b *Bounds) String() string
- func (b *Bounds) Width() float64
- type BufCapStyle
- type BufJoinStyle
- type Context
- func (c *Context) Clone(g *Geom) *Geom
- func (c *Context) NewCollection(typeID TypeID, geoms []*Geom) *Geom
- func (c *Context) NewCoordSeq(size, dims int) *CoordSeq
- func (c *Context) NewCoordSeqFromCoords(coords [][]float64) *CoordSeq
- func (c *Context) NewEmptyCollection(typeID TypeID) *Geom
- func (c *Context) NewEmptyLineString() *Geom
- func (c *Context) NewEmptyPoint() *Geom
- func (c *Context) NewEmptyPolygon() *Geom
- func (c *Context) NewGeomFromBounds(bounds *Bounds) *Geom
- func (c *Context) NewGeomFromGeoJSON(geoJSON string) (*Geom, error)
- func (c *Context) NewGeomFromWKB(wkb []byte) (*Geom, error)
- func (c *Context) NewGeomFromWKT(wkt string) (*Geom, error)
- func (c *Context) NewLineString(coords [][]float64) *Geom
- func (c *Context) NewLinearRing(coords [][]float64) *Geom
- func (c *Context) NewPoint(coord []float64) *Geom
- func (c *Context) NewPoints(coords [][]float64) []*Geom
- func (c *Context) NewPolygon(coordss [][][]float64) *Geom
- type ContextOption
- type CoordSeq
- func (s *CoordSeq) Clone() *CoordSeq
- func (s *CoordSeq) Dimensions() int
- func (s *CoordSeq) Ordinate(idx, dim int) float64
- func (s *CoordSeq) SetOrdinate(idx, dim int, val float64)
- func (s *CoordSeq) SetX(idx int, val float64)
- func (s *CoordSeq) SetY(idx int, val float64)
- func (s *CoordSeq) SetZ(idx int, val float64)
- func (s *CoordSeq) Size() int
- func (s *CoordSeq) ToCoords() [][]float64
- func (s *CoordSeq) X(idx int) float64
- func (s *CoordSeq) Y(idx int) float64
- func (s *CoordSeq) Z(idx int) float64
- type Error
- type Geom
- func Clone(g *Geom) *Geom
- func NewCollection(typeID TypeID, geoms []*Geom) *Geom
- func NewEmptyCollection(typeID TypeID) *Geom
- func NewEmptyLineString() *Geom
- func NewEmptyPoint() *Geom
- func NewEmptyPolygon() *Geom
- func NewGeomFromBounds(bounds *Bounds) *Geom
- func NewGeomFromGeoJSON(geoJSON string) (*Geom, error)
- func NewGeomFromWKB(wkb []byte) (*Geom, error)
- func NewGeomFromWKT(wkt string) (*Geom, error)
- func NewLineString(coords [][]float64) *Geom
- func NewLinearRing(coords [][]float64) *Geom
- func NewPoint(coord []float64) *Geom
- func NewPolygon(coordss [][][]float64) *Geom
- func (g *Geom) Area() float64
- func (g *Geom) Bounds() *Bounds
- func (g *Geom) Buffer(width float64, quadsegs int) *Geom
- func (g *Geom) BufferWithStyle(width float64, quadsegs int, endCapStyle BufCapStyle, joinStyle BufJoinStyle, ...) *Geom
- func (g *Geom) Clone() *Geom
- func (g *Geom) ConcaveHull(ratio float64, allowHoles uint) *Geom
- func (g *Geom) Contains(other *Geom) bool
- func (g *Geom) ConvexHull() *Geom
- func (g *Geom) CoordSeq() *CoordSeq
- func (g *Geom) CoveredBy(other *Geom) bool
- func (g *Geom) Covers(other *Geom) bool
- func (g *Geom) Crosses(other *Geom) bool
- func (g *Geom) Densify(tolerance float64) *Geom
- func (g *Geom) Destroy()
- func (g *Geom) Difference(other *Geom) *Geom
- func (g *Geom) DifferencePrec(other *Geom, gridSize float64) *Geom
- func (g *Geom) Disjoint(other *Geom) bool
- func (g *Geom) Distance(other *Geom) float64
- func (g *Geom) DistanceIndexed(other *Geom) float64
- func (g *Geom) DistanceWithin(other *Geom, dist float64) bool
- func (g *Geom) Envelope() *Geom
- func (g *Geom) Equals(other *Geom) bool
- func (g *Geom) EqualsExact(other *Geom, tolerance float64) bool
- func (g *Geom) ExteriorRing() *Geom
- func (g *Geom) FrechetDistance(other *Geom) float64
- func (g *Geom) FrechetDistanceDensify(other *Geom, densifyFrac float64) float64
- func (g *Geom) Geometry(n int) *Geom
- func (g *Geom) HausdorffDistance(other *Geom) float64
- func (g *Geom) HausdorffDistanceDensify(other *Geom, densifyFrac float64) float64
- func (g *Geom) InteriorRing(n int) *Geom
- func (g *Geom) Interpolate(d float64) *Geom
- func (g *Geom) InterpolateNormalized(proportion float64) *Geom
- func (g *Geom) Intersection(other *Geom) *Geom
- func (g *Geom) IntersectionPrec(other *Geom, gridSize float64) *Geom
- func (g *Geom) Intersects(other *Geom) bool
- func (g *Geom) IsClosed() bool
- func (g *Geom) IsEmpty() bool
- func (g *Geom) IsRing() bool
- func (g *Geom) IsSimple() bool
- func (g *Geom) IsValid() bool
- func (g *Geom) IsValidReason() string
- func (g *Geom) Length() float64
- func (g *Geom) MakeValid() *Geom
- func (g *Geom) MaximumInscribedCircle(tolerance float64) *Geom
- func (g *Geom) MinimumRotatedRectangle() *Geom
- func (g *Geom) MinimumWidth() *Geom
- func (g *Geom) NearestPoints(other *Geom) [][]float64
- func (g *Geom) NumGeometries() int
- func (g *Geom) NumInteriorRings() int
- func (g *Geom) NumPoints() int
- func (g *Geom) OffsetCurve(width float64, quadsegs int, joinStyle BufJoinStyle, mitreLimit float64) *Geom
- func (g *Geom) Overlaps(other *Geom) bool
- func (g *Geom) Point(n int) *Geom
- func (g *Geom) Prepare() *PrepGeom
- func (g *Geom) SRID() int
- func (g *Geom) SetPrecision(gridSize float64, flags PrecisionRule) *Geom
- func (g *Geom) SetSRID(srid int) *Geom
- func (g *Geom) Simplify(tolerance float64) *Geom
- func (g *Geom) String() string
- func (g *Geom) SymDifference(other *Geom) *Geom
- func (g *Geom) ToGeoJSON(indent int) string
- func (g *Geom) ToWKB() []byte
- func (g *Geom) ToWKT() string
- func (g *Geom) TopologyPreserveSimplify(tolerance float64) *Geom
- func (g *Geom) Touches(other *Geom) bool
- func (g *Geom) Type() string
- func (g *Geom) TypeID() TypeID
- func (g *Geom) UnaryUnion() *Geom
- func (g *Geom) Within(other *Geom) bool
- func (g *Geom) X() float64
- func (g *Geom) Y() float64
- type PrecisionRule
- type PrepGeom
- func (pg *PrepGeom) Contains(g *Geom) bool
- func (pg *PrepGeom) ContainsProperly(g *Geom) bool
- func (pg *PrepGeom) CoveredBy(g *Geom) bool
- func (pg *PrepGeom) Covers(g *Geom) bool
- func (pg *PrepGeom) Crosses(g *Geom) bool
- func (pg *PrepGeom) Disjoint(g *Geom) bool
- func (pg *PrepGeom) Intersects(g *Geom) bool
- func (pg *PrepGeom) Overlaps(g *Geom) bool
- func (pg *PrepGeom) Touches(g *Geom) bool
- func (pg *PrepGeom) Within(g *Geom) bool
- type TypeID
Constants ¶
const ( VersionMajor = C.GEOS_VERSION_MAJOR VersionMinor = C.GEOS_VERSION_MINOR VersionPatch = C.GEOS_VERSION_PATCH )
Version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bounds ¶
A Bounds is a two-dimensional bounds.
func (*Bounds) ContainsPoint ¶
ContainsPoint returns true if b contains the point at x, y.
func (*Bounds) Intersects ¶
Intersects returns true if b intersects other.
type BufCapStyle ¶ added in v0.7.0
type BufCapStyle int
const ( BufCapStyleRound BufCapStyle = C.GEOSBUF_CAP_ROUND BufCapStyleFlat BufCapStyle = C.GEOSBUF_CAP_FLAT BufCapStyleSquare BufCapStyle = C.GEOSBUF_CAP_SQUARE )
Buffer cap styles.
type BufJoinStyle ¶ added in v0.7.0
type BufJoinStyle int
const ( BufJoinStyleRound BufJoinStyle = C.GEOSBUF_JOIN_ROUND BufJoinStyleMitre BufJoinStyle = C.GEOSBUF_JOIN_MITRE BufJoinStyleBevel BufJoinStyle = C.GEOSBUF_JOIN_BEVEL )
Buffer join styles.
type Context ¶
A Context is a context.
func NewContext ¶
func NewContext(options ...ContextOption) *Context
NewContext returns a new Context.
func (*Context) NewCollection ¶
NewCollection returns a new collection.
func (*Context) NewCoordSeq ¶
NewCoordSeq returns a new CoordSeq.
func (*Context) NewCoordSeqFromCoords ¶
NewCoordSeqFromCoords returns a new CoordSeq populated with coords.
func (*Context) NewEmptyCollection ¶
NewEmptyCollection returns a new empty collection.
func (*Context) NewEmptyLineString ¶
NewEmptyLineString returns a new empty line string.
func (*Context) NewEmptyPoint ¶
NewEmptyPoint returns a new empty point.
func (*Context) NewEmptyPolygon ¶
NewEmptyPolygon returns a new empty polygon.
func (*Context) NewGeomFromBounds ¶
NewGeomFromBounds returns a new polygon constructed from bounds.
func (*Context) NewGeomFromGeoJSON ¶ added in v0.4.0
NewGeomFromGeoJSON returns a new geometry in JSON format from json.
func (*Context) NewGeomFromWKB ¶
NewGeomFromWKB parses a geometry in WKB format from wkb.
func (*Context) NewGeomFromWKT ¶
NewGeomFromWKT parses a geometry in WKT format from wkt.
func (*Context) NewLineString ¶
NewLineString returns a new line string populated with coords.
func (*Context) NewLinearRing ¶
NewLinearRing returns a new linear ring populated with coords.
func (*Context) NewPoints ¶ added in v0.3.0
NewPoints returns a new slice of points populated from coords.
func (*Context) NewPolygon ¶
NewPolygon returns a new point populated with coordss.
type ContextOption ¶ added in v0.1.0
type ContextOption func(*Context)
A ContextOption sets an option on a Context.
func WithGeomFinalizeFunc ¶ added in v0.1.0
func WithGeomFinalizeFunc(geomFinalizeFunc func(*Geom)) ContextOption
WithGeomFinalizeFunc sets a function to be called just before a geometry is finalized. This is typically used to log the geometry to help debug geometry leaks.
type CoordSeq ¶
type CoordSeq struct {
// contains filtered or unexported fields
}
A CoordSeq is a coordinate sequence.
func NewCoordSeqFromCoords ¶
NewCoordSeqFromCoords returns a new CoordSeq populated with coords.
func (*CoordSeq) Dimensions ¶
Dimensions returns the dimensions of s.
func (*CoordSeq) SetOrdinate ¶
SetOrdinate sets the idx-th dim coordinate of s to val.
type Geom ¶
type Geom struct {
// contains filtered or unexported fields
}
A Geom is a geometry.
func NewCollection ¶
NewCollection returns a new collection.
func NewEmptyCollection ¶
NewEmptyCollection returns a new empty collection.
func NewEmptyLineString ¶
func NewEmptyLineString() *Geom
NewEmptyLineString returns a new empty line string.
func NewGeomFromBounds ¶
NewGeomFromBounds returns a new polygon populated with bounds.
func NewGeomFromGeoJSON ¶ added in v0.4.0
NewGEOMFromGeoJSON parses a geometry in GeoJSON format from geoJSON.
func NewGeomFromWKB ¶
NewGeomFromWKB parses a geometry in WKB format from wkb.
func NewGeomFromWKT ¶
NewGeomFromWKT parses a geometry in WKT format from wkt.
func NewLineString ¶
NewLineString returns a new line string populated with coords.
func NewLinearRing ¶
NewLinearRing returns a new linear ring populated with coords.
func NewPolygon ¶
NewPolygon returns a new point populated with coordss.
func (*Geom) BufferWithStyle ¶ added in v0.7.0
func (g *Geom) BufferWithStyle(width float64, quadsegs int, endCapStyle BufCapStyle, joinStyle BufJoinStyle, mitreLimit float64) *Geom
BufferWithStyle returns a buffer using the provided style parameters.
func (*Geom) ConcaveHull ¶ added in v0.7.0
func (*Geom) Destroy ¶
func (g *Geom) Destroy()
Destroy destroys g and releases all resources it holds.
func (*Geom) Difference ¶ added in v0.6.0
Difference returns the difference between g and other.
func (*Geom) DifferencePrec ¶ added in v0.6.0
DifferencePrec returns the difference between g and other.
func (*Geom) Distance ¶ added in v0.3.0
Distance returns the distance between the closes points on g and other.
func (*Geom) DistanceIndexed ¶ added in v0.5.0
DistanceIndexed returns the distance between g and other, using the indexed facet distance.
func (*Geom) DistanceWithin ¶ added in v0.5.0
DistanceWithin returns whether the distance between g and other is within the given dist.
func (*Geom) EqualsExact ¶
EqualsExact returns true if g equals other exactly.
func (*Geom) ExteriorRing ¶
ExteriorRing returns the exterior ring.
func (*Geom) FrechetDistance ¶ added in v0.5.0
FrechetDistance returns the Fréchet distance between g and other.
func (*Geom) FrechetDistanceDensify ¶ added in v0.5.0
FrechetDistanceDensify returns the Fréchet distance between g and other.
func (*Geom) HausdorffDistance ¶ added in v0.5.0
HausdorffDistance returns the Hausdorff distance between g and other.
func (*Geom) HausdorffDistanceDensify ¶ added in v0.5.0
HausdorffDistanceDensify returns the Hausdorff distance between g and other.
func (*Geom) InteriorRing ¶
InteriorRing returns the nth interior ring.
func (*Geom) Interpolate ¶ added in v0.7.0
Interpolate returns a point distance d from the start of g, which must be a linestring.
func (*Geom) InterpolateNormalized ¶ added in v0.7.0
InterpolateNormalized returns the point that is at proportion from the start.
func (*Geom) Intersection ¶
func (*Geom) IntersectionPrec ¶ added in v0.7.0
func (*Geom) Intersects ¶
Intersects returns true if g intersects other.
func (*Geom) IsValidReason ¶
IsValidReason returns the reason that g is invalid.
func (*Geom) MakeValid ¶ added in v0.8.0
MakeValid repair an invalid geometry, returning a valid output.
func (*Geom) MaximumInscribedCircle ¶ added in v0.7.0
func (*Geom) MinimumRotatedRectangle ¶ added in v0.7.0
func (*Geom) MinimumWidth ¶ added in v0.4.0
MinimumWidth returns a linestring geometry which represents the minimum diameter of g.
func (*Geom) NearestPoints ¶ added in v0.3.0
NearestPoints returns the nearest coordinates of g and other. If the nearest coordinates do not exist (e.g., when either geom is empty), it returns nil.
func (*Geom) NumGeometries ¶
NumGeometries returns the number of geometries in g.
func (*Geom) NumInteriorRings ¶
NumInteriorRings returns the number of interior rings in g.
func (*Geom) OffsetCurve ¶ added in v0.7.0
func (*Geom) SetPrecision ¶ added in v0.8.0
func (g *Geom) SetPrecision(gridSize float64, flags PrecisionRule) *Geom
func (*Geom) SymDifference ¶ added in v0.7.0
func (*Geom) TopologyPreserveSimplify ¶ added in v0.8.0
TopologyPreserveSimplify returns a simplified geometry preserving topology.
func (*Geom) UnaryUnion ¶ added in v0.4.0
UnaryUnion returns the union of all components of a single geometry.
type PrecisionRule ¶ added in v0.8.0
type PrecisionRule int
const ( PrecisionRuleValidOutput PrecisionRule = C.GEOS_PREC_VALID_OUTPUT PrecisionRulePointwise PrecisionRule = C.GEOS_PREC_NO_TOPO PrecisionRuleKeepCollapsed PrecisionRule = C.GEOS_PREC_KEEP_COLLAPSED )
Precision rules.
type PrepGeom ¶
type PrepGeom struct {
// contains filtered or unexported fields
}
A PrepGeom is a prepared geometry.
func (*PrepGeom) ContainsProperly ¶
ContainsProperly returns if pg contains g properly.
func (*PrepGeom) Intersects ¶
Intersects returns if pg contains g.
type TypeID ¶ added in v0.7.0
type TypeID int
A TypeID is a geometry type id.
const ( TypeIDPoint TypeID = C.GEOS_POINT TypeIDLineString TypeID = C.GEOS_LINESTRING TypeIDLinearRing TypeID = C.GEOS_LINEARRING TypeIDPolygon TypeID = C.GEOS_POLYGON TypeIDMultiPoint TypeID = C.GEOS_MULTIPOINT TypeIDMultiLineString TypeID = C.GEOS_MULTILINESTRING TypeIDMultiPolygon TypeID = C.GEOS_MULTIPOLYGON TypeIDGeometryCollection TypeID = C.GEOS_GEOMETRYCOLLECTION )
Geometry type ids.