geo

package
v0.0.0-...-659ce9b Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EarthInchesCircumference = 1577727360
	EarthMetersCircumference = 40074274.944
	EarthKmCircumference     = 40074.274944

	TwoPi = (2 * math.Pi)

	EarthInchRadius  = EarthInchesCircumference / TwoPi
	EarthMeterRadius = EarthMetersCircumference / TwoPi
	EarthKmRadius    = EarthKmCircumference / TwoPi

	Meters Distance = 1.0
	Inches Distance = 39.3701
	Km     Distance = 1000.0
)

Variables

This section is empty.

Functions

func AngleFromDistance

func AngleFromDistance(d Distance) s1.Angle

func CapAroundPoint

func CapAroundPoint(p s2.Point, d Distance) s2.Cap

func LatLng

func LatLng(lat, lng float64) s2.LatLng

func PointsFromLatLngs

func PointsFromLatLngs(latlngs []s2.LatLng) []s2.Point

func RegisterType

func RegisterType(v interface{})

Types

type Distance

type Distance float64

func (Distance) Inches

func (d Distance) Inches() float64

func (Distance) Km

func (d Distance) Km() float64

func (Distance) Meters

func (d Distance) Meters() float64

type EnumGeo

type EnumGeo interface {
	Close()
	Next() (item *RegionItem, has bool)
}

type ID

type ID [8]byte

func NewID

func NewID(latitude, longitude float64) ID

type RangeGeo

type RangeGeo struct {
	Min, Max s2.LatLng
}

func (RangeGeo) MaxID

func (r RangeGeo) MaxID() uint64

func (RangeGeo) MinID

func (r RangeGeo) MinID() uint64

type Region

type Region struct {
	Pts []s2.Point
	V   interface{}
	// contains filtered or unexported fields
}

func UnmarshalItem

func UnmarshalItem(bb []byte) (item *Region, err error)

func (*Region) Loop

func (this *Region) Loop() *s2.Loop

func (*Region) Marshal

func (this *Region) Marshal() (bb []byte, err error)

type RegionItem

type RegionItem struct {
	*Region
	Item
}

type SpatialGeo

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

func NewGeo

func NewGeo(opts ...spatial.Options) (o *SpatialGeo, err error)

func (*SpatialGeo) AddRegion

func (this *SpatialGeo) AddRegion(id []byte, value interface{}, locs []s2.LatLng) error

func (*SpatialGeo) Around

func (this *SpatialGeo) Around(lat, lng float64, d Distance) EnumGeo

func (*SpatialGeo) AsDebug

func (this *SpatialGeo) AsDebug() *spatial.Debugger

func (*SpatialGeo) Close

func (this *SpatialGeo) Close()

func (*SpatialGeo) Contains

func (this *SpatialGeo) Contains(lat, lng float64) EnumGeo

func (*SpatialGeo) ContainsRange

func (this *SpatialGeo) ContainsRange(r RangeGeo) EnumGeo

func (SpatialGeo) DbPath

func (this SpatialGeo) DbPath() string

func (*SpatialGeo) FlushExt

func (this *SpatialGeo) FlushExt() error

func (*SpatialGeo) GetExtInfo

func (this *SpatialGeo) GetExtInfo(category uint8, id []byte) (v interface{}, err error)

func (*SpatialGeo) Set

func (this *SpatialGeo) Set(id []byte, r RangeGeo, v *Region) error

func (*SpatialGeo) SetExtInfo

func (this *SpatialGeo) SetExtInfo(category uint8, id []byte, v interface{}) error

func (*SpatialGeo) Within

func (this *SpatialGeo) Within(latlngs []s2.LatLng) EnumGeo

func (*SpatialGeo) WithinRegion

func (this *SpatialGeo) WithinRegion(item *RegionItem) EnumGeo

Jump to

Keyboard shortcuts

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