cockroach: github.com/cockroachdb/cockroach/pkg/geo/geomfn Index | Files

package geomfn

import "github.com/cockroachdb/cockroach/pkg/geo/geomfn"

Package geomfn contains functions that are used for geometry-based builtins.

Index

Package Files

azimuth.go binary_predicates.go buffer.go coord.go de9im.go distance.go envelope.go force.go geomfn.go linear_reference.go make_geometry.go scale.go segmentize.go topology_operations.go translate.go unary_operators.go validity_check.go

func Area Uses

func Area(g *geo.Geometry) (float64, error)

Area returns the area of a given Geometry.

func Azimuth Uses

func Azimuth(a *geo.Geometry, b *geo.Geometry) (*float64, error)

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 Buffer Uses

func Buffer(g *geo.Geometry, params BufferParams, distance float64) (*geo.Geometry, error)

Buffer buffers a given Geometry by the supplied parameters.

func Centroid Uses

func Centroid(g *geo.Geometry) (*geo.Geometry, error)

Centroid returns the Centroid of a given Geometry.

func Contains Uses

func Contains(a *geo.Geometry, b *geo.Geometry) (bool, error)

Contains returns whether geometry A contains geometry B.

func ContainsProperly Uses

func ContainsProperly(a *geo.Geometry, b *geo.Geometry) (bool, error)

ContainsProperly returns whether geometry A properly contains geometry B.

func ConvexHull Uses

func ConvexHull(g *geo.Geometry) (*geo.Geometry, error)

ConvexHull returns the convex hull of a given Geometry.

func CoveredBy Uses

func CoveredBy(a *geo.Geometry, b *geo.Geometry) (bool, error)

CoveredBy returns whether geometry A is covered by geometry B.

func Covers Uses

func Covers(a *geo.Geometry, b *geo.Geometry) (bool, error)

Covers returns whether geometry A covers geometry B.

func Crosses Uses

func Crosses(a *geo.Geometry, b *geo.Geometry) (bool, error)

Crosses returns whether geometry A crosses geometry B.

func DFullyWithin Uses

func DFullyWithin(a *geo.Geometry, b *geo.Geometry, d float64) (bool, error)

DFullyWithin determines whether the maximum distance across every pair of points comprising geometries A and B is within D units.

func DWithin Uses

func DWithin(a *geo.Geometry, b *geo.Geometry, d float64) (bool, error)

DWithin determines if any part of geometry A is within D units of geometry B.

func Disjoint Uses

func Disjoint(a *geo.Geometry, b *geo.Geometry) (bool, error)

Disjoint returns whether geometry A is disjoint from geometry B.

func Envelope Uses

func Envelope(g *geo.Geometry) (*geo.Geometry, error)

Envelope forms an envelope (compliant with the OGC spec) of the given Geometry. It uses the bounding box to return a Polygon, but can return a Point or Line if the bounding box is degenerate and not a box.

func Equals Uses

func Equals(a *geo.Geometry, b *geo.Geometry) (bool, error)

Equals returns whether geometry A equals geometry B.

func ForceLayout Uses

func ForceLayout(g *geo.Geometry, layout geom.Layout) (*geo.Geometry, error)

ForceLayout forces a geometry into the given layout. If dimensions are added, 0 coordinates are padded to them.

func Intersection Uses

func Intersection(a *geo.Geometry, b *geo.Geometry) (*geo.Geometry, error)

Intersection returns the geometries of intersection between A and B.

func Intersects Uses

func Intersects(a *geo.Geometry, b *geo.Geometry) (bool, error)

Intersects returns whether geometry A intersects geometry B.

func IsValid Uses

func IsValid(g *geo.Geometry) (bool, error)

IsValid returns whether the given Geometry is valid.

func IsValidReason Uses

func IsValidReason(g *geo.Geometry) (string, error)

IsValidReason returns the reasoning for whether the Geometry is valid or invalid.

func Length Uses

func Length(g *geo.Geometry) (float64, error)

Length returns the length of a given Geometry. Note only (MULTI)LINESTRING objects have a length. (MULTI)POLYGON objects should use Perimeter.

func LineInterpolatePoints Uses

func LineInterpolatePoints(g *geo.Geometry, fraction float64, repeat bool) (*geo.Geometry, error)

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 Uses

func LongestLineString(a *geo.Geometry, b *geo.Geometry) (*geo.Geometry, error)

LongestLineString returns the LineString corresponds to maximum distance across every pair of points comprising geometries A and B.

func MakePolygon Uses

func MakePolygon(outer *geo.Geometry, interior ...*geo.Geometry) (*geo.Geometry, error)

MakePolygon creates a Polygon geometry from linestring and optional inner linestrings. Returns errors if geometries are not linestrings.

func MakeValid Uses

func MakeValid(g *geo.Geometry) (*geo.Geometry, error)

MakeValid returns a valid form of the given Geometry.

func MatchesDE9IM Uses

func MatchesDE9IM(relation string, pattern string) (bool, error)

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 Uses

func MaxDistance(a *geo.Geometry, b *geo.Geometry) (float64, error)

MaxDistance returns the maximum distance across every pair of points comprising geometries A and B.

func MinDistance Uses

func MinDistance(a *geo.Geometry, b *geo.Geometry) (float64, error)

MinDistance returns the minimum distance between geometries A and B. This returns a geo.EmptyGeometryError if either A or B is EMPTY.

func Overlaps Uses

func Overlaps(a *geo.Geometry, b *geo.Geometry) (bool, error)

Overlaps returns whether geometry A overlaps geometry B.

func Perimeter Uses

func Perimeter(g *geo.Geometry) (float64, error)

Perimeter returns the perimeter of a given Geometry. Note only (MULTI)POLYGON objects have a perimeter. (MULTI)LineString objects should use Length.

func PointOnSurface Uses

func PointOnSurface(g *geo.Geometry) (*geo.Geometry, error)

PointOnSurface returns the PointOnSurface of a given Geometry.

func Relate Uses

func Relate(a *geo.Geometry, b *geo.Geometry) (string, error)

Relate returns the DE-9IM relation between A and B.

func RelatePattern Uses

func RelatePattern(a *geo.Geometry, b *geo.Geometry, pattern string) (bool, error)

RelatePattern returns whether the DE-9IM relation between A and B matches.

func Scale Uses

func Scale(geometry *geo.Geometry, factors []float64) (*geo.Geometry, error)

Scale returns a modified Geometry whose coordinates are multiplied by the factors. If there are missing dimensions in factors, the corresponding dimensions are not scaled.

func ScaleRelativeToOrigin Uses

func ScaleRelativeToOrigin(
    geometry *geo.Geometry, factor *geo.Geometry, origin *geo.Geometry,
) (*geo.Geometry, error)

ScaleRelativeToOrigin returns a modified Geometry whose coordinates are multiplied by the factors relative to the origin

func Segmentize Uses

func Segmentize(g *geo.Geometry, segmentMaxLength float64) (*geo.Geometry, error)

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 Uses

func ShortestLineString(a *geo.Geometry, b *geo.Geometry) (*geo.Geometry, error)

ShortestLineString returns the LineString corresponds to minimum distance across every pair of points comprising geometries A and B.

func Touches Uses

func Touches(a *geo.Geometry, b *geo.Geometry) (bool, error)

Touches returns whether geometry A touches geometry B.

func Translate Uses

func Translate(geometry *geo.Geometry, deltas []float64) (*geo.Geometry, error)

Translate returns a modified Geometry whose coordinates are incremented or decremented by the deltas.

func Union Uses

func Union(a *geo.Geometry, b *geo.Geometry) (*geo.Geometry, error)

Union returns the geometries of intersection between A and B.

func Within Uses

func Within(a *geo.Geometry, b *geo.Geometry) (bool, error)

Within returns whether geometry A is within geometry B.

type BufferParams Uses

type BufferParams struct {
    // contains filtered or unexported fields
}

BufferParams is a wrapper around the geos.BufferParams.

func MakeDefaultBufferParams Uses

func MakeDefaultBufferParams() BufferParams

MakeDefaultBufferParams returns the default BufferParams/

func ParseBufferParams Uses

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 Uses

func (b BufferParams) WithQuadrantSegments(quadrantSegments int) BufferParams

WithQuadrantSegments returns a copy of the BufferParams with the quadrantSegments set.

type ValidDetail Uses

type ValidDetail struct {
    IsValid bool
    // Reason is only populated if IsValid = false.
    Reason string
    // InvalidLocation is only populated if IsValid = false.
    InvalidLocation *geo.Geometry
}

ValidDetail contains information about the validity of a geometry.

func IsValidDetail Uses

func IsValidDetail(g *geo.Geometry, flags int) (ValidDetail, error)

IsValidDetail returns information about the validity of a Geometry. It takes in a flag parameter which behaves the same as the GEOS module, where 1 means that self-intersecting rings forming holes are considered valid.

Package geomfn imports 12 packages (graph) and is imported by 1 packages. Updated 2020-08-12. Refresh now. Tools for package owners.