View Source Mobilizon.Service.Geospatial.Provider behaviour (Mobilizon v5.0.0-beta.1)
Provider Behaviour for Geospatial stuff.
Supported backends
Mobilizon.Service.Geospatial.Nominatim
🔗Mobilizon.Service.Geospatial.Photon
🔗Mobilizon.Service.Geospatial.Addok
🔗Mobilizon.Service.Geospatial.MapQuest
🔗Mobilizon.Service.Geospatial.GoogleMaps
🔗Mobilizon.Service.Geospatial.Mimirsbrunn
🔗Mobilizon.Service.Geospatial.Pelias
🔗
Shared options
:lang
Lang in which to prefer results. Used as a request parameter or through anAccept-Language
HTTP header. Defaults to"en"
.:country_code
An ISO 3166 country code. String ornil
:limit
Maximum limit for the number of results returned by the backend. Defaults to10
:api_key
Allows to override the API key (if the backend requires one) set inside the configuration.:endpoint
Allows to override the endpoint set inside the configuration.
Summary
Callbacks
@callback geocode(longitude :: number(), latitude :: number(), options :: keyword()) :: [ Mobilizon.Addresses.Address.t() ]
Get an address from longitude and latitude coordinates.
Options
In addition to the shared options, geocode/3
also
accepts the following options:
zoom
Level of detail required for the address. Default: 15
Examples
iex> geocode(48.11, -1.77)
%Address{}
@callback search(address :: String.t(), options :: keyword()) :: [ Mobilizon.Addresses.Address.t() ]
Search for an address
Options
In addition to the shared options, search/2
also
accepts the following options:
coords
Map of coordinates (ex:%{lon: 48.11, lat: -1.77}
) allowing to give a geographic priority to the search. Defaults tonil
.type
Filter by type of results. Allowed values::administrative
(cities, regions)
Examples
iex> search("10 rue Jangot")
%Address{}
Functions
@spec coordinates([number() | String.t()]) :: Geo.Point.t() | nil
Returns a Geo.Point
for given coordinates
@spec timezone(nil | Geo.Point.t()) :: nil | String.t()
Returns the timezone for a Geo.Point