Documentation ¶
Overview ¶
Package geo provides utilities helping with geographic coordinates in the map aspect of the Camlistore web UI.
Index ¶
- Constants
- func HandleLocAreaPredicate(predicate string, handleCoordinatesFound func(*camtypes.LocationBounds)) bool
- func HandleZoomPredicate(predicate string, handleCoordinatesFound func(*camtypes.LocationBounds)) bool
- func IsLocMapPredicate(predicate string) bool
- func IsLocPredicate(predicate string) bool
- func Lookup(location string, handleCoordinatesFound func(*camtypes.LocationBounds))
- type EastWest
- type Location
Constants ¶
const ( LocPredicatePrefix = "loc" LocAreaPredicatePrefix = "locrect" LocMapPredicatePrefix = "map" )
Variables ¶
This section is empty.
Functions ¶
func HandleLocAreaPredicate ¶
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 ¶
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 ¶
IsLocMapPredicate returns whether predicate is a map location predicate.
func IsLocPredicate ¶
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 ¶
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.
Types ¶
type EastWest ¶
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 ¶
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