Back to godoc.org

Package basic

v0.0.0-...-60453eb
Latest Go to latest

The highest tagged major version is .

Published: Sep 12, 2020 | License: MIT | Module: gitee.com/exlimit/tegola

Index

Constants

const DefaultPointFormat = "{%06f,%06f}, "

func ApplyToPoints

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

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

func CloneGeometry

func CloneGeometry(geometry geom.Geometry) (geom.Geometry, error)

CloneGeomtry returns a deep clone of the Geometry.

func DefaultPointDecorator

func DefaultPointDecorator(pt Point) string

func FromWebMercator

func FromWebMercator(SRID uint64, geometry geom.Geometry) (geom.Geometry, error)

FromWebMercator takes a geometry encoded with WebMercator, and returns a Geometry encodes to the given srid.

func ToWebMercator

func ToWebMercator(SRID uint64, geometry geom.Geometry) (geom.Geometry, error)

ToWebMercator takes a SRID and a geometry encode using that srid, and returns a geometry encoded as a WebMercator.

type Collection

type Collection []Geometry

Collection type can represent one or more other basic types.

func (Collection) Geometeries

func (c Collection) Geometeries() (geometeries []G)

Geometeries return a set of geometeies that make that collection.

func (Collection) MarshalJSON

func (c Collection) MarshalJSON() ([]byte, error)

func (Collection) String

func (Collection) String() string

type G

type G struct {
	Geometry
}

G is used to pass back a generic Geometry type. It will contains functions to do basic conversions.

func (G) AsLine

func (g G) AsLine() Line

func (G) AsMultiPolygon

func (g G) AsMultiPolygon() MultiPolygon

func (G) AsPoint

func (g G) AsPoint() Point

func (G) AsPolygon

func (g G) AsPolygon() Polygon

func (G) IsLine

func (g G) IsLine() bool

func (G) IsPoint

func (g G) IsPoint() bool

func (G) IsPolygon

func (g G) IsPolygon() bool

type Geometry

type Geometry interface {
	String() string
	// contains filtered or unexported methods
}

func Clone

func Clone(geo tegola.Geometry) Geometry

func MapAsGeometry

func MapAsGeometry(m map[string]interface{}) (geo Geometry, err error)

func UnmarshalJSON

func UnmarshalJSON(data []byte) (geo Geometry, err error)

type Line

type Line []Point

Line is a basic line type which is made up of two or more points that don't intersect. TODO: We don't really check to make sure the points don't intersect.

func CloneLine

func CloneLine(line tegola.LineString) (l Line)

CloneLine will return a basic.Line for a given tegola.LineString

func NewLine

func NewLine(pointPairs ...float64) Line

NewLine creates a line given pairs for floats.

func NewLineFrom2Float64

func NewLineFrom2Float64(points ...[2]float64) (l Line)

func NewLineFromPt

func NewLineFromPt(points ...maths.Pt) Line

func NewLineFromSubPoints

func NewLineFromSubPoints(points ...tegola.Point) (l Line)

func NewLineTruncatedFromPt

func NewLineTruncatedFromPt(points ...maths.Pt) Line

func (Line) AsGeomLineString

func (l Line) AsGeomLineString() (ln [][2]float64)

TODO: gdey remove this function when we have moved over to geomLinestring.

func (Line) AsPts

func (l Line) AsPts() []maths.Pt

func (Line) Contains

func (l Line) Contains(pt Point) bool

Contains tells you weather the given point is contained by the Linestring. This assumes the linestring is a connected linestring.

func (Line) ContainsLine

func (l Line) ContainsLine(ln Line) bool

func (Line) Direction

func (l Line) Direction() maths.WindingOrder

func (Line) GoString

func (l Line) GoString() string

func (Line) GoStringTypeDecorated

func (l Line) GoStringTypeDecorated(withType bool, indent int, lineComment string, pointDecorator func(pt Point) string) string

func (Line) GoStringTyped

func (l Line) GoStringTyped(withType bool, indent int, lineComment string) string

func (Line) IsValid

func (l Line) IsValid() bool

IsValid returns whether the line is valid according to the OGC specifiction The line should not intersect it's self.

func (Line) MarshalJSON

func (l Line) MarshalJSON() ([]byte, error)

func (Line) String

func (Line) String() string

func (Line) Subpoints

func (l Line) Subpoints() (points []tegola.Point)

Subpoints return the points in a line.

type MultiLine

type MultiLine []Line

MultiLine is a set of lines.

func CloneMultiLine

func CloneMultiLine(mline tegola.MultiLine) (ml MultiLine)

CloneMultiLine will return a basic.MultiLine for a given togola.MultiLine

func NewMultiLine

func NewMultiLine(pointPairLines ...[]float64) (ml MultiLine)

func (MultiLine) Lines

func (ml MultiLine) Lines() (lines []tegola.LineString)

Lines are the lines in a Multiline

func (MultiLine) MarshalJSON

func (l MultiLine) MarshalJSON() ([]byte, error)

func (MultiLine) String

func (MultiLine) String() string

type MultiPoint

type MultiPoint []Point

MultiPoint describes a simple set of 2d points

func CloneMultiPoint

func CloneMultiPoint(mpt tegola.MultiPoint) MultiPoint

CloneMultiPoint will return a basic.MultiPoint for the given tegol.MultiPoint

func (MultiPoint) MarshalJSON

func (p MultiPoint) MarshalJSON() ([]byte, error)

func (MultiPoint) Points

func (v MultiPoint) Points() (points []tegola.Point)

Points are the points that make up the set

func (MultiPoint) String

func (MultiPoint) String() string

type MultiPoint3

type MultiPoint3 []Point3

MultiPoint3 describes a simple set of 3d points

func (MultiPoint3) MarshalJSON

func (p MultiPoint3) MarshalJSON() ([]byte, error)

func (MultiPoint3) Points

func (v MultiPoint3) Points() (points []tegola.Point)

Points are the points that make up the set

func (MultiPoint3) String

func (MultiPoint3) String() string

type MultiPolygon

type MultiPolygon []Polygon

MultiPolygon describes a set of polygons.

func CloneMultiPolygon

func CloneMultiPolygon(mpolygon tegola.MultiPolygon) (mply MultiPolygon)

CloneMultiPolygon will return a basic.MultiPolygon for a given tegola.MultiPolygon.

func NewMultiPolygonFromPolygons

func NewMultiPolygonFromPolygons(polygons ...tegola.Polygon) (mp MultiPolygon)

func (MultiPolygon) GoString

func (p MultiPolygon) GoString() string

func (MultiPolygon) GoStringTyped

func (p MultiPolygon) GoStringTyped(withType bool, indent int, lineComment string) string

func (MultiPolygon) MarshalJSON

func (p MultiPolygon) MarshalJSON() ([]byte, error)

func (MultiPolygon) Polygons

func (mp MultiPolygon) Polygons() (polygons []tegola.Polygon)

Polygons returns the polygons that make up the set.

func (MultiPolygon) String

func (MultiPolygon) String() string

type Point

type Point [2]float64

Point describes a simple 2d point

func ClonePoint

func ClonePoint(pt tegola.Point) Point

ClonePoint will return a basic.Point for given tegola.Point.

func (*Point) AsPt

func (p *Point) AsPt() maths.Pt

AsPt returns the equivalent maths.Pt

func (Point) MarshalJSON

func (p Point) MarshalJSON() ([]byte, error)

func (Point) String

func (p Point) String() string

func (Point) X

func (bp Point) X() float64

X is the x coordinate

func (Point) Y

func (bp Point) Y() float64

Y is the y coordinate

type Point3

type Point3 [3]float64

Point3 describes a simple 3d point

func ClonePoint3

func ClonePoint3(pt tegola.Point3) Point3

ClonePoint will return a basic.Point3 for given tegola.Point3.

func (Point3) MarshalJSON

func (p Point3) MarshalJSON() ([]byte, error)

func (Point3) String

func (p Point3) String() string

func (Point3) X

func (bp Point3) X() float64

X is the x coordinate

func (Point3) Y

func (bp Point3) Y() float64

Y is the y coordinate

func (Point3) Z

func (bp Point3) Z() float64

Z is the z coordinate

type Polygon

type Polygon []Line

Polygon describes a basic polygon; made up of multiple lines.

func ClonePolygon

func ClonePolygon(polygon tegola.Polygon) (ply Polygon)

ClonePolygon will return a basic.Polygon for a given tegola.Polygon

func NewPolygon

func NewPolygon(main []maths.Pt, clines ...[]maths.Pt) Polygon

func NewPolygonFromSubLines

func NewPolygonFromSubLines(lines ...tegola.LineString) (p Polygon)

func (Polygon) GoString

func (p Polygon) GoString() string

func (Polygon) GoStringTypeDecorated

func (p Polygon) GoStringTypeDecorated(withType bool, indent int, lineComment string, pointDecorator func(pt Point) string) string

basic.Polygon { // basic.Polygon len(1);

{ lines… },

}

func (Polygon) GoStringTyped

func (p Polygon) GoStringTyped(withType bool, indent int, lineComment string) string

func (Polygon) IsValid

func (p Polygon) IsValid() bool

IsValid returns weather the polygon is valid according to the OGC specifiction.

func (Polygon) MarshalJSON

func (p Polygon) MarshalJSON() ([]byte, error)

func (Polygon) String

func (Polygon) String() string

func (Polygon) Sublines

func (p Polygon) Sublines() (slines []tegola.LineString)

Sublines returns the lines that make up the polygon.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier