geojson

package module
v1.1.12 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: MIT Imports: 11 Imported by: 0

README

GeoJSON

Build Status 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,
}

DefaultParseOptions ...

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
}

Circle ...

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

AppendJSON ...

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

Distance ...

func (*Circle) Empty

func (g *Circle) Empty() bool

Empty ...

func (*Circle) ForEach

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

ForEach ...

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

JSON ...

func (*Circle) MarshalJSON added in v1.1.0

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

MarshalJSON ...

func (*Circle) Meters

func (g *Circle) Meters() float64

Meters returns the circle's radius

func (*Circle) NumPoints

func (g *Circle) NumPoints() int

NumPoints ...

func (*Circle) Primative added in v1.1.8

func (g *Circle) Primative() Object

Primative returns a primative GeoJSON object. Either a Polygon or Point.

func (*Circle) Rect

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

Rect ...

func (*Circle) Spatial

func (g *Circle) Spatial() Spatial

Spatial ...

func (*Circle) String

func (g *Circle) String() string

String ...

func (*Circle) Valid

func (g *Circle) Valid() bool

Valid ...

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{}

EmptySpatial ...

func (EmptySpatial) DistanceLine

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

DistanceLine ...

func (EmptySpatial) DistancePoint

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

DistancePoint ...

func (EmptySpatial) DistancePoly

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

DistancePoly ...

func (EmptySpatial) DistanceRect

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

DistanceRect ...

func (EmptySpatial) IntersectsLine

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

IntersectsLine ...

func (EmptySpatial) IntersectsPoint

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

IntersectsPoint ...

func (EmptySpatial) IntersectsPoly

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

IntersectsPoly ...

func (EmptySpatial) IntersectsRect

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

IntersectsRect ...

func (EmptySpatial) WithinLine

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

WithinLine ...

func (EmptySpatial) WithinPoint

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

WithinPoint ...

func (EmptySpatial) WithinPoly

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

WithinPoly ...

func (EmptySpatial) WithinRect

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

WithinRect ...

type Feature

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

Feature ...

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

AppendJSON ...

func (*Feature) Base

func (g *Feature) Base() Object

Base ...

func (*Feature) Center

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

Center ...

func (*Feature) Contains

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

Contains ...

func (*Feature) Distance

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

Distance ...

func (*Feature) DistanceLine

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

DistanceLine ...

func (*Feature) DistancePoint

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

DistancePoint ...

func (*Feature) DistancePoly

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

DistancePoly ...

func (*Feature) DistanceRect

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

DistanceRect ...

func (*Feature) Empty

func (g *Feature) Empty() bool

Empty ...

func (*Feature) ForEach

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

ForEach ...

func (*Feature) Intersects

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

Intersects ...

func (*Feature) IntersectsLine

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

IntersectsLine ...

func (*Feature) IntersectsPoint

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

IntersectsPoint ...

func (*Feature) IntersectsPoly

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

IntersectsPoly ...

func (*Feature) IntersectsRect

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

IntersectsRect ...

func (*Feature) JSON

func (g *Feature) JSON() string

JSON ...

func (*Feature) MarshalJSON added in v1.1.0

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

MarshalJSON ...

func (*Feature) Members

func (g *Feature) Members() string

Members ...

func (*Feature) NumPoints

func (g *Feature) NumPoints() int

NumPoints ...

func (*Feature) Rect

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

Rect ...

func (*Feature) Spatial

func (g *Feature) Spatial() Spatial

Spatial ...

func (*Feature) String

func (g *Feature) String() string

String ...

func (*Feature) Valid

func (g *Feature) Valid() bool

Valid ...

func (*Feature) Within

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

Within ...

func (*Feature) WithinLine

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

WithinLine ...

func (*Feature) WithinPoint

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

WithinPoint ...

func (*Feature) WithinPoly

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

WithinPoly ...

func (*Feature) WithinRect

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

WithinRect ...

type FeatureCollection

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

FeatureCollection ...

func NewFeatureCollection

func NewFeatureCollection(features []Object) *FeatureCollection

NewFeatureCollection ...

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

Base ...

func (*FeatureCollection) Center

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

Center ...

func (*FeatureCollection) Children

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

func (*FeatureCollection) Contains

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

Contains ...

func (*FeatureCollection) Distance

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

Distance ...

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

Empty ...

func (*FeatureCollection) ForEach

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

ForEach ...

func (*FeatureCollection) Indexed

func (g *FeatureCollection) Indexed() bool

func (*FeatureCollection) Intersects

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

Intersects ...

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

JSON ...

func (*FeatureCollection) MarshalJSON added in v1.1.0

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

MarshalJSON ...

func (*FeatureCollection) NumPoints

func (g *FeatureCollection) NumPoints() int

NumPoints ...

func (*FeatureCollection) Rect

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

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

String ...

func (*FeatureCollection) Valid

func (g *FeatureCollection) Valid() bool

Valid ...

func (*FeatureCollection) Within

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

Within ...

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
}

GeometryCollection ...

func NewGeometryCollection

func NewGeometryCollection(geometries []Object) *GeometryCollection

NewGeometryCollection ...

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

Base ...

func (*GeometryCollection) Center

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

Center ...

func (*GeometryCollection) Children

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

func (*GeometryCollection) Contains

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

Contains ...

func (*GeometryCollection) Distance

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

Distance ...

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

Empty ...

func (*GeometryCollection) ForEach

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

ForEach ...

func (*GeometryCollection) Indexed

func (g *GeometryCollection) Indexed() bool

func (*GeometryCollection) Intersects

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

Intersects ...

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

JSON ...

func (*GeometryCollection) MarshalJSON added in v1.1.0

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

MarshalJSON ...

func (*GeometryCollection) NumPoints

func (g *GeometryCollection) NumPoints() int

NumPoints ...

func (*GeometryCollection) Rect

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

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

String ...

func (*GeometryCollection) Valid

func (g *GeometryCollection) Valid() bool

Valid ...

func (*GeometryCollection) Within

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

Within ...

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
}

LineString ...

func NewLineString

func NewLineString(line *geometry.Line) *LineString

NewLineString ...

func (*LineString) AppendJSON

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

AppendJSON ...

func (*LineString) Base

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

Base ...

func (*LineString) Center

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

Center ...

func (*LineString) Contains

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

Contains ...

func (*LineString) Distance

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

Distance ...

func (*LineString) DistanceLine

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

DistanceLine ...

func (*LineString) DistancePoint

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

DistancePoint ...

func (*LineString) DistancePoly

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

DistancePoly ...

func (*LineString) DistanceRect

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

DistanceRect ..

func (*LineString) Empty

func (g *LineString) Empty() bool

Empty ...

func (*LineString) ForEach

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

ForEach ...

func (*LineString) Intersects

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

Intersects ...

func (*LineString) IntersectsLine

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

IntersectsLine ...

func (*LineString) IntersectsPoint

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

IntersectsPoint ...

func (*LineString) IntersectsPoly

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

IntersectsPoly ...

func (*LineString) IntersectsRect

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

IntersectsRect ...

func (*LineString) JSON

func (g *LineString) JSON() string

JSON ...

func (*LineString) MarshalJSON added in v1.1.0

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

MarshalJSON ...

func (*LineString) NumPoints

func (g *LineString) NumPoints() int

NumPoints ...

func (*LineString) Rect

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

Rect ...

func (*LineString) Spatial

func (g *LineString) Spatial() Spatial

Spatial ...

func (*LineString) String

func (g *LineString) String() string

String ...

func (*LineString) Valid

func (g *LineString) Valid() bool

Valid ...

func (*LineString) Within

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

Within ...

func (*LineString) WithinLine

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

WithinLine ...

func (*LineString) WithinPoint

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

WithinPoint ...

func (*LineString) WithinPoly

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

WithinPoly ...

func (*LineString) WithinRect

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

WithinRect ...

type MultiLineString

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

MultiLineString ...

func NewMultiLineString

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

NewMultiLineString ...

func (*MultiLineString) AppendJSON

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

AppendJSON ...

func (*MultiLineString) Base

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

Base ...

func (*MultiLineString) Center

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

Center ...

func (*MultiLineString) Children

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

func (*MultiLineString) Contains

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

Contains ...

func (*MultiLineString) Distance

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

Distance ...

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

Empty ...

func (*MultiLineString) ForEach

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

ForEach ...

func (*MultiLineString) Indexed

func (g *MultiLineString) Indexed() bool

func (*MultiLineString) Intersects

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

Intersects ...

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

JSON ...

func (*MultiLineString) MarshalJSON added in v1.1.0

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

MarshalJSON ...

func (*MultiLineString) NumPoints

func (g *MultiLineString) NumPoints() int

NumPoints ...

func (*MultiLineString) Rect

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

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

String ...

func (*MultiLineString) Valid

func (g *MultiLineString) Valid() bool

Valid ...

func (*MultiLineString) Within

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

Within ...

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
}

MultiPoint ...

func NewMultiPoint

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

NewMultiPoint ...

func (*MultiPoint) AppendJSON

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

AppendJSON ...

func (*MultiPoint) Base

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

Base ...

func (*MultiPoint) Center

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

Center ...

func (*MultiPoint) Children

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

func (*MultiPoint) Contains

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

Contains ...

func (*MultiPoint) Distance

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

Distance ...

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

Empty ...

func (*MultiPoint) ForEach

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

ForEach ...

func (*MultiPoint) Indexed

func (g *MultiPoint) Indexed() bool

func (*MultiPoint) Intersects

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

Intersects ...

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

JSON ...

func (*MultiPoint) MarshalJSON added in v1.1.0

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

MarshalJSON ...

func (*MultiPoint) NumPoints

func (g *MultiPoint) NumPoints() int

NumPoints ...

func (*MultiPoint) Rect

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

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

String ...

func (*MultiPoint) Valid

func (g *MultiPoint) Valid() bool

Valid ...

func (*MultiPoint) Within

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

Within ...

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
}

MultiPolygon ...

func NewMultiPolygon

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

NewMultiPolygon ...

func (*MultiPolygon) AppendJSON

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

AppendJSON ...

func (*MultiPolygon) Base

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

Base ...

func (*MultiPolygon) Center

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

Center ...

func (*MultiPolygon) Children

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

func (*MultiPolygon) Contains

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

Contains ...

func (*MultiPolygon) Distance

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

Distance ...

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

Empty ...

func (*MultiPolygon) ForEach

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

ForEach ...

func (*MultiPolygon) Indexed

func (g *MultiPolygon) Indexed() bool

func (*MultiPolygon) Intersects

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

Intersects ...

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

JSON ...

func (*MultiPolygon) MarshalJSON added in v1.1.0

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

MarshalJSON ...

func (*MultiPolygon) NumPoints

func (g *MultiPolygon) NumPoints() int

NumPoints ...

func (*MultiPolygon) Rect

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

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

String ...

func (*MultiPolygon) Valid

func (g *MultiPolygon) Valid() bool

Valid ...

func (*MultiPolygon) Within

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

Within ...

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)
}

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
}

ParseOptions ...

type Point

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

Point ...

func NewPoint

func NewPoint(point geometry.Point) *Point

NewPoint ...

func NewPointZ

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

NewPointZ ...

func (*Point) AppendJSON

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

AppendJSON ...

func (*Point) Base

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

Base ...

func (*Point) Center

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

Center ...

func (*Point) Contains

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

Contains ...

func (*Point) Distance

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

Distance ...

func (*Point) DistanceLine

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

DistanceLine ...

func (*Point) DistancePoint

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

DistancePoint ...

func (*Point) DistancePoly

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

DistancePoly ...

func (*Point) DistanceRect

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

DistanceRect ...

func (*Point) Empty

func (g *Point) Empty() bool

Empty ...

func (*Point) ForEach

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

ForEach ...

func (*Point) Intersects

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

Intersects ...

func (*Point) IntersectsLine

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

IntersectsLine ...

func (*Point) IntersectsPoint

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

IntersectsPoint ...

func (*Point) IntersectsPoly

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

IntersectsPoly ...

func (*Point) IntersectsRect

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

IntersectsRect ...

func (*Point) JSON

func (g *Point) JSON() string

JSON ...

func (*Point) MarshalJSON added in v1.1.0

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

MarshalJSON ...

func (*Point) NumPoints

func (g *Point) NumPoints() int

NumPoints ...

func (*Point) Rect

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

Rect ...

func (*Point) Spatial

func (g *Point) Spatial() Spatial

Spatial ...

func (*Point) String

func (g *Point) String() string

String ...

func (*Point) Valid

func (g *Point) Valid() bool

Valid ...

func (*Point) Within

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

Within ...

func (*Point) WithinLine

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

WithinLine ...

func (*Point) WithinPoint

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

WithinPoint ...

func (*Point) WithinPoly

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

WithinPoly ...

func (*Point) WithinRect

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

WithinRect ...

func (*Point) Z

func (g *Point) Z() float64

Z ...

type Polygon

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

Polygon ...

func NewPolygon

func NewPolygon(poly *geometry.Poly) *Polygon

NewPolygon ...

func (*Polygon) AppendJSON

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

AppendJSON ...

func (*Polygon) Base

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

Base ...

func (*Polygon) Center

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

Center ...

func (*Polygon) Contains

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

Contains ...

func (*Polygon) Distance

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

Distance ...

func (*Polygon) DistanceLine

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

DistanceLine ...

func (*Polygon) DistancePoint

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

DistancePoint ...

func (*Polygon) DistancePoly

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

DistancePoly ...

func (*Polygon) DistanceRect

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

DistanceRect ...

func (*Polygon) Empty

func (g *Polygon) Empty() bool

Empty ...

func (*Polygon) ForEach

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

ForEach ...

func (*Polygon) Intersects

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

Intersects ...

func (*Polygon) IntersectsLine

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

IntersectsLine ...

func (*Polygon) IntersectsPoint

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

IntersectsPoint ...

func (*Polygon) IntersectsPoly

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

IntersectsPoly ...

func (*Polygon) IntersectsRect

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

IntersectsRect ...

func (*Polygon) JSON

func (g *Polygon) JSON() string

JSON ...

func (*Polygon) MarshalJSON added in v1.1.0

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

MarshalJSON ...

func (*Polygon) NumPoints

func (g *Polygon) NumPoints() int

NumPoints ...

func (*Polygon) Rect

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

Rect ...

func (*Polygon) Spatial

func (g *Polygon) Spatial() Spatial

Spatial ...

func (*Polygon) String

func (g *Polygon) String() string

String ...

func (*Polygon) Valid

func (g *Polygon) Valid() bool

Valid ...

func (*Polygon) Within

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

Within ...

func (*Polygon) WithinLine

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

WithinLine ...

func (*Polygon) WithinPoint

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

WithinPoint ...

func (*Polygon) WithinPoly

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

WithinPoly ...

func (*Polygon) WithinRect

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

WithinRect ...

type Rect

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

Rect ...

func NewRect

func NewRect(rect geometry.Rect) *Rect

NewRect ...

func (*Rect) AppendJSON

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

AppendJSON ...

func (*Rect) Base

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

Base ...

func (*Rect) Center

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

Center ...

func (*Rect) Contains

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

Contains ...

func (*Rect) Distance

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

Distance ...

func (*Rect) DistanceLine

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

DistanceLine ...

func (*Rect) DistancePoint

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

DistancePoint ...

func (*Rect) DistancePoly

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

DistancePoly ...

func (*Rect) DistanceRect

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

DistanceRect ...

func (*Rect) Empty

func (g *Rect) Empty() bool

Empty ...

func (*Rect) ForEach

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

ForEach ...

func (*Rect) Intersects

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

Intersects ...

func (*Rect) IntersectsLine

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

IntersectsLine ...

func (*Rect) IntersectsPoint

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

IntersectsPoint ...

func (*Rect) IntersectsPoly

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

IntersectsPoly ...

func (*Rect) IntersectsRect

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

IntersectsRect ...

func (*Rect) JSON

func (g *Rect) JSON() string

JSON ...

func (*Rect) MarshalJSON added in v1.1.0

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

MarshalJSON ...

func (*Rect) NumPoints

func (g *Rect) NumPoints() int

NumPoints ...

func (*Rect) Rect

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

Rect ...

func (*Rect) Spatial

func (g *Rect) Spatial() Spatial

Spatial ...

func (*Rect) String

func (g *Rect) String() string

String ...

func (*Rect) Valid

func (g *Rect) Valid() bool

Valid ...

func (*Rect) Within

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

Within ...

func (*Rect) WithinLine

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

WithinLine ...

func (*Rect) WithinPoint

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

WithinPoint ...

func (*Rect) WithinPoly

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

WithinPoly ...

func (*Rect) WithinRect

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

WithinRect ...

type SimplePoint added in v1.1.1

type SimplePoint struct {
	geometry.Point
}

SimplePoint ...

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

AppendJSON ...

func (*SimplePoint) Base added in v1.1.1

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

Base ...

func (*SimplePoint) Center added in v1.1.1

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

Center ...

func (*SimplePoint) Contains added in v1.1.1

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

Contains ...

func (*SimplePoint) Distance added in v1.1.1

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

Distance ...

func (*SimplePoint) DistanceLine added in v1.1.1

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

DistanceLine ...

func (*SimplePoint) DistancePoint added in v1.1.1

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

DistancePoint ...

func (*SimplePoint) DistancePoly added in v1.1.1

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

DistancePoly ...

func (*SimplePoint) DistanceRect added in v1.1.1

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

DistanceRect ...

func (*SimplePoint) Empty added in v1.1.1

func (g *SimplePoint) Empty() bool

Empty ...

func (*SimplePoint) ForEach added in v1.1.1

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

ForEach ...

func (*SimplePoint) Intersects added in v1.1.1

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

Intersects ...

func (*SimplePoint) IntersectsLine added in v1.1.1

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

IntersectsLine ...

func (*SimplePoint) IntersectsPoint added in v1.1.1

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

IntersectsPoint ...

func (*SimplePoint) IntersectsPoly added in v1.1.1

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

IntersectsPoly ...

func (*SimplePoint) IntersectsRect added in v1.1.1

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

IntersectsRect ...

func (*SimplePoint) JSON added in v1.1.1

func (g *SimplePoint) JSON() string

JSON ...

func (*SimplePoint) MarshalJSON added in v1.1.1

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

MarshalJSON ...

func (*SimplePoint) NumPoints added in v1.1.1

func (g *SimplePoint) NumPoints() int

NumPoints ...

func (*SimplePoint) Rect added in v1.1.1

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

Rect ...

func (*SimplePoint) Spatial added in v1.1.1

func (g *SimplePoint) Spatial() Spatial

Spatial ...

func (*SimplePoint) String added in v1.1.1

func (g *SimplePoint) String() string

String ...

func (*SimplePoint) Valid added in v1.1.1

func (g *SimplePoint) Valid() bool

Valid ...

func (*SimplePoint) Within added in v1.1.1

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

Within ...

func (*SimplePoint) WithinLine added in v1.1.1

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

WithinLine ...

func (*SimplePoint) WithinPoint added in v1.1.1

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

WithinPoint ...

func (*SimplePoint) WithinPoly added in v1.1.1

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

WithinPoly ...

func (*SimplePoint) WithinRect added in v1.1.1

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

WithinRect ...

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
}

Spatial ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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