Documentation
¶
Overview ¶
Package geomfn contains functions that are used for geometry-based builtins.
Index ¶
- func Area(g *geo.Geometry) (float64, error)
- func Azimuth(a *geo.Geometry, b *geo.Geometry) (*float64, error)
- func Buffer(g *geo.Geometry, params BufferParams, distance float64) (*geo.Geometry, error)
- func Centroid(g *geo.Geometry) (*geo.Geometry, error)
- func Contains(a *geo.Geometry, b *geo.Geometry) (bool, error)
- func ContainsProperly(a *geo.Geometry, b *geo.Geometry) (bool, error)
- func ConvexHull(g *geo.Geometry) (*geo.Geometry, error)
- func CoveredBy(a *geo.Geometry, b *geo.Geometry) (bool, error)
- func Covers(a *geo.Geometry, b *geo.Geometry) (bool, error)
- func Crosses(a *geo.Geometry, b *geo.Geometry) (bool, error)
- func DFullyWithin(a *geo.Geometry, b *geo.Geometry, d float64) (bool, error)
- func DWithin(a *geo.Geometry, b *geo.Geometry, d float64) (bool, error)
- func Equals(a *geo.Geometry, b *geo.Geometry) (bool, error)
- func Intersection(a *geo.Geometry, b *geo.Geometry) (*geo.Geometry, error)
- func Intersects(a *geo.Geometry, b *geo.Geometry) (bool, error)
- func Length(g *geo.Geometry) (float64, error)
- func LineInterpolatePoints(g *geo.Geometry, fraction float64, repeat bool) (*geo.Geometry, error)
- func LongestLineString(a *geo.Geometry, b *geo.Geometry) (*geo.Geometry, error)
- func MakePolygon(outer *geo.Geometry, interior ...*geo.Geometry) (*geo.Geometry, error)
- func MatchesDE9IM(relation string, pattern string) (bool, error)
- func MaxDistance(a *geo.Geometry, b *geo.Geometry) (float64, error)
- func MinDistance(a *geo.Geometry, b *geo.Geometry) (float64, error)
- func Overlaps(a *geo.Geometry, b *geo.Geometry) (bool, error)
- func Perimeter(g *geo.Geometry) (float64, error)
- func PointOnSurface(g *geo.Geometry) (*geo.Geometry, error)
- func Relate(a *geo.Geometry, b *geo.Geometry) (string, error)
- func RelatePattern(a *geo.Geometry, b *geo.Geometry, pattern string) (bool, error)
- func Segmentize(g *geo.Geometry, segmentMaxLength float64) (*geo.Geometry, error)
- func ShortestLineString(a *geo.Geometry, b *geo.Geometry) (*geo.Geometry, error)
- func Touches(a *geo.Geometry, b *geo.Geometry) (bool, error)
- func Union(a *geo.Geometry, b *geo.Geometry) (*geo.Geometry, error)
- func Within(a *geo.Geometry, b *geo.Geometry) (bool, error)
- type BufferParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Azimuth ¶
Azimuth returns the azimuth in radians of the segment defined by the given point geometries, where point a is the reference point. The reference direction from which the azimuth is calculated is north, and is positive clockwise. i.e. North = 0; East = π/2; South = π; West = 3π/2. See https://en.wikipedia.org/wiki/Polar_coordinate_system. Returns nil if the two points are the same. Returns an error if any of the two Geometry items are not points.
func ContainsProperly ¶
ContainsProperly returns whether geometry A properly contains geometry B.
func ConvexHull ¶
ConvexHull returns the convex hull of a given Geometry.
func DFullyWithin ¶
DFullyWithin determines whether the maximum distance across every pair of points comprising geometries A and B is within D units.
func Intersection ¶
Intersection returns the geometries of intersection between A and B.
func Intersects ¶
Intersects returns whether geometry A intersects geometry B.
func Length ¶
Length returns the length of a given Geometry. Note only (MULTI)LINESTRING objects have a length. (MULTI)POLYGON objects should use Perimeter.
func LineInterpolatePoints ¶
LineInterpolatePoints returns one or more points along the given LineString which are at an integral multiples of given fraction of LineString's total length. When repeat is set to false, it returns the first point.
func LongestLineString ¶
LongestLineString returns the LineString corresponds to maximum distance across every pair of points comprising geometries A and B.
func MakePolygon ¶
MakePolygon creates a Polygon geometry from linestring and optional inner linestrings. Returns errors if geometries are not linestrings.
func MatchesDE9IM ¶
MatchesDE9IM checks whether the given DE-9IM relation matches the DE-91M pattern. Assumes the relation has been computed, and such has no 'T' and '*' characters. See: https://en.wikipedia.org/wiki/DE-9IM.
func MaxDistance ¶
MaxDistance returns the maximum distance across every pair of points comprising geometries A and B.
func MinDistance ¶
MinDistance returns the minimum distance between geometries A and B. This returns a geo.EmptyGeometryError if either A or B is EMPTY.
func Perimeter ¶
Perimeter returns the perimeter of a given Geometry. Note only (MULTI)POLYGON objects have a perimeter. (MULTI)LineString objects should use Length.
func PointOnSurface ¶
PointOnSurface returns the PointOnSurface of a given Geometry.
func RelatePattern ¶
RelatePattern returns whether the DE-9IM relation between A and B matches.
func Segmentize ¶
Segmentize return modified Geometry having no segment longer that given maximum segment length. This works by inserting the extra points in such a manner that minimum number of new segments with equal length is created, between given two-points such that each segment has length less than or equal to given maximum segment length.
func ShortestLineString ¶
ShortestLineString returns the LineString corresponds to minimum distance across every pair of points comprising geometries A and B.
Types ¶
type BufferParams ¶
type BufferParams struct {
// contains filtered or unexported fields
}
BufferParams is a wrapper around the geos.BufferParams.
func MakeDefaultBufferParams ¶
func MakeDefaultBufferParams() BufferParams
MakeDefaultBufferParams returns the default BufferParams/
func ParseBufferParams ¶
func ParseBufferParams(s string, distance float64) (BufferParams, float64, error)
ParseBufferParams parses the given buffer params from a SQL string into the BufferParams form. The string must be of the same format as specified by https://postgis.net/docs/ST_Buffer.html. Returns the BufferParams, as well as the modified distance.
func (BufferParams) WithQuadrantSegments ¶
func (b BufferParams) WithQuadrantSegments(quadrantSegments int) BufferParams
WithQuadrantSegments returns a copy of the BufferParams with the quadrantSegments set.