cockroach: Index | Files

package geos

import ""

Package geos is a wrapper around the spatial data types between the geo package and the GEOS C library. The GEOS library is dynamically loaded at init time. Operations will error if the GEOS library was not found.


Package Files



const (
    BufferParamsJoinStyleRound = 1
    BufferParamsJoinStyleMitre = 2
    BufferParamsJoinStyleBevel = 3

These should be kept in sync with the corresponding enum definition.

const (
    BufferParamsEndCapStyleRound  = 1
    BufferParamsEndCapStyleFlat   = 2
    BufferParamsEndCapStyleSquare = 3

These should be kept in sync with the corresponding enum definition.

func Area Uses

func Area(ewkb geopb.EWKB) (float64, error)

Area returns the area of an EWKB.

func Buffer Uses

func Buffer(ewkb geopb.EWKB, params BufferParams, distance float64) (geopb.EWKB, error)

Buffer buffers the given geometry by the given distance and params.

func Centroid Uses

func Centroid(ewkb geopb.EWKB) (geopb.EWKB, error)

Centroid returns the centroid of an EWKB.

func ClipEWKBByRect Uses

func ClipEWKBByRect(
    ewkb geopb.EWKB, xMin float64, yMin float64, xMax float64, yMax float64,
) (geopb.EWKB, error)

ClipEWKBByRect clips a EWKB to the specified rectangle.

func Contains Uses

func Contains(a geopb.EWKB, b geopb.EWKB) (bool, error)

Contains returns whether the EWKB provided by A contains the EWKB provided by B.

func ConvexHull Uses

func ConvexHull(ewkb geopb.EWKB) (geopb.EWKB, error)

ConvexHull returns an EWKB which returns the convex hull of the given EWKB.

func CoveredBy Uses

func CoveredBy(a geopb.EWKB, b geopb.EWKB) (bool, error)

CoveredBy returns whether the EWKB provided by A is covered by the EWKB provided by B.

func Covers Uses

func Covers(a geopb.EWKB, b geopb.EWKB) (bool, error)

Covers returns whether the EWKB provided by A covers the EWKB provided by B.

func Crosses Uses

func Crosses(a geopb.EWKB, b geopb.EWKB) (bool, error)

Crosses returns whether the EWKB provided by A crosses the EWKB provided by B.

func Disjoint Uses

func Disjoint(a geopb.EWKB, b geopb.EWKB) (bool, error)

Disjoint returns whether the EWKB provided by A is disjoint from the EWKB provided by B.

func EnsureInit Uses

func EnsureInit(
    errDisplay EnsureInitErrorDisplay, flagLibraryDirectoryValue string,
) (string, error)

EnsureInit attempts to start GEOS if it has not been opened already and returns the location if found, and an error if the CR_GEOS is not valid.

func Equals Uses

func Equals(a geopb.EWKB, b geopb.EWKB) (bool, error)

Equals returns whether the EWKB provided by A equals the EWKB provided by B.

func InterpolateLine Uses

func InterpolateLine(ewkb geopb.EWKB, distance float64) (geopb.EWKB, error)

InterpolateLine returns the point along the given LineString which is at a given distance from starting point. Note: For distance less than 0 it returns start point similarly for distance greater LineString's length. InterpolateLine also works with (Multi)LineString. However, the result is not appropriate as it combines all the LineString present in (MULTI)LineString, considering all the corner points of LineString overlaps each other.

func Intersection Uses

func Intersection(a geopb.EWKB, b geopb.EWKB) (geopb.EWKB, error)

Intersection returns an EWKB which contains the geometries of intersection between A and B.

func Intersects Uses

func Intersects(a geopb.EWKB, b geopb.EWKB) (bool, error)

Intersects returns whether the EWKB provided by A intersects the EWKB provided by B.

func IsValid Uses

func IsValid(ewkb geopb.EWKB) (bool, error)

IsValid returns whether the given geometry is valid.

func IsValidDetail Uses

func IsValidDetail(ewkb geopb.EWKB, flags int) (bool, string, geopb.EWKB, error)

IsValidDetail returns information regarding whether a geometry is valid or invalid. 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. It returns a bool representing whether it is valid, a string giving a reason for invalidity and an EWKB representing the location things are invalid at.

func IsValidReason Uses

func IsValidReason(ewkb geopb.EWKB) (string, error)

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

func Length Uses

func Length(ewkb geopb.EWKB) (float64, error)

Length returns the length of an EWKB.

func MakeValid Uses

func MakeValid(ewkb geopb.EWKB) (geopb.EWKB, error)

MakeValid returns a valid form of the EWKB.

func MinDistance Uses

func MinDistance(a geopb.EWKB, b geopb.EWKB) (float64, error)

MinDistance returns the minimum distance between two EWKBs.

func Overlaps Uses

func Overlaps(a geopb.EWKB, b geopb.EWKB) (bool, error)

Overlaps returns whether the EWKB provided by A overlaps the EWKB provided by B.

func PointOnSurface Uses

func PointOnSurface(ewkb geopb.EWKB) (geopb.EWKB, error)

PointOnSurface returns an EWKB with a point that is on the surface of the given EWKB.

func Relate Uses

func Relate(a geopb.EWKB, b geopb.EWKB) (string, error)

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

func RelatePattern Uses

func RelatePattern(a geopb.EWKB, b geopb.EWKB, pattern string) (bool, error)

RelatePattern whether A and B have a DE-9IM relation matching the given pattern.

func Touches Uses

func Touches(a geopb.EWKB, b geopb.EWKB) (bool, error)

Touches returns whether the EWKB provided by A touches the EWKB provided by B.

func Union Uses

func Union(a geopb.EWKB, b geopb.EWKB) (geopb.EWKB, error)

Union returns an EWKB which is a union of shapes A and B.

func WKTToEWKB Uses

func WKTToEWKB(wkt geopb.WKT, srid geopb.SRID) (geopb.EWKB, error)

WKTToEWKB parses a WKT into WKB using the GEOS library.

func Within Uses

func Within(a geopb.EWKB, b geopb.EWKB) (bool, error)

Within returns whether the EWKB provided by A is within the EWKB provided by B.

type BufferParams Uses

type BufferParams struct {
    JoinStyle        BufferParamsJoinStyle
    EndCapStyle      BufferParamsEndCapStyle
    SingleSided      bool
    QuadrantSegments int
    MitreLimit       float64

BufferParams are parameters to provide into the GEOS buffer function.

type BufferParamsEndCapStyle Uses

type BufferParamsEndCapStyle int

BufferParamsEndCapStyle maps to the GEOSBufCapStyles enum in

type BufferParamsJoinStyle Uses

type BufferParamsJoinStyle int

BufferParamsJoinStyle maps to the GEOSBufJoinStyles enum in

type EnsureInitErrorDisplay Uses

type EnsureInitErrorDisplay int

EnsureInitErrorDisplay is used to control the error message displayed by EnsureInit.

const (
    // EnsureInitErrorDisplayPrivate displays the full error message, including
    // path info. It is intended for log messages.
    EnsureInitErrorDisplayPrivate EnsureInitErrorDisplay = iota
    // EnsureInitErrorDisplayPublic displays a redacted error message, excluding
    // path info. It is intended for errors to display for the client.

type Error Uses

type Error struct {
    // contains filtered or unexported fields

A Error wraps an error returned from a GEOS operation.

func (*Error) Error Uses

func (err *Error) Error() string

Error implements the error interface.

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