camlistore.org: camlistore.org/server/camlistored/ui/goui/geo Index | Files

package geo

import "camlistore.org/server/camlistored/ui/goui/geo"

Package geo provides utilities helping with geographic coordinates in the map aspect of the Camlistore web UI.

Index

Package Files

geo.go

Constants

const (
    LocPredicatePrefix     = "loc"
    LocAreaPredicatePrefix = "locrect"
    LocMapPredicatePrefix  = "map"
)

func HandleLocAreaPredicate Uses

func HandleLocAreaPredicate(predicate string, handleCoordinatesFound func(*camtypes.LocationBounds)) bool

HandleLocAreaPredicate checks whether predicate is a location area predicate (locrect). If so, it runs asynchronously handleCoordinatesFound on the given coordinates, and returns true. Otherwise, it returns false.

func HandleZoomPredicate Uses

func HandleZoomPredicate(predicate string, handleCoordinatesFound func(*camtypes.LocationBounds)) bool

HandleLocAreaPredicate checks whether predicate contains a map location predicate (map:). If so, it runs asynchronously handleCoordinatesFound on the given coordinates, and returns true. Otherwise, it returns false.

func IsLocMapPredicate Uses

func IsLocMapPredicate(predicate string) bool

IsLocMapPredicate returns whether predicate is a map location predicate.

func IsLocPredicate Uses

func IsLocPredicate(predicate string) bool

IsLocPredicate returns whether the given predicate is a simple (as in, not composed) location predicate, such as the one supported by the Camlistore search handler (e.g. "loc:seattle").

func Lookup Uses

func Lookup(location string, handleCoordinatesFound func(*camtypes.LocationBounds))

Lookup searches for the coordinates of the given location, and passes the found zone (a rectangle), if any, to handleCoordinatesFound.

type EastWest Uses

type EastWest struct {
    E   float64
    W   float64
}

EastWest is returned by WrapAntimeridian. It exists only because there's no multi-valued returns with javascript functions, so we need WrapAntimeridian to return some sort of struct, that gets converted to a javascript object by gopherjs.

func WrapAntimeridian Uses

func WrapAntimeridian(east, west float64) EastWest

WrapAntimeridian determines if the shortest geodesic between east and west goes over the antimeridian. If yes, it converts one of the two to the closest equivalent value out of the [-180, 180] range. The choice of which of the two to convert is such as to maximize the part of the geodesic that stays in the [-180, 180] range. The reason for that function is that leaflet.js cannot handle drawing areas that cross the antimeridian if both corner are in the [-180, 180] range. https://github.com/Leaflet/Leaflet/issues/82

type Location Uses

type Location struct {
    Lat  float64 // -90 (south) to 90 (north)
    Long float64 // -180 (west) to 180 (east)
}

Location is a geographical coordinate, specified by its latitude and its longitude.

func LocationCenter Uses

func LocationCenter(north, south, west, east float64) Location

LocationCenter returns the center of the rectangle defined by the given coordinates.

Package geo imports 8 packages (graph) and is imported by 2 packages. Updated 2018-02-15. Refresh now. Tools for package owners.