Documentation
ยถ
Overview ยถ
Package geos provides an interface to GEOS. See https://trac.osgeo.org/geos/.
Index ยถ
- Constants
- Variables
- func VersionCompare(major, minor, patch int) int
- type Box2D
- func (b *Box2D) Contains(other *Box2D) bool
- func (b *Box2D) ContainsPoint(x, y float64) bool
- func (b *Box2D) ContextGeom(context *Context) *Geom
- func (b *Box2D) Equals(other *Box2D) bool
- func (b *Box2D) Geom() *Geom
- func (b *Box2D) Height() float64
- func (b *Box2D) Intersects(other *Box2D) bool
- func (b *Box2D) IsEmpty() bool
- func (b *Box2D) IsPoint() bool
- func (b *Box2D) String() string
- func (b *Box2D) Width() float64
- type Box3D
- type BufCapStyle
- type BufJoinStyle
- type BufParams
- func (p *BufParams) SetEndCapStyle(style BufCapStyle) *BufParams
- func (p *BufParams) SetJoinStyle(style BufJoinStyle) *BufParams
- func (p *BufParams) SetMitreLimit(mitreLimit float64) *BufParams
- func (p *BufParams) SetQuadrantSegments(quadSegs int) *BufParams
- func (p *BufParams) SetSingleSided(singleSided bool) *BufParams
- type Context
- func (c *Context) Clone(g *Geom) *Geom
- func (c *Context) NewBufParams() *BufParams
- 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) NewGeoJSONReader() *GeoJSONReader
- func (c *Context) NewGeoJSONWriter() *GeoJSONWriter
- func (c *Context) NewGeomFromBounds(minX, minY, maxX, maxY float64) *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) NewPointFromXY(x, y float64) *Geom
- func (c *Context) NewPoints(coords [][]float64) []*Geom
- func (c *Context) NewPolygon(coordss [][][]float64) *Geom
- func (c *Context) NewSTRtree(nodeCapacity int) *STRtree
- func (c *Context) NewWKBReader() *WKBReader
- func (c *Context) NewWKBWriter(options ...WKBWriterOption) *WKBWriter
- func (c *Context) NewWKTReader() *WKTReader
- func (c *Context) NewWKTWriter() *WKTWriter
- func (c *Context) OrientationIndex(ax, ay, bx, by, px, py float64) int
- func (c *Context) Polygonize(geoms []*Geom) *Geom
- func (c *Context) PolygonizeValid(geoms []*Geom) *Geom
- func (c *Context) RelatePatternMatch(mat, pat string) bool
- func (c *Context) SegmentIntersection(ax0, ay0, ax1, ay1, bx0, by0, bx1, by1 float64) (x, y float64, intersection bool)
- type CoordSeq
- func (s *CoordSeq) Clone() *CoordSeq
- func (s *CoordSeq) Dimensions() int
- func (s *CoordSeq) IsCCW() bool
- 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 GeoJSONReader
- type GeoJSONWriter
- 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(minX, minY, maxX, maxY float64) *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 NewPointFromXY(x, y float64) *Geom
- func NewPolygon(coordss [][][]float64) *Geom
- func Polygonize(geoms []*Geom) *Geom
- func PolygonizeValid(geoms []*Geom) *Geom
- func (g *Geom) Area() float64
- func (g *Geom) Boundary() *Geom
- func (g *Geom) Bounds() *Box2D
- func (g *Geom) Buffer(width float64, quadsegs int) *Geom
- func (g *Geom) BufferWithParams(bufParams *BufParams, width float64) *Geom
- func (g *Geom) BufferWithStyle(width float64, quadsegs int, endCapStyle BufCapStyle, joinStyle BufJoinStyle, ...) *Geom
- func (g *Geom) BuildArea() *Geom
- func (g *Geom) Centroid() *Geom
- func (g *Geom) ClipByBox2D(box2d *Box2D) *Geom
- func (g *Geom) ClipByRect(minX float64, minY float64, maxX float64, maxY float64) *Geom
- func (g *Geom) Clone() *Geom
- func (g *Geom) ConcaveHull(ratio float64, allowHoles uint) *Geom
- func (g *Geom) ConcaveHullByLength(ratio float64, allowHoles uint) *Geom
- func (g *Geom) ConstrainedDelaunayTriangulation() *Geom
- func (g *Geom) Contains(other *Geom) bool
- func (g *Geom) ConvexHull() *Geom
- func (g *Geom) CoordSeq() *CoordSeq
- func (g *Geom) CoverageUnion() *Geom
- 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) Difference(other *Geom) *Geom
- func (g *Geom) DifferencePrec(other *Geom, gridSize float64) *Geom
- func (g *Geom) Disjoint(other *Geom) bool
- func (g *Geom) DisjointSubsetUnion() *Geom
- 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) EndPoint() *Geom
- 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) HasZ() bool
- 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) LargestEmptyCircle(other *Geom, tolerance float64) *Geom
- func (g *Geom) Length() float64
- func (g *Geom) LineMerge() *Geom
- func (g *Geom) MakeValid() *Geom
- func (g *Geom) MakeValidWithParams(method MakeValidMethod, collapse MakeValidCollapsed) *Geom
- func (g *Geom) MaximumInscribedCircle(tolerance float64) *Geom
- func (g *Geom) MinimumClearance() float64
- func (g *Geom) MinimumClearanceLine() *Geom
- func (g *Geom) MinimumRotatedRectangle() *Geom
- func (g *Geom) MinimumWidth() *Geom
- func (g *Geom) NearestPoints(other *Geom) [][]float64
- func (g *Geom) Node() *Geom
- func (g *Geom) Normalize() *Geom
- func (g *Geom) NumCoordinates() int
- 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) PointOnSurface() *Geom
- func (g *Geom) PolygonizeFull() (geom, cuts, dangles, invalidRings *Geom)
- func (g *Geom) Precision() float64
- func (g *Geom) Prepare() *PrepGeom
- func (g *Geom) Project(other *Geom) float64
- func (g *Geom) ProjectNormalized(other *Geom) float64
- func (g *Geom) Relate(other *Geom) string
- func (g *Geom) RelateBoundaryNodeRule(other *Geom, bnr RelateBoundaryNodeRule) string
- func (g *Geom) RelatePattern(other *Geom, pat string) bool
- func (g *Geom) Reverse() *Geom
- func (g *Geom) SRID() int
- func (g *Geom) SetPrecision(gridSize float64, flags PrecisionRule) *Geom
- func (g *Geom) SetSRID(srid int) *Geom
- func (g *Geom) SetUserData(userdata uintptr) *Geom
- func (g *Geom) SharedPaths(other *Geom) *Geom
- func (g *Geom) Simplify(tolerance float64) *Geom
- func (g *Geom) Snap(other *Geom, tolerance float64) *Geom
- func (g *Geom) StartPoint() *Geom
- func (g *Geom) String() string
- func (g *Geom) SymDifference(other *Geom) *Geom
- func (g *Geom) SymDifferencePrec(other *Geom, gridSize float64) *Geom
- func (g *Geom) ToEWKBWithSRID() []byte
- 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) UnaryUnionPrec(gridSize float64) *Geom
- func (g *Geom) Union(other *Geom) *Geom
- func (g *Geom) UnionPrec(other *Geom, gridSize float64) *Geom
- func (g *Geom) UserData() uintptr
- func (g *Geom) Within(other *Geom) bool
- func (g *Geom) X() float64
- func (g *Geom) Y() float64
- type MakeValidCollapsed
- type MakeValidMethod
- type PrecisionRule
- type PrepGeom
- func (pg *PrepGeom) Contains(g *Geom) bool
- func (pg *PrepGeom) ContainsProperly(g *Geom) bool
- func (pg *PrepGeom) ContainsXY(x, y float64) 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) DistanceWithin(g *Geom, dist float64) bool
- func (pg *PrepGeom) Intersects(g *Geom) bool
- func (pg *PrepGeom) IntersectsXY(x, y float64) bool
- func (pg *PrepGeom) NearestPoints(g *Geom) *CoordSeq
- func (pg *PrepGeom) Overlaps(g *Geom) bool
- func (pg *PrepGeom) Touches(g *Geom) bool
- func (pg *PrepGeom) Within(g *Geom) bool
- type RelateBoundaryNodeRule
- type STRtree
- func (t *STRtree) Insert(g *Geom, value any) error
- func (t *STRtree) Iterate(callback func(any))
- func (t *STRtree) Nearest(geom *Geom) *Geom
- func (t *STRtree) NearestGeneric(value any, valueEnvelope *Geom, distanceFunc func(any, any) float64) any
- func (t *STRtree) Query(g *Geom, callback func(any))
- func (t *STRtree) Remove(g *Geom, value any) bool
- type TypeID
- type WKBFlavor
- type WKBReader
- type WKBWriter
- type WKBWriterOption
- type WKTReader
- type WKTWriter
Examples ยถ
Constants ยถ
const ( VersionMajor = C.GEOS_VERSION_MAJOR VersionMinor = C.GEOS_VERSION_MINOR VersionPatch = C.GEOS_VERSION_PATCH )
Version.
Variables ยถ
var DefaultContext = NewContext()
DefaultContext is the default context.
Functions ยถ
func VersionCompare ยถ added in v0.15.0
VersionCompare returns a negative number if the GEOS version is less than the given major.minor.patch version, zero if it is equal, or a positive number otherwise.
Types ยถ
type Box2D ยถ added in v0.17.0
A Box2D is a two-dimensional bounds.
func NewBox2DEmpty ยถ added in v0.17.0
func NewBox2DEmpty() *Box2D
NewBox2DEmpty returns a new empty bounds.
func (*Box2D) ContainsPoint ยถ added in v0.17.0
ContainsPoint returns true if b contains the point at x, y.
func (*Box2D) ContextGeom ยถ added in v0.17.0
ContextGeom returns b as a Geom.
func (*Box2D) Intersects ยถ added in v0.17.0
Intersects returns true if b intersects other.
type Box3D ยถ added in v0.18.0
A Box3D is a three-dimensional bounds.
func NewBox3DEmpty ยถ added in v0.18.0
func NewBox3DEmpty() *Box3D
NewBox3DEmpty returns a new empty bounds.
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 BufParams ยถ added in v0.20.2
type BufParams struct {
// contains filtered or unexported fields
}
A BufParams contains parameters for BufferWithParams.
func (*BufParams) SetEndCapStyle ยถ added in v0.20.2
func (p *BufParams) SetEndCapStyle(style BufCapStyle) *BufParams
SetEndCapStyle sets p's end cap style.
func (*BufParams) SetJoinStyle ยถ added in v0.20.2
func (p *BufParams) SetJoinStyle(style BufJoinStyle) *BufParams
SetJoinStyle sets p's join style.
func (*BufParams) SetMitreLimit ยถ added in v0.20.2
SetMitreLimit sets p's mitre limit.
func (*BufParams) SetQuadrantSegments ยถ added in v0.20.2
SetQuadrantSegments sets the number of segments to stroke each quadrant of circular arcs.
func (*BufParams) SetSingleSided ยถ added in v0.20.2
SetSingleSided sets whether the computed buffer should be single sided.
type Context ยถ
type Context struct {
// contains filtered or unexported fields
}
A Context is a context.
func (*Context) NewBufParams ยถ added in v0.20.2
NewBufParams returns a new BufParams.
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) NewGeoJSONReader ยถ added in v0.20.2
func (c *Context) NewGeoJSONReader() *GeoJSONReader
NewGeoJSONReader returns a new GeoJSONReader.
func (*Context) NewGeoJSONWriter ยถ added in v0.20.2
func (c *Context) NewGeoJSONWriter() *GeoJSONWriter
NewGeoJSONWriter returns a new GeoJSONWriter.
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) NewPointFromXY ยถ added in v0.13.0
NewPointFromXY returns a new point with a x and y.
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 polygon populated with coordss.
func (*Context) NewSTRtree ยถ added in v0.12.0
NewSTRtree returns a new STRtree.
func (*Context) NewWKBReader ยถ added in v0.20.2
NewWKBReader returns a new WKBReader.
func (*Context) NewWKBWriter ยถ added in v0.20.2
func (c *Context) NewWKBWriter(options ...WKBWriterOption) *WKBWriter
NewWKBWriter returns a new WKBWriter with the given options.
func (*Context) NewWKTReader ยถ added in v0.20.2
NewWKTReader returns a new WKTReader.
func (*Context) NewWKTWriter ยถ added in v0.20.2
NewWKTWriter returns a new WKTWriter.
func (*Context) OrientationIndex ยถ added in v0.13.0
OrientationIndex returns the orientation index from A to B and then to P.
func (*Context) Polygonize ยถ added in v0.9.0
Polygonize returns a set of geometries which contains linework that represents the edges of a planar graph.
func (*Context) PolygonizeValid ยถ added in v0.9.0
PolygonizeValid returns a set of polygons which contains linework that represents the edges of a planar graph.
func (*Context) RelatePatternMatch ยถ added in v0.12.0
RelatePatternMatch returns if two DE9IM patterns are consistent.
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 GeoJSONReader ยถ added in v0.20.2
type GeoJSONReader struct {
// contains filtered or unexported fields
}
A GeoJSONReader reads GeoJSON.
func (*GeoJSONReader) ReadGeometry ยถ added in v0.20.2
func (r *GeoJSONReader) ReadGeometry(geoJSON string) (*Geom, error)
ReadGeometry reads a geometry from geoJSON.
type GeoJSONWriter ยถ added in v0.20.2
type GeoJSONWriter struct {
// contains filtered or unexported fields
}
A GeoJSONWriter writes geometries as GeoJSON.
func (*GeoJSONWriter) WriteGeometry ยถ added in v0.20.2
func (w *GeoJSONWriter) WriteGeometry(g *Geom, indent int) string
WriteGeometry returns the GeoJSON representation of g.
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 NewPointFromXY ยถ added in v0.13.0
NewPointFromXY returns a new point with x and y.
func NewPolygon ยถ
NewPolygon returns a new polygon populated with coordss.
func Polygonize ยถ added in v0.9.0
Polygonize returns a set of geometries which contains linework that represents the edges of a planar graph.
func PolygonizeValid ยถ added in v0.9.0
PolygonizeValid returns a set of polygons which contains linework that represents the edges of a planar graph.
func (*Geom) BufferWithParams ยถ added in v0.17.0
BufferWithParams returns g buffered with bufParams.
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) BuildArea ยถ added in v0.10.0
BuildArea returns the polygonization using all the linework, assuming that rings contained within rings are empty holes, rather than extra PolygonHoleSimplify.
func (*Geom) ClipByBox2D ยถ added in v0.17.0
ClipByBox2D clips g by box2d.
func (*Geom) ClipByRect ยถ added in v0.10.0
ClipByRect returns g clipped to a rectangular polygon.
func (*Geom) ConcaveHull ยถ added in v0.7.0
ConcaveHull returns the concave hull of g.
func (*Geom) ConcaveHullByLength ยถ added in v0.14.0
ConcaveHullByLength returns the concave hull of g.
func (*Geom) ConstrainedDelaunayTriangulation ยถ added in v0.13.0
ConstrainedDelaunayTriangulation returns the constrained Delaunay triangulation of the vertices of the g.
func (*Geom) CoordSeq ยถ
CoordSeq returns g's coordinate sequence. The returned CoordSeq is owned by g and is only valid for as long as g exists.
func (*Geom) CoverageUnion ยถ added in v0.10.0
CoverageUnion returns the union of g for polygonal inputs that are correctly noded and do not overlap.
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) DisjointSubsetUnion ยถ added in v0.20.1
DisjointSubsetUnion returns the union of all components of a single geometry (optimized for inputs that can be divided into subsets that do not intersect).
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. The returned geometry is owned by g and is only valid for as long as g exists.
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) Geometry ยถ
Geometry returns the nth geometry of g. The returned geometry is owned by g and is only valid for as long as g exists.
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. The returned geometry is owned by g and is only valid for as long as g exists.
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 ยถ
Intersection returns the intersection of g and other.
func (*Geom) IntersectionPrec ยถ added in v0.7.0
IntersectionPrec returns the intersection of g and other.
func (*Geom) Intersects ยถ
Intersects returns true if g intersects other.
func (*Geom) IsValidReason ยถ
IsValidReason returns the reason that g is invalid.
func (*Geom) LargestEmptyCircle ยถ added in v0.13.0
LargestEmptyCircle returns the largest empty circle for g, up to a specified tolerance.
func (*Geom) LineMerge ยถ added in v0.13.0
LineMerge returns a set of fully noded LineStrings, removing any cardinality 2 nodes in the linework.
func (*Geom) MakeValid ยถ added in v0.8.0
MakeValid repairs an invalid geometry, returning a valid output.
func (*Geom) MakeValidWithParams ยถ added in v0.14.0
func (g *Geom) MakeValidWithParams(method MakeValidMethod, collapse MakeValidCollapsed) *Geom
MakeValidWithParams returns a new valid geometry using the MakeValidMethods and MakeValidCollapsed parameters.
func (*Geom) MaximumInscribedCircle ยถ added in v0.7.0
MaximumInscribedCircle returns the maximum inscribed circle of g up to the the given tolerance.
func (*Geom) MinimumClearance ยถ added in v0.13.0
MinimumClearance returns the minimum clearance of g.
func (*Geom) MinimumClearanceLine ยถ added in v0.13.0
MinimumClearanceLine returns a LineString whose endpoints define the minimum clearance of g.
func (*Geom) MinimumRotatedRectangle ยถ added in v0.7.0
MinimumRotatedRectangle returns the minimum rotated rectangle enclosing g.
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) Node ยถ added in v0.10.0
Node returns a new geometry in which no lines cross each other, and all touching occurs at endpoints.
func (*Geom) NumCoordinates ยถ added in v0.13.0
NumCoordinates returns the number of coordinates in g.
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 (g *Geom) OffsetCurve(width float64, quadsegs int, joinStyle BufJoinStyle, mitreLimit float64) *Geom
OffsetCurve returns the offset curve line(s) of g.
func (*Geom) Point ยถ
Point returns the g's nth point. The returned geometry is owned by g and is only valid for as long as g exists.
func (*Geom) PointOnSurface ยถ added in v0.13.0
PointOnSurface returns a point that is inside the boundary of a polygonal geometry.
func (*Geom) PolygonizeFull ยถ added in v0.9.0
PolygonizeFull returns a set of geometries which contains linework that represents the edge of a planar graph.
func (*Geom) Project ยถ added in v0.11.0
Project returns the distance of other(a point) projected onto g(a line) from the start of the line.
func (*Geom) ProjectNormalized ยถ added in v0.11.0
ProjectNormalized returns the proportional distance of other(a point) projected onto g(a line) from the start of the line. For example, a point that projects to the middle of a line would be return 0.5.
func (*Geom) RelateBoundaryNodeRule ยถ added in v0.12.0
func (g *Geom) RelateBoundaryNodeRule(other *Geom, bnr RelateBoundaryNodeRule) string
RelateBoundaryNodeRule returns the DE9IM pattern for g and other.
func (*Geom) RelatePattern ยถ added in v0.12.0
RelatePattern returns if the DE9IM pattern for g and other matches pat.
func (*Geom) SetPrecision ยถ added in v0.8.0
func (g *Geom) SetPrecision(gridSize float64, flags PrecisionRule) *Geom
SetPrecision changes the coordinate precision of g.
func (*Geom) SetUserData ยถ added in v0.10.0
SetUserData sets g's userdata and returns g.
func (*Geom) SharedPaths ยถ added in v0.10.0
SharedPaths returns the paths shared between g and other, which must be lineal geometries.
func (*Geom) Snap ยถ added in v0.13.0
Snap returns a geometry with the vertices and segments of g snapped to other within the given tolerance.
func (*Geom) StartPoint ยถ added in v0.13.0
StartPoint returns the first point of a LineString.
func (*Geom) SymDifference ยถ added in v0.7.0
SymDifference returns the symmetric difference between g and other.
func (*Geom) SymDifferencePrec ยถ added in v0.10.0
SymDifferencePrec returns the symmetric difference between g and other.
func (*Geom) ToEWKBWithSRID ยถ added in v0.16.0
ToEWKBWithSRID returns g in Extended WKB format with its SRID.
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.
func (*Geom) UnaryUnionPrec ยถ added in v0.10.0
UnaryUnionPrec returns the union of all components of a single geometry.
type MakeValidCollapsed ยถ added in v0.14.0
type MakeValidCollapsed int
const ( MakeValidDiscardCollapsed MakeValidCollapsed = 0 MakeValidKeepCollapsed MakeValidCollapsed = 1 )
MakeValidMethods.
type MakeValidMethod ยถ added in v0.14.0
type MakeValidMethod int
const ( MakeValidLinework MakeValidMethod = C.GEOS_MAKE_VALID_LINEWORK MakeValidStructure MakeValidMethod = C.GEOS_MAKE_VALID_STRUCTURE )
MakeValidMethods.
type PrecisionRule ยถ added in v0.8.0
type PrecisionRule int
const ( PrecisionRuleNone PrecisionRule = 0 PrecisionRuleValidOutput PrecisionRule = C.GEOS_PREC_VALID_OUTPUT PrecisionRuleNoTopo PrecisionRule = C.GEOS_PREC_NO_TOPO 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.
Example ยถ
geom, err := geos.NewGeomFromWKT("POLYGON ((189 115, 200 170, 130 170, 35 242, 156 215, 210 290, 274 256, 360 190, 267 215, 300 50, 200 60, 189 115))")
if err != nil {
panic(err)
}
prepGeom := geom.Prepare()
point := geos.NewPointFromXY(190, 200)
if prepGeom.Intersects(point) {
fmt.Println("intersects")
}
Output: intersects
func (*PrepGeom) ContainsProperly ยถ
ContainsProperly returns if pg contains g properly.
func (*PrepGeom) ContainsXY ยถ added in v0.19.0
ContainsXY returns if pg contains the point (x, y).
func (*PrepGeom) DistanceWithin ยถ added in v0.19.0
DistanceWithin returns if pg is within dist g.
func (*PrepGeom) Intersects ยถ
Intersects returns if pg contains g.
func (*PrepGeom) IntersectsXY ยถ added in v0.19.0
IntersectsXY returns if pg intersects the point at (x, y).
func (*PrepGeom) NearestPoints ยถ added in v0.19.0
NearestPoints returns if pg overlaps g.
type RelateBoundaryNodeRule ยถ added in v0.12.0
type RelateBoundaryNodeRule int
A RelateBoundaryNodeRule is a relate boundary node rule.
const ( RelateBoundaryNodeRuleMod2 RelateBoundaryNodeRule = C.GEOSRELATE_BNR_MOD2 RelateBoundaryNodeRuleOGC RelateBoundaryNodeRule = C.GEOSRELATE_BNR_OGC RelateBoundaryNodeRuleEndpoint RelateBoundaryNodeRule = C.GEOSRELATE_BNR_ENDPOINT RelateBoundaryNodeRuleMultivalentEndpoint RelateBoundaryNodeRule = C.GEOSRELATE_BNR_MULTIVALENT_ENDPOINT RelateBoundaryNodeRuleMonovalentEndpoint RelateBoundaryNodeRule = C.GEOSRELATE_BNR_MONOVALENT_ENDPOINT )
Boundary node rules.
type STRtree ยถ added in v0.12.0
type STRtree struct {
// contains filtered or unexported fields
}
An STRtree is an R-tree spatial index structure for two dimensional data.
WARNING The Go bindings to STRtree are currently broken. Do not use them.
func NewSTRtree ยถ added in v0.20.2
NewSTRtree returns a new STRtree with the given number of entries per node.
func (*STRtree) Nearest ยถ added in v0.12.0
Nearest returns the nearest geometry to geom in t.
WARNING Nearest is currently broken and always panics with a segmentation fault.
func (*STRtree) NearestGeneric ยถ added in v0.20.2
func (t *STRtree) NearestGeneric(value any, valueEnvelope *Geom, distanceFunc func(any, any) float64) any
NearestGeneric returns the nearest value to value.
WARNING NearestGeneric is currently broken and always panics with a segmentation fault.
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.
type WKBFlavor ยถ added in v0.20.2
type WKBFlavor int
A WKBFlavor is a flavor of WKB.
const ( WKBFlavorExtended WKBFlavor = C.GEOS_WKB_EXTENDED WKBFlavorISO WKBFlavor = C.GEOS_WKB_ISO )
WKB flavors.
type WKBReader ยถ added in v0.20.2
type WKBReader struct {
// contains filtered or unexported fields
}
A WKBReader reads geometries from WKB (Well Known Binary).
type WKBWriter ยถ added in v0.20.2
type WKBWriter struct {
// contains filtered or unexported fields
}
A WKBWriter writes geometries as WKB (Well Known Binary).
type WKBWriterOption ยถ added in v0.20.2
type WKBWriterOption func(*WKBWriter)
A WKBWriterOption sets an option on a WKBWriter.
func WithWKBWriterFlavor ยถ added in v0.20.2
func WithWKBWriterFlavor(flavor WKBFlavor) WKBWriterOption
WithWKBWriterFlavor sets the WKB flavor.
func WithWKBWriterIncludeSRID ยถ added in v0.20.2
func WithWKBWriterIncludeSRID(includeSRID bool) WKBWriterOption
WithWKBWriterIncludeSRID sets whether to include the SRID.
Source Files
ยถ
Directories
ยถ
| Path | Synopsis |
|---|---|
|
examples
module
|
|
|
Package geojson implements GEOS-backed GeoJSON.
|
Package geojson implements GEOS-backed GeoJSON. |
|
Package geometry provides a GEOS-backed geometry type.
|
Package geometry provides a GEOS-backed geometry type. |
|
internal
|
|
|
cmds/execute-template
command
execute-template executes a Go template with data.
|
execute-template executes a Go template with data. |