geo

package
v0.0.9-a Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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

func QuadKey

func QuadKey(c Coordinate, zoom uint) string

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)

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 {
	Geometry   []*Shape
	Type       string
	Properties map[string]interface{}
}

func MakeFeature

func MakeFeature(length int) *Feature

func NewFeature

func NewFeature(geometryType string, geometry ...*Shape) *Feature

func NewLineFeature

func NewLineFeature(geometry ...*Shape) *Feature

func NewPointFeature

func NewPointFeature(geometry ...*Shape) *Feature

func NewPolygonFeature

func NewPolygonFeature(geometry ...*Shape) *Feature

func (*Feature) AddShape

func (f *Feature) AddShape(s *Shape)

func (*Feature) Center

func (f *Feature) Center() (avg Coordinate)

func (*Feature) Tags

func (f *Feature) Tags(key string) string

type Fence

type Fence interface {
	Add(f *Feature)
	GetFeatures(f *Feature) []*Feature
	Size() int
}

type Rfence

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

func NewRfence

func NewRfence() *Rfence

func (*Rfence) Add

func (r *Rfence) Add(f *Feature)

func (*Rfence) Get

func (r *Rfence) Get(c Coordinate) []*Feature

func (*Rfence) Size

func (r *Rfence) Size() int

type Rnode

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

func (*Rnode) Bounds

func (n *Rnode) Bounds() *rtreego.Rect

implements rtree.Spatial

func (*Rnode) Feature

func (n *Rnode) Feature() *Feature

func (*Rnode) Value

func (n *Rnode) Value() interface{}

type Rtree

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

func NewRtree

func NewRtree() *Rtree

func (*Rtree) Contains

func (r *Rtree) Contains(c Coordinate) []*Rnode

func (*Rtree) Insert

func (r *Rtree) Insert(s *Shape, data interface{})

func (*Rtree) Intersections

func (r *Rtree) Intersections(q *Shape) []*Rnode

type Shape

type Shape struct {
	Coordinates []Coordinate
}

func MakeShape

func MakeShape(length int) *Shape

func NewShape

func NewShape(coords ...Coordinate) *Shape

func (*Shape) Add

func (s *Shape) Add(c ...Coordinate)

func (*Shape) Append

func (s *Shape) Append(o *Shape)

func (*Shape) BoundingBox

func (s *Shape) BoundingBox() Box

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 (s *Shape) IsClockwise() bool

func (*Shape) IsClosed

func (s *Shape) IsClosed() bool

Only shapes that contain an area can be closed (>3 Coordinates)

func (*Shape) Length

func (s *Shape) Length() int

Number of coordinates

func (*Shape) Reverse

func (s *Shape) Reverse()

func (*Shape) Tail

func (s *Shape) Tail() Coordinate

Directories

Path Synopsis
package tile_system is a collection of conversion utilities to go between geo/pixel/tile/quadkey space This package uses WGS84 coordinates and a mercator projection
package tile_system is a collection of conversion utilities to go between geo/pixel/tile/quadkey space This package uses WGS84 coordinates and a mercator projection

Jump to

Keyboard shortcuts

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