geojson

package module
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 11 Imported by: 10

README

GeoJSON

GoDoc

This package provides GeoJSON utilties for Go. It's designed for Tile38.

License

GeoJSON source code is available under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultParseOptions = &ParseOptions{
	IndexChildren:     64,
	IndexGeometry:     64,
	IndexGeometryKind: geometry.QuadTree,
	RequireValid:      false,
	AllowSimplePoints: false,
	DisableCircleType: false,
	AllowRects:        false,
}

Functions

func IsPoint added in v1.1.1

func IsPoint(obj Object) (z float64, ok bool)

IsPoint returns true if the object is a {"type":"Point"}

Types

type Circle

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

func NewCircle

func NewCircle(center geometry.Point, meters float64, steps int) *Circle

NewCircle returns an circle object

func (*Circle) AppendJSON

func (g *Circle) AppendJSON(dst []byte) []byte

func (*Circle) Center

func (g *Circle) Center() geometry.Point

Center returns the circle's center point

func (*Circle) Contains

func (g *Circle) Contains(obj Object) bool

Contains returns true if the circle contains other object

func (*Circle) Distance

func (g *Circle) Distance(other Object) float64

func (*Circle) Empty

func (g *Circle) Empty() bool

func (*Circle) ForEach

func (g *Circle) ForEach(iter func(geom Object) bool) bool

func (*Circle) Haversine

func (g *Circle) Haversine() float64

Haversine returns the haversine corresponding to circle's radius

func (*Circle) HaversineTo

func (g *Circle) HaversineTo(p geometry.Point) float64

HaversineTo returns the haversine from a given point to circle's center

func (*Circle) Intersects

func (g *Circle) Intersects(obj Object) bool

Intersects returns true the circle intersects other object

func (*Circle) JSON

func (g *Circle) JSON() string

func (*Circle) MarshalJSON added in v1.1.0

func (g *Circle) MarshalJSON() ([]byte, error)

func (*Circle) Members added in v1.4.0

func (g *Circle) Members() string

func (*Circle) Meters

func (g *Circle) Meters() float64

Meters returns the circle's radius

func (*Circle) NumPoints

func (g *Circle) NumPoints() int

func (*Circle) Polygon added in v1.4.3

func (g *Circle) Polygon() Object

Polygon returns the circle as a GeoJSON Polygon.

func (*Circle) Rect

func (g *Circle) Rect() geometry.Rect

func (*Circle) Spatial

func (g *Circle) Spatial() Spatial

func (*Circle) String

func (g *Circle) String() string

func (*Circle) Valid

func (g *Circle) Valid() bool

func (*Circle) Within

func (g *Circle) Within(obj Object) bool

Within returns true if circle is contained inside object

type Collection

type Collection interface {
	Children() []Object
	Indexed() bool
	Search(rect geometry.Rect, iter func(child Object) bool)
}

Collection is a searchable collection type.

type EmptySpatial

type EmptySpatial struct{}

func (EmptySpatial) DistanceLine

func (s EmptySpatial) DistanceLine(line *geometry.Line) float64

func (EmptySpatial) DistancePoint

func (s EmptySpatial) DistancePoint(point geometry.Point) float64

func (EmptySpatial) DistancePoly

func (s EmptySpatial) DistancePoly(poly *geometry.Poly) float64

func (EmptySpatial) DistanceRect

func (s EmptySpatial) DistanceRect(rect geometry.Rect) float64

func (EmptySpatial) IntersectsLine

func (s EmptySpatial) IntersectsLine(line *geometry.Line) bool

func (EmptySpatial) IntersectsPoint

func (s EmptySpatial) IntersectsPoint(point geometry.Point) bool

func (EmptySpatial) IntersectsPoly

func (s EmptySpatial) IntersectsPoly(poly *geometry.Poly) bool

func (EmptySpatial) IntersectsRect

func (s EmptySpatial) IntersectsRect(rect geometry.Rect) bool

func (EmptySpatial) WithinLine

func (s EmptySpatial) WithinLine(line *geometry.Line) bool

func (EmptySpatial) WithinPoint

func (s EmptySpatial) WithinPoint(point geometry.Point) bool

func (EmptySpatial) WithinPoly

func (s EmptySpatial) WithinPoly(poly *geometry.Poly) bool

func (EmptySpatial) WithinRect

func (s EmptySpatial) WithinRect(rect geometry.Rect) bool

type Feature

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

func NewFeature

func NewFeature(geometry Object, members string) *Feature

NewFeature returns a new GeoJSON Feature. The members must be a valid json object such as `{"id":"391","properties":{}}`, or it must be an empty string. It should not contain a "feature" member.

func (*Feature) AppendJSON

func (g *Feature) AppendJSON(dst []byte) []byte

func (*Feature) Base

func (g *Feature) Base() Object

func (*Feature) Center

func (g *Feature) Center() geometry.Point

func (*Feature) Contains

func (g *Feature) Contains(obj Object) bool

func (*Feature) Distance

func (g *Feature) Distance(obj Object) float64

func (*Feature) DistanceLine

func (g *Feature) DistanceLine(line *geometry.Line) float64

func (*Feature) DistancePoint

func (g *Feature) DistancePoint(point geometry.Point) float64

func (*Feature) DistancePoly

func (g *Feature) DistancePoly(poly *geometry.Poly) float64

func (*Feature) DistanceRect

func (g *Feature) DistanceRect(rect geometry.Rect) float64

func (*Feature) Empty

func (g *Feature) Empty() bool

func (*Feature) ForEach

func (g *Feature) ForEach(iter func(geom Object) bool) bool

func (*Feature) Intersects

func (g *Feature) Intersects(obj Object) bool

func (*Feature) IntersectsLine

func (g *Feature) IntersectsLine(line *geometry.Line) bool

func (*Feature) IntersectsPoint

func (g *Feature) IntersectsPoint(point geometry.Point) bool

func (*Feature) IntersectsPoly

func (g *Feature) IntersectsPoly(poly *geometry.Poly) bool

func (*Feature) IntersectsRect

func (g *Feature) IntersectsRect(rect geometry.Rect) bool

func (*Feature) JSON

func (g *Feature) JSON() string

func (*Feature) MarshalJSON added in v1.1.0

func (g *Feature) MarshalJSON() ([]byte, error)

func (*Feature) Members

func (g *Feature) Members() string

func (*Feature) NumPoints

func (g *Feature) NumPoints() int

func (*Feature) Rect

func (g *Feature) Rect() geometry.Rect

func (*Feature) Spatial

func (g *Feature) Spatial() Spatial

func (*Feature) String

func (g *Feature) String() string

func (*Feature) Valid

func (g *Feature) Valid() bool

func (*Feature) Within

func (g *Feature) Within(obj Object) bool

func (*Feature) WithinLine

func (g *Feature) WithinLine(line *geometry.Line) bool

func (*Feature) WithinPoint

func (g *Feature) WithinPoint(point geometry.Point) bool

func (*Feature) WithinPoly

func (g *Feature) WithinPoly(poly *geometry.Poly) bool

func (*Feature) WithinRect

func (g *Feature) WithinRect(rect geometry.Rect) bool

type FeatureCollection

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

func NewFeatureCollection

func NewFeatureCollection(features []Object) *FeatureCollection

func (*FeatureCollection) AppendJSON

func (g *FeatureCollection) AppendJSON(dst []byte) []byte

AppendJSON appends the GeoJSON reprensentation to dst

func (*FeatureCollection) Base

func (g *FeatureCollection) Base() []Object

func (*FeatureCollection) Center

func (g *FeatureCollection) Center() geometry.Point

func (*FeatureCollection) Children

func (g *FeatureCollection) Children() []Object

func (*FeatureCollection) Contains

func (g *FeatureCollection) Contains(obj Object) bool

func (*FeatureCollection) Distance

func (g *FeatureCollection) Distance(obj Object) float64

func (*FeatureCollection) DistanceLine

func (g *FeatureCollection) DistanceLine(line *geometry.Line) float64

func (*FeatureCollection) DistancePoint

func (g *FeatureCollection) DistancePoint(point geometry.Point) float64

func (*FeatureCollection) DistancePoly

func (g *FeatureCollection) DistancePoly(poly *geometry.Poly) float64

func (*FeatureCollection) DistanceRect

func (g *FeatureCollection) DistanceRect(rect geometry.Rect) float64

func (*FeatureCollection) Empty

func (g *FeatureCollection) Empty() bool

func (*FeatureCollection) ForEach

func (g *FeatureCollection) ForEach(iter func(geom Object) bool) bool

func (*FeatureCollection) Indexed

func (g *FeatureCollection) Indexed() bool

func (*FeatureCollection) Intersects

func (g *FeatureCollection) Intersects(obj Object) bool

func (*FeatureCollection) IntersectsLine

func (g *FeatureCollection) IntersectsLine(line *geometry.Line) bool

func (*FeatureCollection) IntersectsPoint

func (g *FeatureCollection) IntersectsPoint(point geometry.Point) bool

func (*FeatureCollection) IntersectsPoly

func (g *FeatureCollection) IntersectsPoly(poly *geometry.Poly) bool

func (*FeatureCollection) IntersectsRect

func (g *FeatureCollection) IntersectsRect(rect geometry.Rect) bool

func (*FeatureCollection) JSON

func (g *FeatureCollection) JSON() string

func (*FeatureCollection) MarshalJSON added in v1.1.0

func (g *FeatureCollection) MarshalJSON() ([]byte, error)

func (*FeatureCollection) Members added in v1.4.0

func (g *FeatureCollection) Members() string

func (*FeatureCollection) NumPoints

func (g *FeatureCollection) NumPoints() int

func (*FeatureCollection) Rect

func (g *FeatureCollection) Rect() geometry.Rect

func (*FeatureCollection) Search

func (g *FeatureCollection) Search(rect geometry.Rect, iter func(child Object) bool)

func (*FeatureCollection) Spatial

func (g *FeatureCollection) Spatial() Spatial

func (*FeatureCollection) String

func (g *FeatureCollection) String() string

func (*FeatureCollection) Valid

func (g *FeatureCollection) Valid() bool

func (*FeatureCollection) Within

func (g *FeatureCollection) Within(obj Object) bool

func (*FeatureCollection) WithinLine

func (g *FeatureCollection) WithinLine(line *geometry.Line) bool

func (*FeatureCollection) WithinPoint

func (g *FeatureCollection) WithinPoint(point geometry.Point) bool

func (*FeatureCollection) WithinPoly

func (g *FeatureCollection) WithinPoly(poly *geometry.Poly) bool

func (*FeatureCollection) WithinRect

func (g *FeatureCollection) WithinRect(rect geometry.Rect) bool

type GeometryCollection

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

func NewGeometryCollection

func NewGeometryCollection(geometries []Object) *GeometryCollection

func (*GeometryCollection) AppendJSON

func (g *GeometryCollection) AppendJSON(dst []byte) []byte

AppendJSON appends the GeoJSON reprensentation to dst

func (*GeometryCollection) Base

func (g *GeometryCollection) Base() []Object

func (*GeometryCollection) Center

func (g *GeometryCollection) Center() geometry.Point

func (*GeometryCollection) Children

func (g *GeometryCollection) Children() []Object

func (*GeometryCollection) Contains

func (g *GeometryCollection) Contains(obj Object) bool

func (*GeometryCollection) Distance

func (g *GeometryCollection) Distance(obj Object) float64

func (*GeometryCollection) DistanceLine

func (g *GeometryCollection) DistanceLine(line *geometry.Line) float64

func (*GeometryCollection) DistancePoint

func (g *GeometryCollection) DistancePoint(point geometry.Point) float64

func (*GeometryCollection) DistancePoly

func (g *GeometryCollection) DistancePoly(poly *geometry.Poly) float64

func (*GeometryCollection) DistanceRect

func (g *GeometryCollection) DistanceRect(rect geometry.Rect) float64

func (*GeometryCollection) Empty

func (g *GeometryCollection) Empty() bool

func (*GeometryCollection) ForEach

func (g *GeometryCollection) ForEach(iter func(geom Object) bool) bool

func (*GeometryCollection) Indexed

func (g *GeometryCollection) Indexed() bool

func (*GeometryCollection) Intersects

func (g *GeometryCollection) Intersects(obj Object) bool

func (*GeometryCollection) IntersectsLine

func (g *GeometryCollection) IntersectsLine(line *geometry.Line) bool

func (*GeometryCollection) IntersectsPoint

func (g *GeometryCollection) IntersectsPoint(point geometry.Point) bool

func (*GeometryCollection) IntersectsPoly

func (g *GeometryCollection) IntersectsPoly(poly *geometry.Poly) bool

func (*GeometryCollection) IntersectsRect

func (g *GeometryCollection) IntersectsRect(rect geometry.Rect) bool

func (*GeometryCollection) JSON

func (g *GeometryCollection) JSON() string

func (*GeometryCollection) MarshalJSON added in v1.1.0

func (g *GeometryCollection) MarshalJSON() ([]byte, error)

func (*GeometryCollection) Members added in v1.4.0

func (g *GeometryCollection) Members() string

func (*GeometryCollection) NumPoints

func (g *GeometryCollection) NumPoints() int

func (*GeometryCollection) Rect

func (g *GeometryCollection) Rect() geometry.Rect

func (*GeometryCollection) Search

func (g *GeometryCollection) Search(rect geometry.Rect, iter func(child Object) bool)

func (*GeometryCollection) Spatial

func (g *GeometryCollection) Spatial() Spatial

func (*GeometryCollection) String

func (g *GeometryCollection) String() string

func (*GeometryCollection) Valid

func (g *GeometryCollection) Valid() bool

func (*GeometryCollection) Within

func (g *GeometryCollection) Within(obj Object) bool

func (*GeometryCollection) WithinLine

func (g *GeometryCollection) WithinLine(line *geometry.Line) bool

func (*GeometryCollection) WithinPoint

func (g *GeometryCollection) WithinPoint(point geometry.Point) bool

func (*GeometryCollection) WithinPoly

func (g *GeometryCollection) WithinPoly(poly *geometry.Poly) bool

func (*GeometryCollection) WithinRect

func (g *GeometryCollection) WithinRect(rect geometry.Rect) bool

type LineString

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

func NewLineString

func NewLineString(line *geometry.Line) *LineString

func (*LineString) AppendJSON

func (g *LineString) AppendJSON(dst []byte) []byte

func (*LineString) Base

func (g *LineString) Base() *geometry.Line

func (*LineString) Center

func (g *LineString) Center() geometry.Point

func (*LineString) Contains

func (g *LineString) Contains(obj Object) bool

func (*LineString) Distance

func (g *LineString) Distance(obj Object) float64

func (*LineString) DistanceLine

func (g *LineString) DistanceLine(line *geometry.Line) float64

func (*LineString) DistancePoint

func (g *LineString) DistancePoint(point geometry.Point) float64

func (*LineString) DistancePoly

func (g *LineString) DistancePoly(poly *geometry.Poly) float64

func (*LineString) DistanceRect

func (g *LineString) DistanceRect(rect geometry.Rect) float64

DistanceRect ..

func (*LineString) Empty

func (g *LineString) Empty() bool

func (*LineString) ForEach

func (g *LineString) ForEach(iter func(geom Object) bool) bool

func (*LineString) Intersects

func (g *LineString) Intersects(obj Object) bool

func (*LineString) IntersectsLine

func (g *LineString) IntersectsLine(line *geometry.Line) bool

func (*LineString) IntersectsPoint

func (g *LineString) IntersectsPoint(point geometry.Point) bool

func (*LineString) IntersectsPoly

func (g *LineString) IntersectsPoly(poly *geometry.Poly) bool

func (*LineString) IntersectsRect

func (g *LineString) IntersectsRect(rect geometry.Rect) bool

func (*LineString) JSON

func (g *LineString) JSON() string

func (*LineString) MarshalJSON added in v1.1.0

func (g *LineString) MarshalJSON() ([]byte, error)

func (*LineString) Members added in v1.4.0

func (g *LineString) Members() string

func (*LineString) NumPoints

func (g *LineString) NumPoints() int

func (*LineString) Rect

func (g *LineString) Rect() geometry.Rect

func (*LineString) Spatial

func (g *LineString) Spatial() Spatial

func (*LineString) String

func (g *LineString) String() string

func (*LineString) Valid

func (g *LineString) Valid() bool

func (*LineString) Within

func (g *LineString) Within(obj Object) bool

func (*LineString) WithinLine

func (g *LineString) WithinLine(line *geometry.Line) bool

func (*LineString) WithinPoint

func (g *LineString) WithinPoint(point geometry.Point) bool

func (*LineString) WithinPoly

func (g *LineString) WithinPoly(poly *geometry.Poly) bool

func (*LineString) WithinRect

func (g *LineString) WithinRect(rect geometry.Rect) bool

type MultiLineString

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

func NewMultiLineString

func NewMultiLineString(lines []*geometry.Line) *MultiLineString

func (*MultiLineString) AppendJSON

func (g *MultiLineString) AppendJSON(dst []byte) []byte

func (*MultiLineString) Base

func (g *MultiLineString) Base() []Object

func (*MultiLineString) Center

func (g *MultiLineString) Center() geometry.Point

func (*MultiLineString) Children

func (g *MultiLineString) Children() []Object

func (*MultiLineString) Contains

func (g *MultiLineString) Contains(obj Object) bool

func (*MultiLineString) Distance

func (g *MultiLineString) Distance(obj Object) float64

func (*MultiLineString) DistanceLine

func (g *MultiLineString) DistanceLine(line *geometry.Line) float64

func (*MultiLineString) DistancePoint

func (g *MultiLineString) DistancePoint(point geometry.Point) float64

func (*MultiLineString) DistancePoly

func (g *MultiLineString) DistancePoly(poly *geometry.Poly) float64

func (*MultiLineString) DistanceRect

func (g *MultiLineString) DistanceRect(rect geometry.Rect) float64

func (*MultiLineString) Empty

func (g *MultiLineString) Empty() bool

func (*MultiLineString) ForEach

func (g *MultiLineString) ForEach(iter func(geom Object) bool) bool

func (*MultiLineString) Indexed

func (g *MultiLineString) Indexed() bool

func (*MultiLineString) Intersects

func (g *MultiLineString) Intersects(obj Object) bool

func (*MultiLineString) IntersectsLine

func (g *MultiLineString) IntersectsLine(line *geometry.Line) bool

func (*MultiLineString) IntersectsPoint

func (g *MultiLineString) IntersectsPoint(point geometry.Point) bool

func (*MultiLineString) IntersectsPoly

func (g *MultiLineString) IntersectsPoly(poly *geometry.Poly) bool

func (*MultiLineString) IntersectsRect

func (g *MultiLineString) IntersectsRect(rect geometry.Rect) bool

func (*MultiLineString) JSON

func (g *MultiLineString) JSON() string

func (*MultiLineString) MarshalJSON added in v1.1.0

func (g *MultiLineString) MarshalJSON() ([]byte, error)

func (*MultiLineString) Members added in v1.4.0

func (g *MultiLineString) Members() string

func (*MultiLineString) NumPoints

func (g *MultiLineString) NumPoints() int

func (*MultiLineString) Rect

func (g *MultiLineString) Rect() geometry.Rect

func (*MultiLineString) Search

func (g *MultiLineString) Search(rect geometry.Rect, iter func(child Object) bool)

func (*MultiLineString) Spatial

func (g *MultiLineString) Spatial() Spatial

func (*MultiLineString) String

func (g *MultiLineString) String() string

func (*MultiLineString) Valid

func (g *MultiLineString) Valid() bool

func (*MultiLineString) Within

func (g *MultiLineString) Within(obj Object) bool

func (*MultiLineString) WithinLine

func (g *MultiLineString) WithinLine(line *geometry.Line) bool

func (*MultiLineString) WithinPoint

func (g *MultiLineString) WithinPoint(point geometry.Point) bool

func (*MultiLineString) WithinPoly

func (g *MultiLineString) WithinPoly(poly *geometry.Poly) bool

func (*MultiLineString) WithinRect

func (g *MultiLineString) WithinRect(rect geometry.Rect) bool

type MultiPoint

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

func NewMultiPoint

func NewMultiPoint(points []geometry.Point) *MultiPoint

func (*MultiPoint) AppendJSON

func (g *MultiPoint) AppendJSON(dst []byte) []byte

func (*MultiPoint) Base

func (g *MultiPoint) Base() []Object

func (*MultiPoint) Center

func (g *MultiPoint) Center() geometry.Point

func (*MultiPoint) Children

func (g *MultiPoint) Children() []Object

func (*MultiPoint) Contains

func (g *MultiPoint) Contains(obj Object) bool

func (*MultiPoint) Distance

func (g *MultiPoint) Distance(obj Object) float64

func (*MultiPoint) DistanceLine

func (g *MultiPoint) DistanceLine(line *geometry.Line) float64

func (*MultiPoint) DistancePoint

func (g *MultiPoint) DistancePoint(point geometry.Point) float64

func (*MultiPoint) DistancePoly

func (g *MultiPoint) DistancePoly(poly *geometry.Poly) float64

func (*MultiPoint) DistanceRect

func (g *MultiPoint) DistanceRect(rect geometry.Rect) float64

func (*MultiPoint) Empty

func (g *MultiPoint) Empty() bool

func (*MultiPoint) ForEach

func (g *MultiPoint) ForEach(iter func(geom Object) bool) bool

func (*MultiPoint) Indexed

func (g *MultiPoint) Indexed() bool

func (*MultiPoint) Intersects

func (g *MultiPoint) Intersects(obj Object) bool

func (*MultiPoint) IntersectsLine

func (g *MultiPoint) IntersectsLine(line *geometry.Line) bool

func (*MultiPoint) IntersectsPoint

func (g *MultiPoint) IntersectsPoint(point geometry.Point) bool

func (*MultiPoint) IntersectsPoly

func (g *MultiPoint) IntersectsPoly(poly *geometry.Poly) bool

func (*MultiPoint) IntersectsRect

func (g *MultiPoint) IntersectsRect(rect geometry.Rect) bool

func (*MultiPoint) JSON

func (g *MultiPoint) JSON() string

func (*MultiPoint) MarshalJSON added in v1.1.0

func (g *MultiPoint) MarshalJSON() ([]byte, error)

func (*MultiPoint) Members added in v1.4.0

func (g *MultiPoint) Members() string

func (*MultiPoint) NumPoints

func (g *MultiPoint) NumPoints() int

func (*MultiPoint) Rect

func (g *MultiPoint) Rect() geometry.Rect

func (*MultiPoint) Search

func (g *MultiPoint) Search(rect geometry.Rect, iter func(child Object) bool)

func (*MultiPoint) Spatial

func (g *MultiPoint) Spatial() Spatial

func (*MultiPoint) String

func (g *MultiPoint) String() string

func (*MultiPoint) Valid

func (g *MultiPoint) Valid() bool

func (*MultiPoint) Within

func (g *MultiPoint) Within(obj Object) bool

func (*MultiPoint) WithinLine

func (g *MultiPoint) WithinLine(line *geometry.Line) bool

func (*MultiPoint) WithinPoint

func (g *MultiPoint) WithinPoint(point geometry.Point) bool

func (*MultiPoint) WithinPoly

func (g *MultiPoint) WithinPoly(poly *geometry.Poly) bool

func (*MultiPoint) WithinRect

func (g *MultiPoint) WithinRect(rect geometry.Rect) bool

type MultiPolygon

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

func NewMultiPolygon

func NewMultiPolygon(polys []*geometry.Poly) *MultiPolygon

func (*MultiPolygon) AppendJSON

func (g *MultiPolygon) AppendJSON(dst []byte) []byte

func (*MultiPolygon) Base

func (g *MultiPolygon) Base() []Object

func (*MultiPolygon) Center

func (g *MultiPolygon) Center() geometry.Point

func (*MultiPolygon) Children

func (g *MultiPolygon) Children() []Object

func (*MultiPolygon) Contains

func (g *MultiPolygon) Contains(obj Object) bool

func (*MultiPolygon) Distance

func (g *MultiPolygon) Distance(obj Object) float64

func (*MultiPolygon) DistanceLine

func (g *MultiPolygon) DistanceLine(line *geometry.Line) float64

func (*MultiPolygon) DistancePoint

func (g *MultiPolygon) DistancePoint(point geometry.Point) float64

func (*MultiPolygon) DistancePoly

func (g *MultiPolygon) DistancePoly(poly *geometry.Poly) float64

func (*MultiPolygon) DistanceRect

func (g *MultiPolygon) DistanceRect(rect geometry.Rect) float64

func (*MultiPolygon) Empty

func (g *MultiPolygon) Empty() bool

func (*MultiPolygon) ForEach

func (g *MultiPolygon) ForEach(iter func(geom Object) bool) bool

func (*MultiPolygon) Indexed

func (g *MultiPolygon) Indexed() bool

func (*MultiPolygon) Intersects

func (g *MultiPolygon) Intersects(obj Object) bool

func (*MultiPolygon) IntersectsLine

func (g *MultiPolygon) IntersectsLine(line *geometry.Line) bool

func (*MultiPolygon) IntersectsPoint

func (g *MultiPolygon) IntersectsPoint(point geometry.Point) bool

func (*MultiPolygon) IntersectsPoly

func (g *MultiPolygon) IntersectsPoly(poly *geometry.Poly) bool

func (*MultiPolygon) IntersectsRect

func (g *MultiPolygon) IntersectsRect(rect geometry.Rect) bool

func (*MultiPolygon) JSON

func (g *MultiPolygon) JSON() string

func (*MultiPolygon) MarshalJSON added in v1.1.0

func (g *MultiPolygon) MarshalJSON() ([]byte, error)

func (*MultiPolygon) Members added in v1.4.0

func (g *MultiPolygon) Members() string

func (*MultiPolygon) NumPoints

func (g *MultiPolygon) NumPoints() int

func (*MultiPolygon) Rect

func (g *MultiPolygon) Rect() geometry.Rect

func (*MultiPolygon) Search

func (g *MultiPolygon) Search(rect geometry.Rect, iter func(child Object) bool)

func (*MultiPolygon) Spatial

func (g *MultiPolygon) Spatial() Spatial

func (*MultiPolygon) String

func (g *MultiPolygon) String() string

func (*MultiPolygon) Valid

func (g *MultiPolygon) Valid() bool

func (*MultiPolygon) Within

func (g *MultiPolygon) Within(obj Object) bool

func (*MultiPolygon) WithinLine

func (g *MultiPolygon) WithinLine(line *geometry.Line) bool

func (*MultiPolygon) WithinPoint

func (g *MultiPolygon) WithinPoint(point geometry.Point) bool

func (*MultiPolygon) WithinPoly

func (g *MultiPolygon) WithinPoly(poly *geometry.Poly) bool

func (*MultiPolygon) WithinRect

func (g *MultiPolygon) WithinRect(rect geometry.Rect) bool

type Object

type Object interface {
	Empty() bool
	Valid() bool
	Rect() geometry.Rect
	Center() geometry.Point
	Contains(other Object) bool
	Within(other Object) bool
	Intersects(other Object) bool
	AppendJSON(dst []byte) []byte
	JSON() string
	String() string
	Distance(obj Object) float64
	NumPoints() int
	ForEach(iter func(geom Object) bool) bool
	Spatial() Spatial
	MarshalJSON() ([]byte, error)
	Members() string
}

Object is a GeoJSON type

func Parse

func Parse(data string, opts *ParseOptions) (Object, error)

Parse a GeoJSON object

type ParseOptions

type ParseOptions struct {
	// IndexChildren option will cause the object to index their children
	// objects when the number of children is greater than or equal to the
	// provided value. Setting this value to 0 will disable indexing.
	// The default is 64.
	IndexChildren int
	// IndexGeometry option will cause the object to index it's geometry
	// when the number of points in it's base polygon or linestring is greater
	// that or equal to the provided value. Setting this value to 0 will
	// disable indexing.
	// The default is 64.
	IndexGeometry int
	// IndexGeometryKind is the kind of index implementation.
	// Default is QuadTreeCompressed
	IndexGeometryKind geometry.IndexKind
	// RequireValid option cause parse to fail when a geojson object is invalid.
	RequireValid bool
	// AllowSimplePoints options will force to parse to return the SimplePoint
	// type when a geojson point only consists of an 2D x/y coord and no extra
	// json members.
	AllowSimplePoints bool
	// DisableCircleType disables the special Circle syntax that is unique to
	// only Tile38.
	DisableCircleType bool
	// AllowRects options will force to parse and return the Rect type when a
	// geojson polygon only consists of a perfect rectangle, where there are
	// exactly 5 points with the first point being the min x/y and the
	// following point winding counter clockwise creating a closed rectangle.
	AllowRects bool
}

type Point

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

func NewPoint

func NewPoint(point geometry.Point) *Point

func NewPointZ

func NewPointZ(point geometry.Point, z float64) *Point

func (*Point) AppendJSON

func (g *Point) AppendJSON(dst []byte) []byte

func (*Point) Base

func (g *Point) Base() geometry.Point

func (*Point) Center

func (g *Point) Center() geometry.Point

func (*Point) Contains

func (g *Point) Contains(obj Object) bool

func (*Point) Distance

func (g *Point) Distance(obj Object) float64

func (*Point) DistanceLine

func (g *Point) DistanceLine(line *geometry.Line) float64

func (*Point) DistancePoint

func (g *Point) DistancePoint(point geometry.Point) float64

func (*Point) DistancePoly

func (g *Point) DistancePoly(poly *geometry.Poly) float64

func (*Point) DistanceRect

func (g *Point) DistanceRect(rect geometry.Rect) float64

func (*Point) Empty

func (g *Point) Empty() bool

func (*Point) ForEach

func (g *Point) ForEach(iter func(geom Object) bool) bool

func (*Point) Intersects

func (g *Point) Intersects(obj Object) bool

func (*Point) IntersectsLine

func (g *Point) IntersectsLine(line *geometry.Line) bool

func (*Point) IntersectsPoint

func (g *Point) IntersectsPoint(point geometry.Point) bool

func (*Point) IntersectsPoly

func (g *Point) IntersectsPoly(poly *geometry.Poly) bool

func (*Point) IntersectsRect

func (g *Point) IntersectsRect(rect geometry.Rect) bool

func (*Point) IsSimple added in v1.3.6

func (g *Point) IsSimple() bool

IsSimple returns true if the Point can be converted to a SimplePoint

func (*Point) JSON

func (g *Point) JSON() string

func (*Point) MarshalJSON added in v1.1.0

func (g *Point) MarshalJSON() ([]byte, error)

func (*Point) Members added in v1.4.0

func (g *Point) Members() string

func (*Point) NumPoints

func (g *Point) NumPoints() int

func (*Point) Rect

func (g *Point) Rect() geometry.Rect

func (*Point) Spatial

func (g *Point) Spatial() Spatial

func (*Point) String

func (g *Point) String() string

func (*Point) Valid

func (g *Point) Valid() bool

func (*Point) Within

func (g *Point) Within(obj Object) bool

func (*Point) WithinLine

func (g *Point) WithinLine(line *geometry.Line) bool

func (*Point) WithinPoint

func (g *Point) WithinPoint(point geometry.Point) bool

func (*Point) WithinPoly

func (g *Point) WithinPoly(poly *geometry.Poly) bool

func (*Point) WithinRect

func (g *Point) WithinRect(rect geometry.Rect) bool

func (*Point) Z

func (g *Point) Z() float64

type Polygon

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

func NewPolygon

func NewPolygon(poly *geometry.Poly) *Polygon

func (*Polygon) AppendJSON

func (g *Polygon) AppendJSON(dst []byte) []byte

func (*Polygon) Base

func (g *Polygon) Base() *geometry.Poly

func (*Polygon) Center

func (g *Polygon) Center() geometry.Point

func (*Polygon) Contains

func (g *Polygon) Contains(obj Object) bool

func (*Polygon) Distance

func (g *Polygon) Distance(obj Object) float64

func (*Polygon) DistanceLine

func (g *Polygon) DistanceLine(line *geometry.Line) float64

func (*Polygon) DistancePoint

func (g *Polygon) DistancePoint(point geometry.Point) float64

func (*Polygon) DistancePoly

func (g *Polygon) DistancePoly(poly *geometry.Poly) float64

func (*Polygon) DistanceRect

func (g *Polygon) DistanceRect(rect geometry.Rect) float64

func (*Polygon) Empty

func (g *Polygon) Empty() bool

func (*Polygon) ForEach

func (g *Polygon) ForEach(iter func(geom Object) bool) bool

func (*Polygon) HasExtra added in v1.2.1

func (g *Polygon) HasExtra() bool

func (*Polygon) Intersects

func (g *Polygon) Intersects(obj Object) bool

func (*Polygon) IntersectsLine

func (g *Polygon) IntersectsLine(line *geometry.Line) bool

func (*Polygon) IntersectsPoint

func (g *Polygon) IntersectsPoint(point geometry.Point) bool

func (*Polygon) IntersectsPoly

func (g *Polygon) IntersectsPoly(poly *geometry.Poly) bool

func (*Polygon) IntersectsRect

func (g *Polygon) IntersectsRect(rect geometry.Rect) bool

func (*Polygon) JSON

func (g *Polygon) JSON() string

func (*Polygon) MarshalJSON added in v1.1.0

func (g *Polygon) MarshalJSON() ([]byte, error)

func (*Polygon) Members added in v1.4.0

func (g *Polygon) Members() string

func (*Polygon) NumPoints

func (g *Polygon) NumPoints() int

func (*Polygon) Rect

func (g *Polygon) Rect() geometry.Rect

func (*Polygon) Spatial

func (g *Polygon) Spatial() Spatial

func (*Polygon) String

func (g *Polygon) String() string

func (*Polygon) Valid

func (g *Polygon) Valid() bool

func (*Polygon) Within

func (g *Polygon) Within(obj Object) bool

func (*Polygon) WithinLine

func (g *Polygon) WithinLine(line *geometry.Line) bool

func (*Polygon) WithinPoint

func (g *Polygon) WithinPoint(point geometry.Point) bool

func (*Polygon) WithinPoly

func (g *Polygon) WithinPoly(poly *geometry.Poly) bool

func (*Polygon) WithinRect

func (g *Polygon) WithinRect(rect geometry.Rect) bool

type Rect

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

func NewRect

func NewRect(rect geometry.Rect) *Rect

func (*Rect) AppendJSON

func (g *Rect) AppendJSON(dst []byte) []byte

func (*Rect) Base

func (g *Rect) Base() geometry.Rect

func (*Rect) Center

func (g *Rect) Center() geometry.Point

func (*Rect) Contains

func (g *Rect) Contains(obj Object) bool

func (*Rect) Distance

func (g *Rect) Distance(obj Object) float64

func (*Rect) DistanceLine

func (g *Rect) DistanceLine(line *geometry.Line) float64

func (*Rect) DistancePoint

func (g *Rect) DistancePoint(point geometry.Point) float64

func (*Rect) DistancePoly

func (g *Rect) DistancePoly(poly *geometry.Poly) float64

func (*Rect) DistanceRect

func (g *Rect) DistanceRect(rect geometry.Rect) float64

func (*Rect) Empty

func (g *Rect) Empty() bool

func (*Rect) ForEach

func (g *Rect) ForEach(iter func(geom Object) bool) bool

func (*Rect) Intersects

func (g *Rect) Intersects(obj Object) bool

func (*Rect) IntersectsLine

func (g *Rect) IntersectsLine(line *geometry.Line) bool

func (*Rect) IntersectsPoint

func (g *Rect) IntersectsPoint(point geometry.Point) bool

func (*Rect) IntersectsPoly

func (g *Rect) IntersectsPoly(poly *geometry.Poly) bool

func (*Rect) IntersectsRect

func (g *Rect) IntersectsRect(rect geometry.Rect) bool

func (*Rect) JSON

func (g *Rect) JSON() string

func (*Rect) MarshalJSON added in v1.1.0

func (g *Rect) MarshalJSON() ([]byte, error)

func (*Rect) Members added in v1.4.0

func (g *Rect) Members() string

func (*Rect) NumPoints

func (g *Rect) NumPoints() int

func (*Rect) Polygon added in v1.4.3

func (g *Rect) Polygon() Object

Polygon returns the Rect as a GeoJSON Polygon.

func (*Rect) Rect

func (g *Rect) Rect() geometry.Rect

func (*Rect) Spatial

func (g *Rect) Spatial() Spatial

func (*Rect) String

func (g *Rect) String() string

func (*Rect) Valid

func (g *Rect) Valid() bool

func (*Rect) Within

func (g *Rect) Within(obj Object) bool

func (*Rect) WithinLine

func (g *Rect) WithinLine(line *geometry.Line) bool

func (*Rect) WithinPoint

func (g *Rect) WithinPoint(point geometry.Point) bool

func (*Rect) WithinPoly

func (g *Rect) WithinPoly(poly *geometry.Poly) bool

func (*Rect) WithinRect

func (g *Rect) WithinRect(rect geometry.Rect) bool

type SimplePoint added in v1.1.1

type SimplePoint struct {
	geometry.Point
}

func NewSimplePoint added in v1.1.1

func NewSimplePoint(point geometry.Point) *SimplePoint

NewSimplePoint returns a new SimplePoint object.

func (*SimplePoint) AppendJSON added in v1.1.1

func (g *SimplePoint) AppendJSON(dst []byte) []byte

func (*SimplePoint) Base added in v1.1.1

func (g *SimplePoint) Base() geometry.Point

func (*SimplePoint) Center added in v1.1.1

func (g *SimplePoint) Center() geometry.Point

func (*SimplePoint) Contains added in v1.1.1

func (g *SimplePoint) Contains(obj Object) bool

func (*SimplePoint) Distance added in v1.1.1

func (g *SimplePoint) Distance(obj Object) float64

func (*SimplePoint) DistanceLine added in v1.1.1

func (g *SimplePoint) DistanceLine(line *geometry.Line) float64

func (*SimplePoint) DistancePoint added in v1.1.1

func (g *SimplePoint) DistancePoint(point geometry.Point) float64

func (*SimplePoint) DistancePoly added in v1.1.1

func (g *SimplePoint) DistancePoly(poly *geometry.Poly) float64

func (*SimplePoint) DistanceRect added in v1.1.1

func (g *SimplePoint) DistanceRect(rect geometry.Rect) float64

func (*SimplePoint) Empty added in v1.1.1

func (g *SimplePoint) Empty() bool

func (*SimplePoint) ForEach added in v1.1.1

func (g *SimplePoint) ForEach(iter func(geom Object) bool) bool

func (*SimplePoint) Intersects added in v1.1.1

func (g *SimplePoint) Intersects(obj Object) bool

func (*SimplePoint) IntersectsLine added in v1.1.1

func (g *SimplePoint) IntersectsLine(line *geometry.Line) bool

func (*SimplePoint) IntersectsPoint added in v1.1.1

func (g *SimplePoint) IntersectsPoint(point geometry.Point) bool

func (*SimplePoint) IntersectsPoly added in v1.1.1

func (g *SimplePoint) IntersectsPoly(poly *geometry.Poly) bool

func (*SimplePoint) IntersectsRect added in v1.1.1

func (g *SimplePoint) IntersectsRect(rect geometry.Rect) bool

func (*SimplePoint) JSON added in v1.1.1

func (g *SimplePoint) JSON() string

func (*SimplePoint) MarshalJSON added in v1.1.1

func (g *SimplePoint) MarshalJSON() ([]byte, error)

func (*SimplePoint) Members added in v1.4.0

func (g *SimplePoint) Members() string

func (*SimplePoint) NumPoints added in v1.1.1

func (g *SimplePoint) NumPoints() int

func (*SimplePoint) Rect added in v1.1.1

func (g *SimplePoint) Rect() geometry.Rect

func (*SimplePoint) Spatial added in v1.1.1

func (g *SimplePoint) Spatial() Spatial

func (*SimplePoint) String added in v1.1.1

func (g *SimplePoint) String() string

func (*SimplePoint) Valid added in v1.1.1

func (g *SimplePoint) Valid() bool

func (*SimplePoint) Within added in v1.1.1

func (g *SimplePoint) Within(obj Object) bool

func (*SimplePoint) WithinLine added in v1.1.1

func (g *SimplePoint) WithinLine(line *geometry.Line) bool

func (*SimplePoint) WithinPoint added in v1.1.1

func (g *SimplePoint) WithinPoint(point geometry.Point) bool

func (*SimplePoint) WithinPoly added in v1.1.1

func (g *SimplePoint) WithinPoly(poly *geometry.Poly) bool

func (*SimplePoint) WithinRect added in v1.1.1

func (g *SimplePoint) WithinRect(rect geometry.Rect) bool

type Spatial

type Spatial interface {
	WithinRect(rect geometry.Rect) bool
	WithinPoint(point geometry.Point) bool
	WithinLine(line *geometry.Line) bool
	WithinPoly(poly *geometry.Poly) bool
	IntersectsRect(rect geometry.Rect) bool
	IntersectsPoint(point geometry.Point) bool
	IntersectsLine(line *geometry.Line) bool
	IntersectsPoly(poly *geometry.Poly) bool
	DistanceRect(rect geometry.Rect) float64
	DistancePoint(point geometry.Point) float64
	DistanceLine(line *geometry.Line) float64
	DistancePoly(poly *geometry.Poly) float64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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