Documentation ¶
Overview ¶
Package geo defines geographic operations
outline: geo geo defines geographic operations in two-dimensional space functions: Point(x,y) Point Point constructor, takes an x(longitude) and y(latitude) value and returns a Point object params: x float x-dimension value (longitude if using geodesic space) y float y-dimension value (latitude if using geodesic space) Line(points) Line Line constructor. Takes either an array of coordinate pairs or an array of point objects and returns the line that connects them. Points do not need to be collinear, providing a single point returns a line with a length of 0 params: points [[]float|Point] list of points on the line Polygon(rings) Polygon Polygon constructor. Takes a list of lists of coordinate pairs (or point objects) that define the outer boundary and any holes / inner boundaries that represent a polygon. In GIS tradition, lists of coordinates that wind clockwise are filled regions and anti-clockwise represent holes. params: rings [Line] list of closed lines that constitute the polygon MultiPolygon(polygons) MultiPolygon MultiPolygon constructor. MultiPolygon groups a list of polygons to behave like a single polygon params: polygons [Polygon] within(geom,polygon) bool Returns True if geom is entirely contained by polygon params: geom [point,line,polygon] maybe-inner geometry polygon [Polygon,MultiPolygon] maybe-outer polygon parseGeoJSON(data) (geoms, properties) Parses string data in IETF-7946 format (https://tools.ietf.org/html/rfc7946) returning a list of geometries and equal-length list of properties for each geometry params: data string string of GeoJSON data types: Point a two-dimensional point in space methods: distance(p2) float Euclidean Distance to the other point params: p2 point point to measure distance to distanceGeodesic(p2) float Distance on the surface of a sphere with the same radius as Earth params: p2 point point to measure distance to Line an ordered list of points that define a line methods: length() float Euclidean Length lengthGeodesic() float Line length on the surface of a sphere with the same radius as Earth Polygon an ordered list of closed lines (rings) that define a shape. lists of coordinates that wind clockwise are filled regions and anti-clockwise represent holes. MultiPolygon MultiPolygon groups a list of polygons to behave like a single polygon
Index ¶
- Constants
- func LoadModule() (starlark.StringDict, error)
- type Line
- func (l Line) Attr(name string) (starlark.Value, error)
- func (l Line) AttrNames() []string
- func (l Line) Freeze()
- func (l Line) Hash() (h uint32, err error)
- func (l Line) Index(i int) starlark.Value
- func (l Line) IsClosed() bool
- func (l Line) Iterate() starlark.Iterator
- func (l Line) Len() int
- func (l Line) OrbLineString() orb.LineString
- func (l Line) OrbRing() orb.Ring
- func (l Line) String() string
- func (l Line) Truth() starlark.Bool
- func (l Line) Type() string
- type MultiPolygon
- func (p MultiPolygon) Attr(name string) (starlark.Value, error)
- func (p MultiPolygon) AttrNames() []string
- func (p MultiPolygon) Freeze()
- func (p MultiPolygon) Hash() (h uint32, err error)
- func (p MultiPolygon) Index(i int) starlark.Value
- func (p MultiPolygon) Iterate() starlark.Iterator
- func (p MultiPolygon) Len() int
- func (p MultiPolygon) OrbMultiPolygon() orb.MultiPolygon
- func (p MultiPolygon) String() string
- func (p MultiPolygon) Truth() starlark.Bool
- func (p MultiPolygon) Type() string
- type Point
- type Polygon
- func (p Polygon) Attr(name string) (starlark.Value, error)
- func (p Polygon) AttrNames() []string
- func (p Polygon) Freeze()
- func (p Polygon) Hash() (h uint32, err error)
- func (p Polygon) Index(i int) starlark.Value
- func (p Polygon) Iterate() starlark.Iterator
- func (p Polygon) Len() int
- func (p Polygon) OrbPolygon() orb.Polygon
- func (p Polygon) String() string
- func (p Polygon) Truth() starlark.Bool
- func (p Polygon) Type() string
Constants ¶
const ( // ModuleName defines the expected name for this Module when used // in starlark's load() function, eg: load('geo.star', 'geo') ModuleName = "geo.star" )
Variables ¶
This section is empty.
Functions ¶
func LoadModule ¶
func LoadModule() (starlark.StringDict, error)
LoadModule loads the geo module. It is concurrency-safe and idempotent.
Types ¶
type Line ¶
type Line []Point
Line is the starlark geographic line type
func (Line) Freeze ¶
func (l Line) Freeze()
Freeze implements the starlark.Value interface, line is immutable
func (Line) OrbLineString ¶
func (l Line) OrbLineString() orb.LineString
OrbLineString converts line to a orb.LineString
type MultiPolygon ¶
type MultiPolygon []Polygon
MultiPolygon is the starlark geographic collection-of-polygons type
func (MultiPolygon) Attr ¶
func (p MultiPolygon) Attr(name string) (starlark.Value, error)
Attr gets an attribute of a polygon
func (MultiPolygon) AttrNames ¶
func (p MultiPolygon) AttrNames() []string
AttrNames returns all possible attribute names
func (MultiPolygon) Freeze ¶
func (p MultiPolygon) Freeze()
Freeze implements the starlark.Value interface, polygon is immutable
func (MultiPolygon) Hash ¶
func (p MultiPolygon) Hash() (h uint32, err error)
Hash implements the starlark.Value interface
func (MultiPolygon) Index ¶
func (p MultiPolygon) Index(i int) starlark.Value
Index implements the starlark indexable interface
func (MultiPolygon) Iterate ¶
func (p MultiPolygon) Iterate() starlark.Iterator
Iterate implements the starlark iterator interface
func (MultiPolygon) Len ¶
func (p MultiPolygon) Len() int
Len implements the starlark indexable interface
func (MultiPolygon) OrbMultiPolygon ¶
func (p MultiPolygon) OrbMultiPolygon() orb.MultiPolygon
OrbMultiPolygon formats polygon as an orb.MultiPolygon
func (MultiPolygon) String ¶
func (p MultiPolygon) String() string
String implements the starlark.Value interface
func (MultiPolygon) Truth ¶
func (p MultiPolygon) Truth() starlark.Bool
Truth implements the starlark.Value interface
func (MultiPolygon) Type ¶
func (p MultiPolygon) Type() string
Type implements the starlark.Value interface
type Point ¶
type Point [2]float64
Point is the starlark geographic point type
func (Point) Freeze ¶
func (p Point) Freeze()
Freeze implements the starlark.Value interface, point is immutable
type Polygon ¶
type Polygon []Line
Polygon is the starlark geographic polygon type
func (Polygon) Freeze ¶
func (p Polygon) Freeze()
Freeze implements the starlark.Value interface, polygon is immutable
func (Polygon) OrbPolygon ¶
OrbPolygon formats polygon as an orb.Polygon