Documentation
¶
Index ¶
- Constants
- Variables
- func QuadKey(c Coordinate, zoom int) tiles.Quadkey
- func UnmarshalGeojsonFeature(raw string) (feature *geojson.Feature, err error)
- type Box
- type BruteFence
- type Coordinate
- func (c Coordinate) Difference(o Coordinate) (d Coordinate)
- func (cd Coordinate) Distance(od Coordinate) float64
- func (c Coordinate) String() string
- func (c Coordinate) ToRad() Coordinate
- func (c Coordinate) ToTile(zoom int) (tile tiles.Tile)
- func (c Coordinate) X() float64
- func (c Coordinate) Y() float64
- type Feature
- func GeojsonFeatureAdapter(gj *geojson.Feature) (feature *Feature, err error)
- func MakeFeature(length int) *Feature
- func NewFeature(geometryType string, geometry ...*Shape) *Feature
- func NewLineFeature(geometry ...*Shape) *Feature
- func NewPointFeature(geometry ...*Shape) *Feature
- func NewPolygonFeature(geometry ...*Shape) *Feature
- type Fence
- type GeojsonSource
- type Rfence
- type Rnode
- type Rtree
- type Shape
- func (s *Shape) Add(c ...Coordinate)
- func (s *Shape) Append(o *Shape)
- func (s *Shape) BoundingBox() Box
- func (s *Shape) Contains(c Coordinate) bool
- func (s *Shape) Edges() <-chan []Coordinate
- func (s *Shape) Head() Coordinate
- func (s *Shape) IsClockwise() bool
- func (s *Shape) IsClosed() bool
- func (s *Shape) Length() int
- func (s *Shape) Reverse()
- func (s *Shape) Tail() Coordinate
Constants ¶
View Source
const ( EarthRad = 6372800 //meters RadToDeg = 180 / math.Pi DegToRad = math.Pi / 180 )
View Source
const ( PolygonFeature = "polygon" LineFeature = "line" PointFeature = "point" )
Variables ¶
View Source
var ( RtreeMinChildren = 25 RtreeMaxChildren = 50 )
Functions ¶
Types ¶
type Box ¶
type Box struct {
// contains filtered or unexported fields
}
func NewBox ¶
func NewBox(min, max Coordinate) (box Box, err error)
func (Box) Contains ¶
func (b Box) Contains(coords ...Coordinate) (in bool)
func (Box) NorthEast ¶
func (b Box) NorthEast() Coordinate
func (Box) SouthWest ¶
func (b Box) SouthWest() Coordinate
type BruteFence ¶
type BruteFence struct {
// contains filtered or unexported fields
}
func NewBruteFence ¶
func NewBruteFence() *BruteFence
func (*BruteFence) Add ¶
func (b *BruteFence) Add(f *Feature)
func (*BruteFence) Get ¶
func (b *BruteFence) Get(c Coordinate) []*Feature
func (*BruteFence) Size ¶
func (b *BruteFence) Size() int
type Coordinate ¶
type Coordinate struct {
Lat, Lon float64
}
func (Coordinate) Difference ¶
func (c Coordinate) Difference(o Coordinate) (d Coordinate)
func (Coordinate) Distance ¶
func (cd Coordinate) Distance(od Coordinate) float64
Distance between coordinates in meters
func (Coordinate) String ¶
func (c Coordinate) String() string
func (Coordinate) ToRad ¶
func (c Coordinate) ToRad() Coordinate
func (Coordinate) X ¶
func (c Coordinate) X() float64
func (Coordinate) Y ¶
func (c Coordinate) Y() float64
type Feature ¶
type Feature struct { ID interface{} Geometry []*Shape Type string Properties map[string]interface{} }
func GeojsonFeatureAdapter ¶
Flatten all the points of a feature into single list. This can hel in identifying which tiles are going to be created
func MakeFeature ¶
func NewFeature ¶
func NewLineFeature ¶
func NewPointFeature ¶
func NewPolygonFeature ¶
func (*Feature) Center ¶
func (f *Feature) Center() (avg Coordinate)
func (*Feature) Contains ¶
func (f *Feature) Contains(c Coordinate) bool
Only checks as exterior ring TODO account for interior rings
type GeojsonSource ¶
type GeojsonSource struct {
// contains filtered or unexported fields
}
func NewGeojsonSource ¶
func NewGeojsonSource(path string, filter []string) *GeojsonSource
func (*GeojsonSource) Publish ¶
func (gj *GeojsonSource) Publish() (features chan *Feature, err error)
type Rfence ¶
type Rfence struct {
// contains filtered or unexported fields
}
func (*Rfence) Get ¶
func (r *Rfence) Get(c Coordinate) []*Feature
type Rtree ¶
type Rtree struct {
// contains filtered or unexported fields
}
func (*Rtree) Contains ¶
func (r *Rtree) Contains(c Coordinate) []*Rnode
func (*Rtree) Intersections ¶
type Shape ¶
type Shape struct {
Coordinates []Coordinate
}
func NewShape ¶
func NewShape(coords ...Coordinate) *Shape
func (*Shape) Add ¶
func (s *Shape) Add(c ...Coordinate)
func (*Shape) BoundingBox ¶
func (*Shape) Contains ¶
func (s *Shape) Contains(c Coordinate) bool
func (*Shape) Edges ¶
func (s *Shape) Edges() <-chan []Coordinate
func (*Shape) Head ¶
func (s *Shape) Head() Coordinate
func (*Shape) IsClockwise ¶
func (*Shape) Tail ¶
func (s *Shape) Tail() Coordinate
Source Files
¶
Click to show internal directories.
Click to hide internal directories.