Documentation ¶
Overview ¶
Package op provides implementation of algorithms for geometry operations. For further details, consult the description of Polygon.Construct method.
Index ¶
- func Area(g geom.Geom) float64
- func Centroid(g geom.Geom) (geom.Point, error)
- func Clone(p geom.Polygon) geom.Polygon
- func Distance(a, b geom.Geom) float64
- func FixOrientation(g geom.Geom) error
- func Length(g geom.Geom) float64
- func PointEquals(p1, p2 geom.Point) bool
- func PointOnSurface(g geom.Geom) (geom.Point, error)
- func Within(inner, outer geom.Geom) (bool, error)
- type InfiniteLoopError
- type Op
- type UnsupportedGeometryError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Area ¶
Function Area returns the area of a polygon, or the combined area of a MultiPolygon, assuming that none of the polygons in the MultiPolygon overlap and that nested polygons have alternating winding directions.
func Centroid ¶
Calculate the centroid of a polygon, from wikipedia: http://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon. The polygon can have holes, but each ring must be closed (i.e., p[0] == p[n-1], where the ring has n points) and must not be self-intersecting. The algorithm will not check to make sure the holes are actually inside the outer rings.
func Distance ¶
Distance returns the distance between the closest parts of two geometries. Currently, only points are supported.
func FixOrientation ¶
Change the winding direction of the outer and inner rings so the outer ring is counter-clockwise and nesting rings alternate directions.
func Length ¶
Function Length returns the length of a LineString, or the combined length of a MultiLineString.
func PointEquals ¶
Equals returns true if both p1 and p2 describe the same point within a tolerance limit.
func PointOnSurface ¶
Function PointOnSurface returns a point guaranteed to lie on the surface of the shape. It will usually be the centroid, except for when the centroid is not with the shape.
Types ¶
type InfiniteLoopError ¶
type InfiniteLoopError struct {
// contains filtered or unexported fields
}
func (InfiniteLoopError) Error ¶
func (e InfiniteLoopError) Error() string
type UnsupportedGeometryError ¶
func (UnsupportedGeometryError) Error ¶
func (e UnsupportedGeometryError) Error() string