basic

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func DefaultPointDecorator added in v0.4.0

func DefaultPointDecorator(pt Point) string

Types

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 added in v0.4.0

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

func (Collection) String

func (Collection) String() string

type G added in v0.4.0

type G struct {
	Geometry
}

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

func ApplyToPoints

func ApplyToPoints(geometry tegola.Geometry, f func(coords ...float64) ([]float64, error)) (G, 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 tegola.Geometry) (G, error)

CloneGeomtry returns a deep clone of the Geometry.

func FromWebMercator added in v0.2.0

func FromWebMercator(SRID uint64, geometry tegola.Geometry) (G, error)

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

func ToWebMercator

func ToWebMercator(SRID uint64, geometry tegola.Geometry) (G, error)

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

func (G) AsLine added in v0.4.0

func (g G) AsLine() Line

func (G) AsMultiPolygon added in v0.4.0

func (g G) AsMultiPolygon() MultiPolygon

func (G) AsPoint added in v0.4.0

func (g G) AsPoint() Point

func (G) AsPolygon added in v0.4.0

func (g G) AsPolygon() Polygon

func (G) IsLine added in v0.4.0

func (g G) IsLine() bool

func (G) IsPoint added in v0.4.0

func (g G) IsPoint() bool

func (G) IsPolygon added in v0.4.0

func (g G) IsPolygon() bool

type Geometry added in v0.4.0

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

func Clone added in v0.4.0

func Clone(geo tegola.Geometry) Geometry

func MapAsGeometry added in v0.4.0

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

func UnmarshalJSON added in v0.4.0

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 added in v0.4.0

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 added in v0.6.0

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

func NewLineFromPt added in v0.4.0

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

func NewLineFromSubPoints added in v0.4.0

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

func NewLineTruncatedFromPt added in v0.4.0

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

func (Line) AsGeomLineString added in v0.6.0

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

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

func (Line) AsPts added in v0.4.0

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

func (Line) Contains added in v0.4.0

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 added in v0.4.0

func (l Line) ContainsLine(ln Line) bool

func (Line) Direction added in v0.4.0

func (l Line) Direction() maths.WindingOrder

func (Line) GoString added in v0.4.0

func (l Line) GoString() string

func (Line) GoStringTypeDecorated added in v0.4.0

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

func (Line) GoStringTyped added in v0.4.0

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

func (Line) IsValid added in v0.4.0

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 added in v0.4.0

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 added in v0.4.0

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

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

func NewMultiLine added in v0.4.0

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 added in v0.4.0

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 added in v0.4.0

func CloneMultiPoint(mpt tegola.MultiPoint) MultiPoint

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

func (MultiPoint) MarshalJSON added in v0.4.0

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 added in v0.4.0

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 added in v0.4.0

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

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

func NewMultiPolygonFromPolygons added in v0.4.0

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

func (MultiPolygon) GoString added in v0.4.0

func (p MultiPolygon) GoString() string

func (MultiPolygon) GoStringTyped added in v0.4.0

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

func (MultiPolygon) MarshalJSON added in v0.4.0

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 added in v0.4.0

func ClonePoint(pt tegola.Point) Point

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

func (*Point) AsPt added in v0.4.0

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

AsPt returns the equivalent maths.Pt

func (Point) MarshalJSON added in v0.4.0

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 added in v0.4.0

func ClonePoint3(pt tegola.Point3) Point3

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

func (Point3) MarshalJSON added in v0.4.0

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 added in v0.4.0

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

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

func NewPolygon added in v0.4.0

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

func NewPolygonFromSubLines added in v0.4.0

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

func (Polygon) GoString added in v0.4.0

func (p Polygon) GoString() string

func (Polygon) GoStringTypeDecorated added in v0.4.0

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 added in v0.4.0

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

func (Polygon) IsValid added in v0.4.0

func (p Polygon) IsValid() bool

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

func (Polygon) MarshalJSON added in v0.4.0

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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