molly.geolocation – Geolocation¶
This is a utility app that provides geolocation functionality and the user experience to other apps and users.
Configuration¶
- prefer_results_near (optional, defaults to None): If set, it prefers geolocation results near the (latitude, longitude, distance) tuple
- providers: providers which provide geocoding
- history_size (optional, defaults to 5): How many locations should be stored in the history for each user
- location_request_period (optional, defaults to 180): how often to ask for new locations from users which are updating their location automatically, in seconds
Sample:
Application('molly.geolocation', 'geolocation', 'Geolocation',
prefer_results_near = (-1.25821, 51.75216, 5000),
providers = [
Provider('molly.geolocation.providers.PlacesGeolocationProvider'),
Provider('molly.geolocation.providers.CloudmadeGeolocationProvider',
search_around = (-1.25821, 51.75216),
search_distance = 5000,
),
],
location_request_period = 900,
display_to_user = False,
),
Providers¶
molly.geolocation.providers.PlacesGeolocationProvider¶
This is a provider which matches geocoding requests against entities known in the places app and returns the location, if appropriate. It has one, optional, option:
- search_identifiers: A limit on which identifier namespaces are to be searched (list of strings)
molly.geolocation.providers.CloudmadeGeolocationProvider¶
This provider asks Cloudmade to geocode results. You have to retrieve an API key from Cloudmade to use this provider. It has three optional parameters:
search_around: (latitude, longitude) tuple, supposed the centre of the area
search_distance: distance to the centre of the area
- get_area: make a second call to the API to display the name of the area, for
each search result