Documentation
¶
Index ¶
- Variables
- type Cell
- type Point
- func (p *Point) Lat() float64
- func (p *Point) Lng() float64
- func (p *Point) SetLat(lat float64) *Point
- func (p *Point) SetLng(lng float64) *Point
- func (p *Point) SetX(x float64) *Point
- func (p *Point) SetY(y float64) *Point
- func (p *Point) Transform(projector Projector) *Point
- func (p *Point) X() float64
- func (p *Point) Y() float64
- type Polygon
- type PriorityQueue
- type Projection
- type Projector
Constants ¶
This section is empty.
Variables ¶
var Mercator = Projection{ Project: func(p *Point) { p.SetX(mercatorPole / 180.0 * p.Lng()) y := math.Log(math.Tan((90.0+p.Lat())*math.Pi/360.0)) / math.Pi * mercatorPole p.SetY(math.Max(-mercatorPole, math.Min(y, mercatorPole))) }, Inverse: func(p *Point) { p.SetLng(p.X() * 180.0 / mercatorPole) p.SetLat(180.0 / math.Pi * (2*math.Atan(math.Exp((p.Y()/mercatorPole)*math.Pi)) - math.Pi/2.0)) }, }
Mercator projection, performs EPSG:3857, sometimes also described as EPSG:900913.
Functions ¶
This section is empty.
Types ¶
type Cell ¶
type Point ¶
type Point [2]float64
A Point is a simple Lng/Lat 2d point.
func NewPointFromLatLng ¶
Creates a point from a latitude and longitude
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
PriorityQueue represents the queue
func NewPriorityQueue ¶
func NewPriorityQueue() PriorityQueue
New initializes an empty priority queue.
func (*PriorityQueue) Insert ¶
func (p *PriorityQueue) Insert(v interface{}, priority float64)
Insert inserts a new element into the queue. No action is performed on duplicate elements.
func (*PriorityQueue) Len ¶
func (p *PriorityQueue) Len() int
Len returns the number of elements in the queue.
func (*PriorityQueue) Pop ¶
func (p *PriorityQueue) Pop() (interface{}, error)
Pop removes the element with the highest priority from the queue and returns it. In case of an empty queue, an error is returned.
func (*PriorityQueue) UpdatePriority ¶
func (p *PriorityQueue) UpdatePriority(x interface{}, newPriority float64)
UpdatePriority changes the priority of a given item. If the specified item is not present in the queue, no action is performed.
type Projection ¶
A Projection is a set of projectors to map forward and backwards to the projected space.