geos

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2020 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrGeometryCollectionNotSupported = errors.New("GeometryCollection not supported")

ErrGeometryCollectionNotSupported indicates that a GeometryCollection was passed to a function that does not support GeometryCollections.

Functions

func Buffer

func Buffer(g geom.Geometry, radius float64) (geom.Geometry, error)

Buffer returns a geometry that contains all points within the given radius of the input geometry.

func Contains

func Contains(a, b geom.Geometry) (bool, error)

Contains returns true if and only if geometry A contains geometry B. See the global Contains function for details. Formally, the following two conditions must hold:

1. No points of B lies on the exterior of geometry A. That is, B must only be in the exterior or boundary of A.

2 .At least one point of the interior of B lies on the interior of A. That is, they can't *only* intersect at their boundaries.

func CoveredBy

func CoveredBy(a, b geom.Geometry) (bool, error)

CoveredBy returns true if and only if geometry A is covered by geometry B. Formally, the following two conditions must hold:

1. No points of A lies on the exterior of geometry B. That is, A must only be in the exterior or boundary of B.

2. At least one point of A lies on B (either its interior or boundary).

func Covers

func Covers(a, b geom.Geometry) (bool, error)

Covers returns true if and only if geometry A covers geometry B. Formally, the following two conditions must hold:

1. No points of B lies on the exterior of geometry A. That is, B must only be in the exterior or boundary of A.

2. At least one point of B lies on A (either its interior or boundary).

func Crosses

func Crosses(a, b geom.Geometry) (bool, error)

Crosses returns true if and only if geometry A and B cross each other. Formally, the following conditions must hold:

1. The geometries must have some but not all interior points in common.

2. The dimensionality of the intersection must be less than the maximum dimension of the input geometries.

3. The intersection must not equal either of the input geometries.

func Disjoint

func Disjoint(g1, g2 geom.Geometry) (bool, error)

Disjoint returns true if and only if the input geometries have no points in common.

func Equals

func Equals(g1, g2 geom.Geometry) (bool, error)

Equals returns true if and only if the input geometries are spatially equal, i.e. they represent exactly the same set of points.

func Intersection

func Intersection(a, b geom.Geometry) (geom.Geometry, error)

Intersection returns a geometry that is the intersection of the input geometries. Formally, the returned geometry will contain a particular point X if and only if X is present in both geometries.

func Intersects

func Intersects(a, b geom.Geometry) (bool, error)

Intersects returns true if and only if the geometries share at least one point in common.

func Overlaps

func Overlaps(a, b geom.Geometry) (bool, error)

Overlaps returns true if and only if geometry A and B overlap with each other. Formally, the following conditions must hold:

1. The geometries must have the same dimension.

2. The geometries must have some but not all points in common.

3. The intersection of the geometries must have the same dimension as the geometries themselves.

func Touches

func Touches(g1, g2 geom.Geometry) (bool, error)

Touches returns true if and only if the geometries have at least 1 point in common, but their interiors don't intersect.

func Union

func Union(a, b geom.Geometry) (geom.Geometry, error)

Union returns a geometry that that is the union of the input geometries. Formally, the returned geometry will contain a particular point X if and only if X is present in either geometry (or both).

func Within

func Within(a, b geom.Geometry) (bool, error)

Within returns true if and only if geometry A is completely within geometry B. Formally, the following two conditions must hold:

1. No points of A lies on the exterior of geometry B. That is, A must only be in the exterior or boundary of B.

2.At least one point of the interior of A lies on the interior of B. That is, they can't *only* intersect at their boundaries.

Types

type Handle

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

Handle is an opaque handle that can be used to invoke GEOS operations. Instances are not threadsafe and thus should only be used serially (e.g. protected by a mutex or similar).

func NewHandle

func NewHandle() (*Handle, error)

NewHandle creates a new GEOS handle.

func (*Handle) Buffer

func (h *Handle) Buffer(g geom.Geometry, radius float64) (geom.Geometry, error)

Buffer returns a geometry that contains all points within the given radius of the input geometry.

func (*Handle) Contains

func (h *Handle) Contains(a, b geom.Geometry) (bool, error)

Contains returns true if and only if geometry A contains geometry B. See the global Contains function for details.

func (*Handle) CoveredBy

func (h *Handle) CoveredBy(a, b geom.Geometry) (bool, error)

CoveredBy returns true if and only if geometry A is covered by geometry B. See the global CoveredBy function for details.

func (*Handle) Covers

func (h *Handle) Covers(a, b geom.Geometry) (bool, error)

Covers returns true if and only if geometry A covers geometry B. See the global Covers function for details.

func (*Handle) Crosses

func (h *Handle) Crosses(a, b geom.Geometry) (bool, error)

Crosses returns true if and only if geometry A and B cross each other. See the global Crosses function for details.

func (*Handle) Disjoint

func (h *Handle) Disjoint(g1, g2 geom.Geometry) (bool, error)

Disjoint returns true if and only if the input geometries have no points in common.

func (*Handle) Equals

func (h *Handle) Equals(g1, g2 geom.Geometry) (bool, error)

Equals returns true if and only if the input geometries are spatially equal.

func (*Handle) Intersection

func (h *Handle) Intersection(g1, g2 geom.Geometry) (geom.Geometry, error)

Intersection returns a geometry that is the intersection of the input geometries. See the global Intersection function for details.

func (*Handle) Intersects

func (h *Handle) Intersects(a, b geom.Geometry) (bool, error)

Intersects returns true if and only if the geometries share at least one point in common.

func (*Handle) Overlaps

func (h *Handle) Overlaps(a, b geom.Geometry) (bool, error)

Overlaps returns true if and only if the geometry A and B overlap each other. See the global Overlaps function for details.

func (*Handle) Release

func (h *Handle) Release()

Release releases any resources held by the handle. The handle should not be used after Release is called.

func (*Handle) Touches

func (h *Handle) Touches(g1, g2 geom.Geometry) (bool, error)

Touches returns true if and only if the geometries have at least 1 point in common, but their interiors don't intersect.

func (*Handle) Union

func (h *Handle) Union(g1, g2 geom.Geometry) (geom.Geometry, error)

Union returns a geometry that that is the union of the input geometries. See the global Union function for details.

func (*Handle) Within

func (h *Handle) Within(a, b geom.Geometry) (bool, error)

Within returns true if and only if geometry A is completely within geometry B. See the global Within function for details.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL