geom

package module
v0.0.0-...-3cd2f5a Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: MIT Imports: 6 Imported by: 83

README

Godoc

Packages

package geom

Geometry interfaces to help drive interoperability within the Go geospatial community. This package focuses on 2D geometries.

package encoding

Encoding package describes a few interfaces and common errors for various sub packages implementing different encoders.

Dependencies

Dependencies are managed through go mod with the execption of one package:

Documentation

Overview

Package geom describes geometry interfaces.

Index

Constants

View Source
const (
	// PrecisionLevelBigFloat is the precision of big floats, rounding if over
	PrecisionLevelBigFloat = 20
)

Variables

View Source
var EmptyPoint = Point{nan, nan}

EmptyPoint describes an empty 2D point object.

View Source
var ErrInvalidLineString = errors.New("geom: invalid LineString")

ErrInvalidLineString is thrown when a LineString is malformed

View Source
var ErrInvalidLineStringM = errors.New("geom: invalid LineStringM")

ErrInvalidLineStringM is thrown when a LineStringM is malformed

View Source
var ErrInvalidLineStringMS = errors.New("geom: invalid LineStringMS")

ErrInvalidLineStringMS is thrown when a LineStringMS is malformed

View Source
var ErrInvalidLineStringS = errors.New("geom: invalid LineStringS")

ErrInvalidLineStringS is thrown when a LineStringS is malformed

View Source
var ErrInvalidLineStringZ = errors.New("geom: invalid LineStringZ")

ErrInvalidLineStringZ is thrown when a LineStringZ is malformed

View Source
var ErrInvalidLineStringZM = errors.New("geom: invalid LineStringZM")

ErrInvalidLineStringZM is thrown when a LineStringZM is malformed

View Source
var ErrInvalidLineStringZMS = errors.New("geom: invalid LineStringZMS")

ErrInvalidLineStringZMS is thrown when a LineStringZMS is malformed

View Source
var ErrInvalidLineStringZS = errors.New("geom: invalid LineStringZS")

ErrInvalidLineStringZS is thrown when a LineStringZS is malformed

View Source
var ErrInvalidLinearRing = errors.New("geom: invalid LinearRing")

ErrInvalidLinearRing is thrown when a LinearRing is malformed

View Source
var ErrInvalidLinearRingM = errors.New("geom: invalid LinearRingM")

ErrInvalidLinearRingM is thrown when a LinearRingM is malformed

View Source
var ErrInvalidLinearRingMS = errors.New("geom: invalid LinearRingMS")

ErrInvalidLinearRingMS is thrown when a LinearRingMS is malformed

View Source
var ErrInvalidLinearRingS = errors.New("geom: invalid LinearRingS")

ErrInvalidLinearRingS is thrown when a LinearRingS is malformed

View Source
var ErrInvalidLinearRingZ = errors.New("geom: invalid LinearRingZ")

ErrInvalidLinearRingZ is thrown when a LinearRingZ is malformed

View Source
var ErrInvalidLinearRingZM = errors.New("geom: invalid LinearRingZM")

ErrInvalidLinearRingZM is thrown when a LinearRingZM is malformed

View Source
var ErrInvalidLinearRingZMS = errors.New("geom: invalid LinearRingZMS")

ErrInvalidLinearRingZMS is thrown when a LinearRingZMS is malformed

View Source
var ErrInvalidLinearRingZS = errors.New("geom: invalid LinearRingZS")

ErrInvalidLinearRingZS is thrown when a LinearRingZS is malformed

View Source
var ErrInvalidPolygon = errors.New("geom: invalid Polygon")

ErrInvalidPolygon is thrown when a Polygon is malformed

View Source
var ErrInvalidPolygonM = errors.New("geom: invalid PolygonM")

ErrInvalidPolygonM is thrown when a Polygon is malformed

View Source
var ErrInvalidPolygonMS = errors.New("geom: invalid PolygonMS")

ErrInvalidPolygonMS is thrown when a Polygon is malformed

View Source
var ErrInvalidPolygonS = errors.New("geom: invalid PolygonS")

ErrInvalidPolygonS is thrown when a Polygon is malformed

View Source
var ErrInvalidPolygonZ = errors.New("geom: invalid PolygonZ")

ErrInvalidPolygonZ is thrown when a Polygon is malformed

View Source
var ErrInvalidPolygonZM = errors.New("geom: invalid PolygonZM")

ErrInvalidPolygonZM is thrown when a Polygon is malformed

View Source
var ErrInvalidPolygonZMS = errors.New("geom: invalid PolygonZMS")

ErrInvalidPolygonZMS is thrown when a Polygon is malformed

View Source
var ErrInvalidPolygonZS = errors.New("geom: invalid PolygonZS")

ErrInvalidPolygonZS is thrown when a Polygon is malformed

View Source
var ErrNilCollection = errors.New("geom: nil collection")

ErrNilCollection is thrown when a collection is nil but shouldn't be

View Source
var ErrNilLineString = errors.New("geom: nil LineString")

ErrNilLineString is thrown when a LineString is nil but shouldn't be

View Source
var ErrNilLineStringM = errors.New("geom: nil LineStringM")

ErrNilLineStringM is thrown when a LineStringM is nil but shouldn't be

View Source
var ErrNilLineStringMS = errors.New("geom: nil LineStringMS")

ErrNilLineStringMS is thrown when a LineStringS is nil but shouldn't be

View Source
var ErrNilLineStringS = errors.New("geom: nil LineStringS")

ErrNilLineStringS is thrown when a LineStringS is nil but shouldn't be

View Source
var ErrNilLineStringZ = errors.New("geom: nil LineStringZ")

ErrNilLineStringZ is thrown when a LineStringZ is nil but shouldn't be

View Source
var ErrNilLineStringZM = errors.New("geom: nil LineStringZM")

ErrNilLineStringZM is thrown when a LineStringZM is nil but shouldn't be

View Source
var ErrNilLineStringZMS = errors.New("geom: nil LineStringZMS")

ErrNilLineStringZMS is thrown when a LineStringZMS is nil but shouldn't be

View Source
var ErrNilLineStringZS = errors.New("geom: nil LineStringZS")

ErrNilLineStringZS is thrown when a LineStringS is nil but shouldn't be

View Source
var ErrNilMultiLineString = errors.New("geom: nil MultiLineString")

ErrNilMultiLineString is thrown when MultiLineString is nil but shouldn't be

View Source
var ErrNilMultiLineStringM = errors.New("geom: nil MultiLineStringM")

ErrNilMultiLineStringM is thrown when MultiLineStringM is nil but shouldn't be

View Source
var ErrNilMultiLineStringMS = errors.New("geom: nil MultiLineStringMS")

ErrNilMultiLineStringMS is thrown when MultiLineStringMS is nil but shouldn't be

View Source
var ErrNilMultiLineStringS = errors.New("geom: nil MultiLineStringS")

ErrNilMultiLineStringS is thrown when MultiLineStringS is nil but shouldn't be

View Source
var ErrNilMultiLineStringZ = errors.New("geom: nil MultiLineStringZ")

ErrNilMultiLineStringZ is thrown when MultiLineStringZ is nil but shouldn't be

View Source
var ErrNilMultiLineStringZM = errors.New("geom: nil MultiLineStringZM")

ErrNilMultiLineStringZM is thrown when MultiLineStringZM is nil but shouldn't be

View Source
var ErrNilMultiLineStringZMS = errors.New("geom: nil MultiLineStringZMS")

ErrNilMultiLineStringZMS is thrown when MultiLineStringZMS is nil but shouldn't be

View Source
var ErrNilMultiLineStringZS = errors.New("geom: nil MultiLineStringZS")

ErrNilMultiLineStringZS is thrown when MultiLineStringZS is nil but shouldn't be

View Source
var ErrNilMultiPoint = errors.New("geom: nil MultiPoint")

ErrNilMultiPoint is thrown when a MultiPoint is nil but shouldn't be

View Source
var ErrNilMultiPointM = errors.New("geom: nil MultiPointM")

ErrNilMultiPointM is thrown when a MultiPointM is nil but shouldn't be

View Source
var ErrNilMultiPointMS = errors.New("geom: nil MultiPointMS")

ErrNilMultiPointMS is thrown when a MultiPointMS is nil but shouldn't be

View Source
var ErrNilMultiPointS = errors.New("geom: nil MultiPointS")

ErrNilMultiPointS is thrown when a MultiPointS is nil but shouldn't be

View Source
var ErrNilMultiPointZ = errors.New("geom: nil MultiPointZ")

ErrNilMultiPointZ is thrown when a MultiPointZ is nil but shouldn't be

View Source
var ErrNilMultiPointZM = errors.New("geom: nil MultiPointZM")

ErrNilMultiPointZM is thrown when a MultiPointZM is nil but shouldn't be

View Source
var ErrNilMultiPointZMS = errors.New("geom: nil MultiPointZMS")

ErrNilMultiPointZMS is thrown when a MultiPointZMS is nil but shouldn't be

View Source
var ErrNilMultiPointZS = errors.New("geom: nil MultiPointZS")

ErrNilMultiPointZS is thrown when a MultiPointZS is nil but shouldn't be

View Source
var ErrNilMultiPolygon = errors.New("geom: nil MultiPolygon")

ErrNilMultiPolygon is thrown when a MultiPolygon is nul but shouldn't be

View Source
var ErrNilPoint = errors.New("geom: nil Point")

ErrNilPoint is thrown when a point is null but shouldn't be

View Source
var ErrNilPointM = errors.New("geom: nil PointM")

ErrNilPointM is thrown when a point is null but shouldn't be

View Source
var ErrNilPointMS = errors.New("geom: nil PointMS")

ErrNilPointMS is thrown when a point is null but shouldn't be

View Source
var ErrNilPointS = errors.New("geom: nil PointS")

ErrNilPointS is thrown when a point is null but shouldn't be

View Source
var ErrNilPointZ = errors.New("geom: nil PointZ")

ErrNilPointZ is thrown when a point is null but shouldn't be

View Source
var ErrNilPointZM = errors.New("geom: nil PointZM")

ErrNilPointZM is thrown when a point is null but shouldn't be

View Source
var ErrNilPointZMS = errors.New("geom: nil PointZMS")

ErrNilPointZMS is thrown when a point is null but shouldn't be

View Source
var ErrNilPointZS = errors.New("geom: nil PointZS")

ErrNilPointZS is thrown when a point is null but shouldn't be

View Source
var ErrNilPolygon = errors.New("geom: nil Polygon")

ErrNilPolygon is thrown when a polygon is nil but shouldn't be

View Source
var ErrNilPolygonM = errors.New("geom: nil PolygonM")

ErrNilPolygonM is thrown when a polygonz is nil but shouldn't be

View Source
var ErrNilPolygonMS = errors.New("geom: nil PolygonMS")

ErrNilPolygonMS is thrown when a polygonz is nil but shouldn't be

View Source
var ErrNilPolygonS = errors.New("geom: nil PolygonS")

ErrNilPolygonS is thrown when a polygonz is nil but shouldn't be

View Source
var ErrNilPolygonZ = errors.New("geom: nil PolygonZ")

ErrNilPolygonZ is thrown when a polygonz is nil but shouldn't be

View Source
var ErrNilPolygonZM = errors.New("geom: nil PolygonZM")

ErrNilPolygonZM is thrown when a polygonz is nil but shouldn't be

View Source
var ErrNilPolygonZMS = errors.New("geom: nil PolygonZMS")

ErrNilPolygonZMS is thrown when a polygonz is nil but shouldn't be

View Source
var ErrNilPolygonZS = errors.New("geom: nil PolygonZS")

ErrNilPolygonZS is thrown when a polygonz is nil but shouldn't be

View Source
var ErrPointsAreCoLinear = errors.New("given points are colinear")

ErrPointsAreCoLinear is thrown when points are colinear but that is unexpected

Functions

func IsColinear

func IsColinear(a, b, c [2]float64) bool

IsColinear returns weather the a,b,c are colinear to each other

func IsNil

func IsNil(a interface{}) bool

IsNil is a helper function to check it the given interface is nil, or the value store in it is nil

func RoundToPrec

func RoundToPrec(v float64, prec int) float64

RoundToPrec will round the given value to the precision value. The precision value should be a power of 10.

Types

type Circle

type Circle struct {
	Center [2]float64
	Radius float64
}

Circle is a point (float tuple) and a radius

func CircleFromPoints

func CircleFromPoints(a, b, c [2]float64) (Circle, error)

CircleFromPoints returns the circle from by the given points, or an error if the points are colinear. REF: Formula used gotten from http://mathforum.org/library/drmath/view/55233.html

func (Circle) AsLineString

func (c Circle) AsLineString(k uint) LineString

func (Circle) AsPoints

func (c Circle) AsPoints(k uint) []Point

func (Circle) AsSegments

func (c Circle) AsSegments(k uint) []Line

AsSegments takes the number of segments that should be returned to describe the circle. a value less then 3 will use the default value of 30.

func (Circle) ContainsPoint

func (c Circle) ContainsPoint(pt [2]float64) bool

ContainsPoint will check to see if the point is in the circle.

type ClockwiseFunc

type ClockwiseFunc func(...[2]float64) bool

ClockwiseFunc returns weather the set of points should be considered clockwise or counterclockwise. The last point is not the same as the first point, and the function should connect these points as needed.

type Collection

type Collection []Geometry

Collection is a collection of one or more geometries.

func (Collection) Geometries

func (c Collection) Geometries() []Geometry

Geometries returns the slice of Geometries

func (*Collection) SetGeometries

func (c *Collection) SetGeometries(input []Geometry) (err error)

SetGeometries modifies the array of 2D coordinates

type CollectionSetter

type CollectionSetter interface {
	Collectioner
	SetGeometries([]Geometry) error
}

CollectionSetter is a mutable Collectioner.

type Collectioner

type Collectioner interface {
	Geometry
	Geometries() []Geometry
}

Collectioner is a collections of different geometries.

type ErrUnknownGeometry

type ErrUnknownGeometry struct {
	Geom Geometry
}

ErrUnknownGeometry represents an objects that is not a known geom geometry.

func (ErrUnknownGeometry) Error

func (e ErrUnknownGeometry) Error() string

type Extent

type Extent [4]float64

Extent represents the minx, miny, maxx and maxy A nil extent represents the whole universe.

func NewExtent

func NewExtent(points ...[2]float64) *Extent

NewExtent returns an Extent for the provided points; in following format [4]float64{ MinX, MinY, MaxX, MaxY }

func NewExtentFromGeometry

func NewExtentFromGeometry(g Geometry) (*Extent, error)

NewExtentFromGeometry tries to create an extent based on the geometry

func NewExtentFromPoints

func NewExtentFromPoints(points ...Point) *Extent

NewExtentFromPoints returns an Extent for the provided points; in following format [4]float64{ MinX, MinY, MaxX, MaxY }

func (*Extent) Add

func (e *Extent) Add(extent MinMaxer)

Add will expand the extent to contain the given extent.

func (*Extent) AddGeometry

func (e *Extent) AddGeometry(g Geometry) error

AddGeometry expands the specified envelop to contain g.

func (*Extent) AddPointers

func (e *Extent) AddPointers(pts ...Pointer)

AddPointers will expand the Extent if a point is outside it

func (*Extent) AddPoints

func (e *Extent) AddPoints(points ...[2]float64)

AddPoints will expand the extent to contain the given points.

func (*Extent) Area

func (e *Extent) Area() float64

Area returns the area of the extent, if the extent is nil, it will return 0

func (*Extent) AsPolygon

func (e *Extent) AsPolygon() Polygon

AsPolygon will return the extent as a Polygon

func (*Extent) Clone

func (e *Extent) Clone() *Extent

Clone returns a new Extent with contents copied.

func (*Extent) Contains

func (e *Extent) Contains(ne MinMaxer) bool

Contains will return whether the given extent is inside of the extent.

func (*Extent) ContainsGeom

func (e *Extent) ContainsGeom(g Geometry) (bool, error)

ContainsGeom will return weather the given geometry is completely inside of the extent.

func (*Extent) ContainsLine

func (e *Extent) ContainsLine(l [2][2]float64) bool

ContainsLine will return weather the given line completely inside of the extent.

func (*Extent) ContainsPoint

func (e *Extent) ContainsPoint(pt [2]float64) bool

ContainsPoint will return whether the given point is inside of the extent.

func (*Extent) Edges

func (e *Extent) Edges(cwfn ClockwiseFunc) [][2][2]float64

Edges returns the clockwise order of the edges that make up the extent.

func (*Extent) ExpandBy

func (e *Extent) ExpandBy(s float64) *Extent

ExpandBy will expand extent by the given factor.

func (*Extent) Extent

func (e *Extent) Extent() [4]float64

Extent returns back the min and max of the Extent

func (*Extent) Intersect

func (e *Extent) Intersect(ne *Extent) (*Extent, bool)

Intersect will return a new extent that is the intersect of the two extents.

+-------------------------+
|                         |
|       A      +----------+------+
|              |//////////|      |
|              |/// C ////|      |
|              |//////////|      |
+--------------+----------+      |
               |             B   |
               +-----------------+

For example the for the above Box A intersects Box B at the area surround by C.

If the Boxes don't intersect does will be false, otherwise ibb will be the intersect.

func (*Extent) IsUniverse

func (e *Extent) IsUniverse() bool

IsUniverse returns weather the extent contains the universe. This is true if the clip box is nil or the x,y values are max values.

func (*Extent) Max

func (e *Extent) Max() [2]float64

Max returns the (MaxX, MaxY) values

func (*Extent) MaxX

func (e *Extent) MaxX() float64

MaxX is the larger of the x values.

func (*Extent) MaxY

func (e *Extent) MaxY() float64

MaxY is the larger of the y values.

func (*Extent) Min

func (e *Extent) Min() [2]float64

Min returns the (MinX, MinY) values

func (*Extent) MinX

func (e *Extent) MinX() float64

MinX is the smaller of the x values.

func (*Extent) MinY

func (e *Extent) MinY() float64

MinY is the smaller of the y values.

func (*Extent) ScaleBy

func (e *Extent) ScaleBy(s float64) *Extent

ScaleBy will scale the points in the extent by the given scale factor.

func (*Extent) Vertices

func (e *Extent) Vertices() [][2]float64

Vertices return the vertices of the Bounding Box. The vertices are ordered in the following maner. (minx,miny), (maxx,miny), (maxx,maxy), (minx,maxy)

func (*Extent) XSpan

func (e *Extent) XSpan() float64

XSpan is the distance of the Extent in X or inf TODO (gdey): look at how to have this function take into account the dpi.

func (*Extent) YSpan

func (e *Extent) YSpan() float64

YSpan is the distance of the Extent in Y or Inf

type Extenter

type Extenter interface {
	Extent() (extent [4]float64)
}

Extenter represents an interface that returns a boundbox.

type Geometry

type Geometry interface{}

Geometry is an object with a spatial reference. if a method accepts a Geometry type it's only expected to support the geom types in this package

func ApplyToPoints

func ApplyToPoints(geometry Geometry, f func(coords ...float64) ([]float64, error)) (Geometry, error)

ApplyToPoints applys the given function to each point in the geometry and any sub geometries, return a new transformed geometry.

func Clone

func Clone(geometry Geometry) (Geometry, error)

Clone returns a deep clone of the Geometry.

type Line

type Line [2][2]float64

Line has exactly two points - we define here also the extended Z, M and ZM versions which refer respectively to PointZ, PointM and PointZM geometries

func ExtractLines

func ExtractLines(g Geometry) (lines []Line, err error)

ExtractLines extracts all linear components from a geometry (line segements). If the geometry contains no line segements (e.g. empty geometry or point), then an empty array will be returned.

Duplicate lines will not be removed.

func (Line) ContainsPoint

func (l Line) ContainsPoint(pt [2]float64) bool

ContainsPoint checks to see if the given pont lines on the linesegment. (Incliding the end points.)

func (Line) ContainsPointBigFloat

func (l Line) ContainsPointBigFloat(pt [2]*big.Float) bool

ContainsPointBigFloat checks to see if the given point lies on the line segment. (Including the endpoints.)

func (Line) IsHorizontal

func (l Line) IsHorizontal() bool

IsHorizontal returns true if the `x` elements of the points that make the line (l) are equal.

func (Line) IsVertical

func (l Line) IsVertical() bool

IsVertical returns true if the `y` elements of the points that make up the line (l) are equal.

func (Line) LengthSquared

func (l Line) LengthSquared() float64

LengthSqured returns the length of the segment squared

func (Line) Point1

func (l Line) Point1() *Point

Point1 returns a new copy of the first point in the line.

func (Line) Point2

func (l Line) Point2() *Point

Point2 returns a new copy of the second point in the line.

func (Line) Vertices

func (l Line) Vertices() [][2]float64

type LineM

type LineM [2][3]float64

func (LineM) PointM1

func (lm LineM) PointM1() *PointM

func (LineM) PointM2

func (lm LineM) PointM2() *PointM

type LineString

type LineString [][2]float64

LineString is a basic line type which is made up of two or more points that don't interacted.

func (LineString) AsSegments

func (ls LineString) AsSegments() (segs []Line, err error)

AsSegments returns the line string as a slice of lines.

func (LineString) IsRing

func (ls LineString) IsRing() bool

IsRing returns true if the first and last vertices are the same

func (*LineString) SetVertices

func (ls *LineString) SetVertices(input [][2]float64) (err error)

SetVertices modifies the array of 2D coordinates

func (LineString) Vertices

func (ls LineString) Vertices() [][2]float64

Vertices returns a slice of XY values

type LineStringM

type LineStringM [][3]float64

LineString is a basic line type which is made up of two or more points that don't interacted.

func (LineStringM) LineString

func (lsm LineStringM) LineString() LineString

Get the simple 2D linestring

func (*LineStringM) SetVertices

func (lsm *LineStringM) SetVertices(input [][3]float64) (err error)

SetVertices modifies the array of 2D+1 coordinates

func (LineStringM) Vertices

func (lsm LineStringM) Vertices() [][3]float64

Vertices returns a slice of XYM values

type LineStringMS

type LineStringMS struct {
	Srid uint32
	Lsm  LineStringM
}

LineStringMS is a basic line type which is made up of two or more points that don't interacted.

func (LineStringMS) LineStringM

func (lsms LineStringMS) LineStringM() LineStringM

Get the simple 2D + 1 linestring

func (*LineStringMS) SetSRID

func (lsms *LineStringMS) SetSRID(srid uint32, lsm LineStringM) (err error)

SetVertices modifies the struct containing the SRID int and the array of 2D + 1 coordinates

func (LineStringMS) Vertices

func (lsms LineStringMS) Vertices() struct {
	Srid uint32
	Lsm  LineStringM
}

Vertices returns a slice of referenced XYM values

type LineStringMSSetter

type LineStringMSSetter interface {
	LineStringMSer
	SetSRID(srid uint32, lsm LineStringM) error
}

LineStringMSSetter is a mutable LineStringMSer.

type LineStringMSer

type LineStringMSer interface {
	Geometry
	Vertices() struct {
		Srid uint32
		Lsm  LineStringM
	}
}

LineStringMSer is a line of two or more M points + SRID.

type LineStringMSetter

type LineStringMSetter interface {
	LineStringMer
	SetVertices([][3]float64) error
}

LineStringMSetter is a mutable LineStringMer.

type LineStringMer

type LineStringMer interface {
	Geometry
	Vertices() [][3]float64
}

LineStringMer is a line of two or more M points.

type LineStringS

type LineStringS struct {
	Srid uint32
	Ls   LineString
}

LineString is a basic line type which is made up of two or more points that don't interacted.

func (LineStringS) LineString

func (lss LineStringS) LineString() LineString

Get the simple 2D linestring

func (*LineStringS) SetSRID

func (lss *LineStringS) SetSRID(srid uint32, ls LineString) (err error)

SetVertices modifies the struct containing the SRID int and the array of 2D coordinates

func (LineStringS) Vertices

func (lss LineStringS) Vertices() struct {
	Srid uint32
	Ls   LineString
}

Vertices returns a slice of referenced XY values

type LineStringSSetter

type LineStringSSetter interface {
	LineStringSer
	SetSRID(srid uint32, ls LineString) error
}

LineStringSSetter is a mutable LineStringSer.

type LineStringSer

type LineStringSer interface {
	Geometry
	Vertices() struct {
		Srid uint32
		Ls   LineString
	}
}

LineStringSer is a line of two or more points + SRID.

type LineStringSetter

type LineStringSetter interface {
	LineStringer
	SetVertices([][2]float64) error
}

LineStringSetter is a mutable LineStringer.

type LineStringZ

type LineStringZ [][3]float64

LineString is a basic line type which is made up of two or more points that don't interacted.

func (LineStringZ) LineString

func (lsz LineStringZ) LineString() LineString

Get the simple 2D linestring

func (*LineStringZ) SetVertices

func (lsz *LineStringZ) SetVertices(input [][3]float64) (err error)

SetVertices modifies the array of 3D coordinates

func (LineStringZ) Vertices

func (lsz LineStringZ) Vertices() [][3]float64

Vertices returns a slice of XYM values

type LineStringZM

type LineStringZM [][4]float64

LineString is a basic line type which is made up of two or more points that don't interacted.

func (LineStringZM) LineString

func (lszm LineStringZM) LineString() LineString

Get the simple 2D linestring

func (*LineStringZM) SetVertices

func (lszm *LineStringZM) SetVertices(input [][4]float64) (err error)

SetVertices modifies the array of 3D + 1 coordinates

func (LineStringZM) Vertices

func (lszm LineStringZM) Vertices() [][4]float64

Vertices returns a slice of XYM values

type LineStringZMS

type LineStringZMS struct {
	Srid uint32
	Lszm LineStringZM
}

LineStringZMS is a basic line type which is made up of two or more points that don't interacted.

func (LineStringZMS) LineStringZM

func (lszms LineStringZMS) LineStringZM() LineStringZM

Get the simple 3D + 1 linestring

func (*LineStringZMS) SetSRID

func (lszms *LineStringZMS) SetSRID(srid uint32, lszm LineStringZM) (err error)

SetVertices modifies the struct containing the SRID int and the array of 3D + 1 coordinates

func (LineStringZMS) Vertices

func (lszms LineStringZMS) Vertices() struct {
	Srid uint32
	Lszm LineStringZM
}

Vertices returns a slice of referenced XYZM values

type LineStringZMSSetter

type LineStringZMSSetter interface {
	LineStringZMSer
	SetSRID(srid uint32, lszm LineStringZM) error
}

LineStringZMSSetter is a mutable LineStringZMSer.

type LineStringZMSer

type LineStringZMSer interface {
	Geometry
	Vertices() struct {
		Srid uint32
		Lszm LineStringZM
	}
}

LineStringZMSer is a line of two or more ZM points + SRID.

type LineStringZMSetter

type LineStringZMSetter interface {
	LineStringZMer
	SetVertices([][4]float64) error
}

LineStringZMSetter is a mutable LineStringZMer.

type LineStringZMer

type LineStringZMer interface {
	Geometry
	Vertices() [][4]float64
}

LineStringZMer is a line of two or more ZM points.

type LineStringZS

type LineStringZS struct {
	Srid uint32
	Lsz  LineStringZ
}

LineStringZS is a basic line type which is made up of two or more points that don't interacted.

func (LineStringZS) LineStringZ

func (lszs LineStringZS) LineStringZ() LineStringZ

Get the simple 3D linestring

func (*LineStringZS) SetSRID

func (lszs *LineStringZS) SetSRID(srid uint32, lsz LineStringZ) (err error)

SetVertices modifies the struct containing the SRID int and the array of 3D coordinates

func (LineStringZS) Vertices

func (lszs LineStringZS) Vertices() struct {
	Srid uint32
	Lsz  LineStringZ
}

Vertices returns a slice of referenced XYM values

type LineStringZSSetter

type LineStringZSSetter interface {
	LineStringZSer
	SetSRID(srid uint32, lsz LineStringZ) error
}

LineStringZSSetter is a mutable LineStringZSer.

type LineStringZSer

type LineStringZSer interface {
	Geometry
	Vertices() struct {
		Srid uint32
		Lsz  LineStringZ
	}
}

LineStringZSer is a line of two or more Z points + SRID.

type LineStringZSetter

type LineStringZSetter interface {
	LineStringZer
	SetVertices([][3]float64) error
}

LineStringZSetter is a mutable LineStringZer.

type LineStringZer

type LineStringZer interface {
	Geometry
	Vertices() [][3]float64
}

LineStringZer is a line of two or more Z points.

type LineStringer

type LineStringer interface {
	Geometry
	Vertices() [][2]float64
}

LineStringer is a line of two or more points.

type LineZ

type LineZ [2][3]float64

func (LineZ) PointZ1

func (lz LineZ) PointZ1() *PointZ

for the extended geometries, just extract the related pair of points - the user will then use the XY coordinates to eventually build the Line object if needed and use the related methods

func (LineZ) PointZ2

func (lz LineZ) PointZ2() *PointZ

type LineZM

type LineZM [2][4]float64

func (LineZM) PointZM1

func (lzm LineZM) PointZM1() *PointZM

func (LineZM) PointZM2

func (lzm LineZM) PointZM2() *PointZM

type MinMaxer

type MinMaxer interface {
	MinX() float64
	MinY() float64
	MaxX() float64
	MaxY() float64
}

MinMaxer is a wrapper for an Extent that gets min/max of the extent

type MultiLineString

type MultiLineString [][][2]float64

MultiLineString is a geometry with multiple LineStrings.

func (MultiLineString) AsSegments

func (mls MultiLineString) AsSegments() (segs [][]Line, err error)

AsSegments returns the multi lines string as a set of lines.

func (MultiLineString) LineStrings

func (mls MultiLineString) LineStrings() [][][2]float64

LineStrings returns the coordinates for the linestrings

func (*MultiLineString) SetLineStrings

func (mls *MultiLineString) SetLineStrings(input [][][2]float64) (err error)

SetLineStrings modifies the array of 2D coordinates

type MultiLineStringM

type MultiLineStringM [][][3]float64

MultiLineStringM is a geometry with multiple LineStringMs.

func (MultiLineStringM) AsLineStringMs

func (mlsm MultiLineStringM) AsLineStringMs() (segs []LineStringM, err error)

AsSegments returns the multi lines string as a set of lineMs.

func (MultiLineStringM) LineStringMs

func (mlsm MultiLineStringM) LineStringMs() [][][3]float64

LineStringMs returns the coordinates for the linestrings

func (*MultiLineStringM) SetLineStringMs

func (mlsm *MultiLineStringM) SetLineStringMs(input [][][3]float64) (err error)

SetLineStringZs modifies the array of 2D+1D coordinates

type MultiLineStringMS

type MultiLineStringMS struct {
	Srid uint32
	Mlsm MultiLineStringM
}

MultiLineStringMS is a geometry with multiple LineStringSs.

func (MultiLineStringMS) MultiLineStringM

func (mlsms MultiLineStringMS) MultiLineStringM() MultiLineStringM

Get the simple 2D+1 multiline string

func (MultiLineStringMS) MultiLineStringMs

func (mlsms MultiLineStringMS) MultiLineStringMs() struct {
	Srid uint32
	Mlsm MultiLineStringM
}

LineStrings returns the coordinates for the linestrings

func (*MultiLineStringMS) SetSRID

func (mlsms *MultiLineStringMS) SetSRID(srid uint32, mlsm MultiLineStringM) (err error)

SetSRID modifies the struct containing the SRID int and the array of 2D+1 coordinates

type MultiLineStringMSSetter

type MultiLineStringMSSetter interface {
	MultiLineStringMSer
	SetSRID(srid uint32, mlsm MultiLineStringM) error
}

MultiLineStringMSSetter is a mutable MultiLineMSStringer.

type MultiLineStringMSer

type MultiLineStringMSer interface {
	Geometry
	MultiLineStringMs() struct {
		Srid uint32
		Mlsm MultiLineStringM
	}
}

MultiLineMSStringer is a geometry with multiple LineMSStrings.

type MultiLineStringMSetter

type MultiLineStringMSetter interface {
	MultiLineStringMer
	SetLineStringMs([][][3]float64) error
}

MultiLineStringMSetter is a mutable MultiLineStringMer.

type MultiLineStringMer

type MultiLineStringMer interface {
	Geometry
	LineStringMs() [][][3]float64
}

MultiLineMStringer is a geometry with multiple LineMStrings.

type MultiLineStringS

type MultiLineStringS struct {
	Srid uint32
	Mls  MultiLineString
}

MultiLineStringS is a geometry with multiple LineStringSs.

func (MultiLineStringS) MultiLineString

func (mlss MultiLineStringS) MultiLineString() MultiLineString

Get the simple 2D multiline string

func (MultiLineStringS) MultiLineStrings

func (mlss MultiLineStringS) MultiLineStrings() struct {
	Srid uint32
	Mls  MultiLineString
}

LineStrings returns the coordinates for the linestrings

func (*MultiLineStringS) SetSRID

func (mlss *MultiLineStringS) SetSRID(srid uint32, mls MultiLineString) (err error)

SetSRID modifies the struct containing the SRID int and the array of 2D coordinates

type MultiLineStringSSetter

type MultiLineStringSSetter interface {
	MultiLineStringSer
	SetSRID(srid uint32, mls MultiLineString) error
}

MultiLineStringSSetter is a mutable MultiLineSStringer.

type MultiLineStringSer

type MultiLineStringSer interface {
	Geometry
	MultiLineStrings() struct {
		Srid uint32
		Mls  MultiLineString
	}
}

MultiLineSStringer is a geometry with multiple LineSStrings.

type MultiLineStringSetter

type MultiLineStringSetter interface {
	MultiLineStringer
	SetLineStrings([][][2]float64) error
}

MultiLineStringSetter is a mutable MultiLineStringer.

type MultiLineStringZ

type MultiLineStringZ [][][3]float64

MultiLineStringZ is a geometry with multiple LineStringZs.

func (MultiLineStringZ) AsLineStringZs

func (mlsz MultiLineStringZ) AsLineStringZs() (segs []LineStringZ, err error)

AsSegments returns the multi lines string as a set of lineZs.

func (MultiLineStringZ) LineStringZs

func (mlsz MultiLineStringZ) LineStringZs() [][][3]float64

LineStringZs returns the coordinates for the linestrings

func (*MultiLineStringZ) SetLineStringZs

func (mlsz *MultiLineStringZ) SetLineStringZs(input [][][3]float64) (err error)

SetLineStringZs modifies the array of 3D coordinates

type MultiLineStringZM

type MultiLineStringZM [][][4]float64

MultiLineStringZM is a geometry with multiple LineStringZMs.

func (MultiLineStringZM) AsLineStringZMs

func (mlszm MultiLineStringZM) AsLineStringZMs() (segs []LineStringZM, err error)

AsSegments returns the multi lines string as a set of lineZMs.

func (MultiLineStringZM) LineStringZMs

func (mlszm MultiLineStringZM) LineStringZMs() [][][4]float64

LineStringZMs returns the coordinates for the linestrings

func (*MultiLineStringZM) SetLineStringZMs

func (mlszm *MultiLineStringZM) SetLineStringZMs(input [][][4]float64) (err error)

SetLineStringZMs modifies the array of 3D+1D coordinates

type MultiLineStringZMS

type MultiLineStringZMS struct {
	Srid  uint32
	Mlszm MultiLineStringZM
}

MultiLineStringZMS is a geometry with multiple LineStringSs.

func (MultiLineStringZMS) MultiLineStringZM

func (mlszms MultiLineStringZMS) MultiLineStringZM() MultiLineStringZM

Get the simple 3D+1 multiline string

func (MultiLineStringZMS) MultiLineStringZMs

func (mlszms MultiLineStringZMS) MultiLineStringZMs() struct {
	Srid  uint32
	Mlszm MultiLineStringZM
}

LineStrings returns the coordinates for the linestrings

func (*MultiLineStringZMS) SetSRID

func (mlszms *MultiLineStringZMS) SetSRID(srid uint32, mlszm MultiLineStringZM) (err error)

SetSRID modifies the struct containing the SRID int and the array of 3D+1 coordinates

type MultiLineStringZMSSetter

type MultiLineStringZMSSetter interface {
	MultiLineStringZMSer
	SetSRID(srid uint32, mlszm MultiLineStringZM) error
}

MultiLineStringZMSSetter is a mutable MultiLineZMSStringer.

type MultiLineStringZMSer

type MultiLineStringZMSer interface {
	Geometry
	MultiLineStringZMs() struct {
		Srid  uint32
		Mlszm MultiLineStringZM
	}
}

MultiLineZMSStringer is a geometry with multiple LineZMSStrings.

type MultiLineStringZMSetter

type MultiLineStringZMSetter interface {
	MultiLineStringZMer
	SetLineStringZMs([][][4]float64) error
}

MultiLineStringZMSetter is a mutable MultiLineZMStringer.

type MultiLineStringZMer

type MultiLineStringZMer interface {
	Geometry
	LineStringZMs() [][][4]float64
}

MultiLineZMStringer is a geometry with multiple LineZMStrings.

type MultiLineStringZS

type MultiLineStringZS struct {
	Srid uint32
	Mlsz MultiLineStringZ
}

MultiLineStringZS is a geometry with multiple LineStringSs.

func (MultiLineStringZS) MultiLineStringZ

func (mlszs MultiLineStringZS) MultiLineStringZ() MultiLineStringZ

Get the simple 3D multiline string

func (MultiLineStringZS) MultiLineStringZs

func (mlszs MultiLineStringZS) MultiLineStringZs() struct {
	Srid uint32
	Mlsz MultiLineStringZ
}

LineStrings returns the coordinates for the linestrings

func (*MultiLineStringZS) SetSRID

func (mlszs *MultiLineStringZS) SetSRID(srid uint32, mlsz MultiLineStringZ) (err error)

SetSRID modifies the struct containing the SRID int and the array of 3D coordinates

type MultiLineStringZSSetter

type MultiLineStringZSSetter interface {
	MultiLineStringZSer
	SetSRID(srid uint32, mlsz MultiLineStringZ) error
}

MultiLineStringZSSetter is a mutable MultiLineZSStringer.

type MultiLineStringZSer

type MultiLineStringZSer interface {
	Geometry
	MultiLineStringZs() struct {
		Srid uint32
		Mlsz MultiLineStringZ
	}
}

MultiLineZSStringer is a geometry with multiple LineZSStrings.

type MultiLineStringZSetter

type MultiLineStringZSetter interface {
	MultiLineStringZer
	SetLineStringZs([][][3]float64) error
}

MultiLineStringZSetter is a mutable MultiLineStringZer.

type MultiLineStringZer

type MultiLineStringZer interface {
	Geometry
	LineStringZs() [][][3]float64
}

MultiLineZStringer is a geometry with multiple LineZStrings.

type MultiLineStringer

type MultiLineStringer interface {
	Geometry
	LineStrings() [][][2]float64
}

MultiLineStringer is a geometry with multiple LineStrings.

type MultiPoint

type MultiPoint [][2]float64

MultiPoint is a geometry with multiple points.

func (MultiPoint) Points

func (mp MultiPoint) Points() [][2]float64

Points returns the coordinates for the points

func (*MultiPoint) SetPoints

func (mp *MultiPoint) SetPoints(input [][2]float64) (err error)

SetPoints modifies the array of 2D coordinates

type MultiPointM

type MultiPointM [][3]float64

MultiPointM is a geometry with multiple 2+1D points.

func (MultiPointM) MultiPoint

func (mpm MultiPointM) MultiPoint() MultiPoint

Get the simple 2D multipoint

func (MultiPointM) Points

func (mpm MultiPointM) Points() [][3]float64

Points returns the coordinates for the 2+1D points

func (*MultiPointM) SetPoints

func (mpm *MultiPointM) SetPoints(input [][3]float64) (err error)

SetPoints modifies the array of 2+1D coordinates

type MultiPointMS

type MultiPointMS struct {
	Srid uint32
	Mpm  MultiPointM
}

MultiPointMS is a geometry with multiple, referenced 2+1D points.

func (MultiPointMS) MultiPointM

func (mpms MultiPointMS) MultiPointM() MultiPointM

Get the simple 3D multipoint

func (MultiPointMS) Points

func (mpms MultiPointMS) Points() struct {
	Srid uint32
	Mpm  MultiPointM
}

Points returns the coordinates for the 3D points

func (*MultiPointMS) SetSRID

func (mpms *MultiPointMS) SetSRID(srid uint32, mpm MultiPointM) (err error)

SetSRID modifies the struct containing the SRID int and the array of 3D coordinates

type MultiPointMSSetter

type MultiPointMSSetter interface {
	MultiPointMSer
	SetSRID(srid uint32, mpz MultiPointM) error
}

MultiPointMSSetter is a mutable MultiPointMSer.

type MultiPointMSer

type MultiPointMSer interface {
	Geometry
	Points() struct {
		Srid uint32
		Mpm  MultiPointM
	}
}

MultiPointMSer is a MultiPointM + SRID.

type MultiPointMSetter

type MultiPointMSetter interface {
	MultiPointMer
	SetPoints([][3]float64) error
}

MultiPointMSetter is a mutable MultiPointer.

type MultiPointMer

type MultiPointMer interface {
	Geometry
	Points() [][3]float64
}

MultiPointMer is a geometry with multiple 2+1D points.

type MultiPointS

type MultiPointS struct {
	Srid uint32
	Mp   MultiPoint
}

MultiPointS is a geometry with multiple, referenced 2D points.

func (MultiPointS) MultiPoint

func (mps MultiPointS) MultiPoint() MultiPoint

Get the simple 2D multipoint

func (MultiPointS) Points

func (mps MultiPointS) Points() struct {
	Srid uint32
	Mp   MultiPoint
}

Points returns the coordinates for the 2D points

func (*MultiPointS) SetSRID

func (mps *MultiPointS) SetSRID(srid uint32, mp MultiPoint) (err error)

SetSRID modifies the struct containing the SRID int and the array of 2D coordinates

type MultiPointSSetter

type MultiPointSSetter interface {
	MultiPointSer
	SetSRID(srid uint32, mp MultiPoint) error
}

MultiPointSSetter is a mutable MultiPointSer.

type MultiPointSer

type MultiPointSer interface {
	Geometry
	Points() struct {
		Srid uint32
		Mp   MultiPoint
	}
}

MultiPointSer is a MultiPoint + SRID.

type MultiPointSetter

type MultiPointSetter interface {
	MultiPointer
	SetPoints([][2]float64) error
}

MultiPointSetter is a mutable MultiPointer.

type MultiPointZ

type MultiPointZ [][3]float64

MultiPointZ is a geometry with multiple 3D points.

func (MultiPointZ) MultiPoint

func (mpz MultiPointZ) MultiPoint() MultiPoint

Get the simple 2D multipoint

func (MultiPointZ) Points

func (mpz MultiPointZ) Points() [][3]float64

Points returns the coordinates for the 3D points

func (*MultiPointZ) SetPoints

func (mpz *MultiPointZ) SetPoints(input [][3]float64) (err error)

SetPoints modifies the array of 3D coordinates

type MultiPointZM

type MultiPointZM [][4]float64

MultiPointZM is a geometry with multiple 3+1D points.

func (MultiPointZM) MultiPoint

func (mpzm MultiPointZM) MultiPoint() MultiPoint

Get the simple 2D multipoint

func (MultiPointZM) Points

func (mpzm MultiPointZM) Points() [][4]float64

Points returns the coordinates for the 3+1D points

func (*MultiPointZM) SetPoints

func (mpzm *MultiPointZM) SetPoints(input [][4]float64) (err error)

SetPoints modifies the array of 3+1D coordinates

type MultiPointZMS

type MultiPointZMS struct {
	Srid uint32
	Mpzm MultiPointZM
}

MultiPointZMS is a geometry with multiple, referenced 3+1D points.

func (MultiPointZMS) MultiPointZM

func (mpzms MultiPointZMS) MultiPointZM() MultiPointZM

Get the simple 3D multipoint

func (MultiPointZMS) Points

func (mpzms MultiPointZMS) Points() struct {
	Srid uint32
	Mpzm MultiPointZM
}

Points returns the coordinates for the 3+1D points

func (*MultiPointZMS) SetSRID

func (mpzms *MultiPointZMS) SetSRID(srid uint32, mpzm MultiPointZM) (err error)

SetSRID modifies the struct containing the SRID int and the array of 3+1D coordinates

type MultiPointZMSSetter

type MultiPointZMSSetter interface {
	MultiPointZMSer
	SetSRID(srid uint32, mpzm MultiPointZM) error
}

MultiPointZMSSetter is a mutable MultiPointZMSer.

type MultiPointZMSer

type MultiPointZMSer interface {
	Geometry
	Points() struct {
		Srid uint32
		Mpzm MultiPointZM
	}
}

MultiPointZMSer is a MultiPointZM + SRID.

type MultiPointZMSetter

type MultiPointZMSetter interface {
	MultiPointZMer
	SetPoints([][4]float64) error
}

MultiPointZMSetter is a mutable MultiPointer.

type MultiPointZMer

type MultiPointZMer interface {
	Geometry
	Points() [][4]float64
}

MultiPointZMer is a geometry with multiple 3+1D points.

type MultiPointZS

type MultiPointZS struct {
	Srid uint32
	Mpz  MultiPointZ
}

MultiPointZS is a geometry with multiple, referenced 3D points.

func (MultiPointZS) MultiPointZ

func (mps MultiPointZS) MultiPointZ() MultiPointZ

Get the simple 3D multipoint

func (MultiPointZS) Points

func (mpzs MultiPointZS) Points() struct {
	Srid uint32
	Mpz  MultiPointZ
}

Points returns the coordinates for the 3D points

func (*MultiPointZS) SetSRID

func (mpzs *MultiPointZS) SetSRID(srid uint32, mpz MultiPointZ) (err error)

SetSRID modifies the struct containing the SRID int and the array of 3D coordinates

type MultiPointZSSetter

type MultiPointZSSetter interface {
	MultiPointZSer
	SetSRID(srid uint32, mpz MultiPointZ) error
}

MultiPointZSSetter is a mutable MultiPointZSer.

type MultiPointZSer

type MultiPointZSer interface {
	Geometry
	Points() struct {
		Srid uint32
		Mpz  MultiPointZ
	}
}

MultiPointZSer is a MultiPointZ + SRID.

type MultiPointZSetter

type MultiPointZSetter interface {
	MultiPointZer
	SetPoints([][3]float64) error
}

MultiPointZSetter is a mutable MultiPointer.

type MultiPointZer

type MultiPointZer interface {
	Geometry
	Points() [][3]float64
}

MultiPointZer is a geometry with multiple 3D points.

type MultiPointer

type MultiPointer interface {
	Geometry
	Points() [][2]float64
}

MultiPointer is a geometry with multiple points.

type MultiPolygon

type MultiPolygon [][][][2]float64

MultiPolygon is a geometry of multiple polygons.

func (MultiPolygon) AsSegments

func (mp MultiPolygon) AsSegments() (segs [][][]Line, err error)

AsSegments return a set of []Line

func (MultiPolygon) Polygons

func (mp MultiPolygon) Polygons() [][][][2]float64

Polygons returns the array of polygons.

func (*MultiPolygon) SetPolygons

func (mp *MultiPolygon) SetPolygons(input [][][][2]float64) (err error)

SetPolygons modifies the array of 2D coordinates

type MultiPolygonSetter

type MultiPolygonSetter interface {
	MultiPolygoner
	SetPolygons([][][][2]float64) error
}

MultiPolygonSetter is a mutable MultiPolygoner.

type MultiPolygoner

type MultiPolygoner interface {
	Geometry
	Polygons() [][][][2]float64
}

MultiPolygoner is a geometry of multiple polygons.

type Point

type Point [2]float64

Point describes a simple 2D point

func GetCoordinates

func GetCoordinates(g Geometry) (pts []Point, err error)

GetCoordinates return a list of points that make up a geometry. This makes no attempt to remove duplicate points.

func (Point) Area

func (p Point) Area() float64

Area of a point is always 0

func (Point) CrossProduct

func (p Point) CrossProduct(pt Point) float64

CrossProduct will return the cross product of the p and pt.

func (Point) Magnitude

func (p Point) Magnitude() float64

Magnitude of the point is the size of the point

func (Point) MaxX

func (p Point) MaxX() float64

MaxX is the same as X

func (Point) MaxY

func (p Point) MaxY() float64

MaxY is the same as y

func (Point) MinX

func (p Point) MinX() float64

MinX is the same as X

func (Point) MinY

func (p Point) MinY() float64

MinY is the same as y

func (Point) Multiply

func (p Point) Multiply(pt Point) Point

Multiply will return a new point that is the multiplication of pt and p

func (*Point) SetXY

func (p *Point) SetXY(xy [2]float64) (err error)

SetXY sets a pair of coordinates

func (Point) Subtract

func (p Point) Subtract(pt Point) Point

Subtract will return a new point that is the subtraction of pt from p

func (Point) WithinCircle

func (p Point) WithinCircle(a, b, c Point) bool

WithinCircle indicates weather the point p is contained the the circle defined by a,b,c REF: See Guibas and Stolf (1985) p.107

func (Point) X

func (p Point) X() float64

X is the x coordinate of a point in the projection

func (Point) XY

func (p Point) XY() [2]float64

XY returns an array of 2D coordinates

func (Point) Y

func (p Point) Y() float64

Y is the y coordinate of a point in the projection

type PointM

type PointM [3]float64

Point describes a simple 2D+1D point

func (PointM) M

func (p PointM) M() float64

M returns the metric related to the 2D point

func (*PointM) SetXYM

func (p *PointM) SetXYM(xym [3]float64) (err error)

SetXYM sets the three coordinates

func (PointM) XY

func (p PointM) XY() [2]float64

XY returns an array of 2D coordinates

func (PointM) XYM

func (p PointM) XYM() [3]float64

XYM returns an array of 2D+1D coordinates

type PointMS

type PointMS struct {
	Srid uint32
	Xym  PointM
}

Point describes a simple 3D point with SRID

func (PointMS) S

func (p PointMS) S() uint32

S returns the srid as uint32

func (*PointMS) SetXYMS

func (p *PointMS) SetXYMS(srid uint32, xym PointM) (err error)

SetXYMS sets the XYM coordinates and the SRID

func (PointMS) XYM

func (p PointMS) XYM() PointM

XYM returns 3D+1D point

func (PointMS) XYMS

func (p PointMS) XYMS() struct {
	Srid uint32
	Xym  PointM
}

XYMS returns the struct itself

type PointMSSetter

type PointMSSetter interface {
	PointMSer
	SetXYMS(srid uint32, xym PointM) error
}

PointMSSetter is a mutable PointMer

type PointMSer

type PointMSer interface {
	Geometry
	XYMS() struct {
		Srid uint32
		Xym  PointM
	}
}

PointMSer is a 2D+1D point + SRID

type PointMSetter

type PointMSetter interface {
	PointMer
	SetXYM([3]float64) error
}

PointMSetter is a mutable PointMer

type PointMer

type PointMer interface {
	Geometry
	XYM() [3]float64
}

PointMer is a 2D+1D point.

type PointS

type PointS struct {
	Srid uint32
	Xy   Point
}

Point describes a simple 2D point with SRID

func (PointS) S

func (p PointS) S() uint32

S returns the srid as uint32

func (*PointS) SetXYS

func (p *PointS) SetXYS(srid uint32, xy Point) (err error)

SetXYS sets the XY coordinates and the SRID

func (PointS) XY

func (p PointS) XY() Point

XY returns 2D point

func (PointS) XYS

func (p PointS) XYS() struct {
	Srid uint32
	Xy   Point
}

XYS returns the struct itself

type PointSSetter

type PointSSetter interface {
	PointSer
	SetXYS(srid uint32, xy Point) error
}

PointSSetter is a mutable PointSer

type PointSer

type PointSer interface {
	Geometry
	XYS() struct {
		Srid uint32
		Xy   Point
	}
}

PointSer is a 2D point + SRID

type PointSetter

type PointSetter interface {
	Pointer
	SetXY([2]float64) error
}

PointSetter is a mutable Pointer.

type PointZ

type PointZ [3]float64

Point describes a simple 3D point

func (PointZ) Magnitude

func (p PointZ) Magnitude() float64

Magnitude of the point is the size of the point

func (*PointZ) SetXYZ

func (p *PointZ) SetXYZ(xyz [3]float64) (err error)

SetXYZ sets the three coordinates

func (PointZ) XY

func (p PointZ) XY() [2]float64

XY returns an array of 2D coordinates

func (PointZ) XYZ

func (p PointZ) XYZ() [3]float64

XYZ returns an array of 3D coordinates

type PointZM

type PointZM [4]float64

Point describes a simple 3D+1D point

func (PointZM) M

func (p PointZM) M() float64

M returns the metric related to the 2D point

func (*PointZM) SetXYZM

func (p *PointZM) SetXYZM(xyzm [4]float64) (err error)

SetXYZM sets the three coordinates

func (PointZM) XYZ

func (p PointZM) XYZ() [3]float64

XYZ returns an array of 3D coordinates

func (PointZM) XYZM

func (p PointZM) XYZM() [4]float64

XYZM returns an array of 3D+1D coordinates

type PointZMS

type PointZMS struct {
	Srid uint32
	Xyzm PointZM
}

Point describes a simple 3D+1D point with SRID

func (PointZMS) S

func (p PointZMS) S() uint32

S returns the srid as uint32

func (*PointZMS) SetXYZMS

func (p *PointZMS) SetXYZMS(srid uint32, xyzm PointZM) (err error)

SetXYZMS sets the XYZM coordinates and the SRID

func (PointZMS) XYZM

func (p PointZMS) XYZM() PointZM

XYZM returns 3D+1D point

func (PointZMS) XYZMS

func (p PointZMS) XYZMS() struct {
	Srid uint32
	Xyzm PointZM
}

XYZMS returns the struct itself

type PointZMSSetter

type PointZMSSetter interface {
	PointZMSer
	SetXYZMS(srid uint32, xyzm PointZM) error
}

PointZMSSetter is a mutable PointZMer

type PointZMSer

type PointZMSer interface {
	Geometry
	XYZMS() struct {
		Srid uint32
		Xyzm PointZM
	}
}

PointZMSer is a 3D+1D point + SRID

type PointZMSetter

type PointZMSetter interface {
	PointZMer
	SetXYZM([4]float64) error
}

PointZMSetter is a mutable PointZMer

type PointZMer

type PointZMer interface {
	Geometry
	XYZM() [4]float64
}

PointZMer is a 3D+1D point.

type PointZS

type PointZS struct {
	Srid uint32
	Xyz  PointZ
}

Point describes a simple 3D point with SRID

func (PointZS) S

func (p PointZS) S() uint32

S returns the srid as uint32

func (*PointZS) SetXYZS

func (p *PointZS) SetXYZS(srid uint32, xyz PointZ) (err error)

SetXYZS sets the XYZ coordinates and the SRID

func (PointZS) XYZ

func (p PointZS) XYZ() PointZ

XYZ returns 3D point

func (PointZS) XYZS

func (p PointZS) XYZS() struct {
	Srid uint32
	Xyz  PointZ
}

XYZS returns the struct itself

type PointZSSetter

type PointZSSetter interface {
	PointZSer
	SetXYZS(srid uint32, xyz PointZ) error
}

PointZSSetter is a mutable PointZSer

type PointZSer

type PointZSer interface {
	Geometry
	XYZS() struct {
		Srid uint32
		Xyz  PointZ
	}
}

PointZSer is a 3D point + SRID

type PointZSetter

type PointZSetter interface {
	PointZer
	SetXYZ([3]float64) error
}

PointZSetter is a mutable PointZer

type PointZer

type PointZer interface {
	Geometry
	XYZ() [3]float64
}

PointZer is a 3D point.

type Pointer

type Pointer interface {
	Geometry
	XY() [2]float64
}

Pointer is a point with two dimensions.

type Polygon

type Polygon [][][2]float64

Polygon is a geometry consisting of multiple closed LineStrings. There must be only one exterior LineString with a clockwise winding order. There may be one or more interior LineStrings with a counterclockwise winding orders. The last point in the linear ring will not match the first point.

func (Polygon) AsSegments

func (p Polygon) AsSegments() (segs [][]Line, err error)

AsSegments returns the polygon as a slice of lines. This will make no attempt to only add unique segments.

func (Polygon) LinearRings

func (p Polygon) LinearRings() [][][2]float64

LinearRings returns the coordinates of the linear rings

func (*Polygon) SetLinearRings

func (p *Polygon) SetLinearRings(input [][][2]float64) (err error)

SetLinearRings modifies the array of 2D coordinates

type PolygonM

type PolygonM [][][3]float64

PolygonM is a geometry consisting of multiple closed LineStringMs. There must be only one exterior LineStringM with a clockwise winding order. There may be one or more interior LineStringMs with a counterclockwise winding orders. The last point in the linear ring will not match the first point.

func (PolygonM) AsSegments

func (p PolygonM) AsSegments() (segs [][]LineM, err error)

AsSegments returns the polygon as a slice of lines. This will make no attempt to only add unique segments.

func (PolygonM) LinearRings

func (p PolygonM) LinearRings() [][][3]float64

LinearRings returns the coordinates of the linear rings

func (*PolygonM) SetLinearRings

func (p *PolygonM) SetLinearRings(input [][][3]float64) (err error)

SetLinearRingZs modifies the array of 2D+1 coordinates

type PolygonMS

type PolygonMS struct {
	Srid uint32
	Polm PolygonM
}

PolygonMS is a geometry consisting of multiple closed LineStringMSs. There must be only one exterior LineStringMS with a clockwise winding order. There may be one or more interior LineStringMSs with a counterclockwise winding orders. The last point in the linear ring will not match the first point.

func (PolygonMS) AsSegments

func (p PolygonMS) AsSegments() (segs [][]LineM, srid uint32, err error)

AsSegments returns the polygon as a slice of lines. This will make no attempt to only add unique segments.

func (PolygonMS) LinearRings

func (p PolygonMS) LinearRings() struct {
	Srid uint32
	Polm PolygonM
}

LinearRings returns the coordinates of the linear rings

func (*PolygonMS) SetLinearRings

func (p *PolygonMS) SetLinearRings(srid uint32, polm PolygonM) (err error)

SetLinearRingMs modifies the array of 3D coordinates

type PolygonMSSetter

type PolygonMSSetter interface {
	PolygonMSer
	SetLinearRings(srid uint32, polm PolygonM) error
	AsSegments() ([][]LineM, uint32, error)
}

type PolygonMSer

type PolygonMSer interface {
	Geometry
	LinearRings() struct {
		Srid uint32
		Polm PolygonM
	}
}

type PolygonMSetter

type PolygonMSetter interface {
	PolygonMer
	SetLinearRings([][][3]float64) error
	AsSegments() ([][]LineM, error)
}

type PolygonMer

type PolygonMer interface {
	Geometry
	LinearRings() [][][3]float64
}

type PolygonS

type PolygonS struct {
	Srid uint32
	Pol  Polygon
}

PolygonS is a geometry consisting of multiple closed LineStringSs. There must be only one exterior LineStringS with a clockwise winding order. There may be one or more interior LineStringSs with a counterclockwise winding orders. The last point in the linear ring will not match the first point.

func (PolygonS) AsSegments

func (p PolygonS) AsSegments() (segs [][]Line, srid uint32, err error)

AsSegments returns the polygon as a slice of lines. This will make no attempt to only add unique segments.

func (PolygonS) LinearRings

func (p PolygonS) LinearRings() struct {
	Srid uint32
	Pol  Polygon
}

LinearRings returns the coordinates of the linear rings

func (*PolygonS) SetLinearRings

func (p *PolygonS) SetLinearRings(srid uint32, pol Polygon) (err error)

SetLinearRingZs modifies the array of 3D coordinates

type PolygonSSetter

type PolygonSSetter interface {
	PolygonSer
	SetLinearRings(srid uint32, pol Polygon) error
	AsSegments() ([][]Line, uint32, error)
}

type PolygonSer

type PolygonSer interface {
	Geometry
	LinearRings() struct {
		Srid uint32
		Pol  Polygon
	}
}

type PolygonSetter

type PolygonSetter interface {
	Polygoner
	SetLinearRings([][][2]float64) error
	AsSegments() ([][]Line, error)
}

PolygonSetter is a mutable Polygoner.

type PolygonZ

type PolygonZ [][][3]float64

PolygonZ is a geometry consisting of multiple closed LineStringZs. There must be only one exterior LineStringZ with a clockwise winding order. There may be one or more interior LineStringZs with a counterclockwise winding orders. The last point in the linear ring will not match the first point.

func (PolygonZ) AsSegments

func (p PolygonZ) AsSegments() (segs [][]LineZ, err error)

AsSegments returns the polygon as a slice of lines. This will make no attempt to only add unique segments.

func (PolygonZ) LinearRings

func (p PolygonZ) LinearRings() [][][3]float64

LinearRings returns the coordinates of the linear rings

func (*PolygonZ) SetLinearRings

func (p *PolygonZ) SetLinearRings(input [][][3]float64) (err error)

SetLinearRingZs modifies the array of 3D coordinates

type PolygonZM

type PolygonZM [][][4]float64

PolygonZM is a geometry consisting of multiple closed LineStringZMs. There must be only one exterior LineStringZM with a clockwise winding order. There may be one or more interior LineStringZMs with a counterclockwise winding orders. The last point in the linear ring will not match the first point.

func (PolygonZM) AsSegments

func (p PolygonZM) AsSegments() (segs [][]LineZM, err error)

AsSegments returns the polygon as a slice of lines. This will make no attempt to only add unique segments.

func (PolygonZM) LinearRings

func (p PolygonZM) LinearRings() [][][4]float64

LinearRings returns the coordinates of the linear rings

func (*PolygonZM) SetLinearRings

func (p *PolygonZM) SetLinearRings(input [][][4]float64) (err error)

SetLinearRingZs modifies the array of 3D coordinates

type PolygonZMS

type PolygonZMS struct {
	Srid  uint32
	Polzm PolygonZM
}

PolygonZMS is a geometry consisting of multiple closed LineStringZMSs. There must be only one exterior LineStringZMS with a clockwise winding order. There may be one or more interior LineStringZMSs with a counterclockwise winding orders. The last point in the linear ring will not match the first point.

func (PolygonZMS) AsSegments

func (p PolygonZMS) AsSegments() (segs [][]LineZM, srid uint32, err error)

AsSegments returns the polygon as a slice of lines. This will make no attempt to only add unique segments.

func (PolygonZMS) LinearRings

func (p PolygonZMS) LinearRings() struct {
	Srid  uint32
	Polzm PolygonZM
}

LinearRings returns the coordinates of the linear rings

func (*PolygonZMS) SetLinearRings

func (p *PolygonZMS) SetLinearRings(srid uint32, polzm PolygonZM) (err error)

SetLinearRingMs modifies the array of 3D coordinates

type PolygonZMSSetter

type PolygonZMSSetter interface {
	PolygonZMSer
	SetLinearRings(srid uint32, polzm PolygonZM) error
	AsSegments() ([][]LineZM, uint32, error)
}

type PolygonZMSer

type PolygonZMSer interface {
	Geometry
	LinearRings() struct {
		Srid  uint32
		Polzm PolygonZM
	}
}

type PolygonZMSetter

type PolygonZMSetter interface {
	PolygonZMer
	SetLinearRings([][][4]float64) error
	AsSegments() ([][]LineZM, error)
}

type PolygonZMer

type PolygonZMer interface {
	Geometry
	LinearRings() [][][4]float64
}

type PolygonZS

type PolygonZS struct {
	Srid uint32
	Polz PolygonZ
}

PolygonZS is a geometry consisting of multiple closed LineStringZSs. There must be only one exterior LineStringZS with a clockwise winding order. There may be one or more interior LineStringZSs with a counterclockwise winding orders. The last point in the linear ring will not match the first point.

func (PolygonZS) AsSegments

func (p PolygonZS) AsSegments() (segs [][]LineZ, srid uint32, err error)

AsSegments returns the polygon as a slice of lines. This will make no attempt to only add unique segments.

func (PolygonZS) LinearRings

func (p PolygonZS) LinearRings() struct {
	Srid uint32
	Polz PolygonZ
}

LinearRings returns the coordinates of the linear rings

func (*PolygonZS) SetLinearRings

func (p *PolygonZS) SetLinearRings(srid uint32, polz PolygonZ) (err error)

SetLinearRingZs modifies the array of 3D coordinates

type PolygonZSSetter

type PolygonZSSetter interface {
	PolygonZSer
	SetLinearRings(srid uint32, polz PolygonZ) error
	AsSegments() ([][]LineZ, uint32, error)
}

type PolygonZSer

type PolygonZSer interface {
	Geometry
	LinearRings() struct {
		Srid uint32
		Polz PolygonZ
	}
}

type PolygonZSetter

type PolygonZSetter interface {
	PolygonZer
	SetLinearRings([][][3]float64) error
	AsSegments() ([][]LineZ, error)
}

type PolygonZer

type PolygonZer interface {
	Geometry
	LinearRings() [][][3]float64
}

type Polygoner

type Polygoner interface {
	Geometry
	LinearRings() [][][2]float64
}

Polygoner is a geometry consisting of multiple Linear Rings. There must be only one exterior LineString with a clockwise winding order. There may be one or more interior LineStrings with a counterclockwise winding orders. It is assumed that the last point is connected to the first point, and the first point is NOT duplicated at the end.

type Triangle

type Triangle [3][2]float64

Triangle is a array representation of a geometry triangle.

func NewTriangleContaining

func NewTriangleContaining(pts ...Point) Triangle

NewTriangleContaining returns a triangle that is large enough to contain the given points

func NewTriangleContainingPoints

func NewTriangleContainingPoints(pts ...[2]float64) Triangle

func NewTriangleForExtent

func NewTriangleForExtent(ext *Extent, buff float64) (Triangle, error)

func NewTriangleFromPolygon

func NewTriangleFromPolygon(py [][][2]float64) Triangle

NewTriangleFromPolygon takes the first three points from the outer ring of a polygon to create a triangle.

func (Triangle) Area

func (t Triangle) Area() float64

Area reaturns twice the area of the oriented triangle (a,b,c), i.e. the area is positive if the triangle is oriented counterclockwise.

func (Triangle) Center

func (t Triangle) Center() (pt [2]float64)

Center returns a point at the center of the triangle.

func (Triangle) LinearRings

func (t Triangle) LinearRings() [][][2]float64

LinearRings returns the coordinates of the linear rings

func (Triangle) ThirdPoint

func (t Triangle) ThirdPoint(p1, p2 [2]float64) [2]float64

ThirdPoint takes 2 points and checks which point is the 3rd in the Triangle

Directories

Path Synopsis
geojson
Package geojson implements encoding and decoding of GeoJSON as defined in [RFC 7946](https://tools.ietf.org/html/rfc7946).
Package geojson implements encoding and decoding of GeoJSON as defined in [RFC 7946](https://tools.ietf.org/html/rfc7946).
mvt
Package mvt is used to encode MVT tiles
Package mvt is used to encode MVT tiles
mvt/vector_tile
Package vectorTile is a generated protocol buffer package.
Package vectorTile is a generated protocol buffer package.
wkb
Package wkb is for decoding ESRI's Well Known Binary (WKB) format for OGC geometry (WKBGeometry) sepcification at http://edndoc.esri.com/arcsde/9.1/general_topics/wkb_representation.htm There are a few types supported by the specification.
Package wkb is for decoding ESRI's Well Known Binary (WKB) format for OGC geometry (WKBGeometry) sepcification at http://edndoc.esri.com/arcsde/9.1/general_topics/wkb_representation.htm There are a few types supported by the specification.
wkt
wkt/internal/cmd/fuzz/fuzz
Package fuzz provides primitives to generate random geom geometry types.
Package fuzz provides primitives to generate random geom geometry types.
internal
debugger
Package debugger provides a way for us to capture partial geometries during geometry processing.
Package debugger provides a way for us to capture partial geometries during geometry processing.
rtreego
Package rtreego is a library for efficiently storing and querying spatial data.
Package rtreego is a library for efficiently storing and querying spatial data.
coord/utm
Package utm provides the ability to work with UTM coordinates
Package utm provides the ability to work with UTM coordinates
index/kdtree
kdtree is a two dimensional kd-tree implementation
kdtree is a two dimensional kd-tree implementation
triangulate/delaunay/quadedge
Package quadedge describes a quadedge object used to build up the triangulation A quadedge is made up of four directional edges
Package quadedge describes a quadedge object used to build up the triangulation A quadedge is made up of four directional edges
testing
must
Package must provides helpers to decode wkt geometries to be used in tests
Package must provides helpers to decode wkt geometries to be used in tests
Package winding provides primitives for determining the winding order of a set of points
Package winding provides primitives for determining the winding order of a set of points

Jump to

Keyboard shortcuts

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