Geospatial.Providers.Provider behaviour (geospatial v0.3.1)
Provider Behaviour for Geospatial stuff.
Supported backends
Geospatial.Providers.Nominatim
🔗Geospatial.Providers.Photon
🔗Geospatial.Providers.Addok
🔗Geospatial.Providers.MapQuest
🔗Geospatial.Providers.GoogleMaps
🔗Geospatial.Providers.Mimirsbrunn
🔗Geospatial.Providers.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
Get an address from longitude and latitude coordinates.
Lookup for an address by id
Search for an address
Callbacks
Link to this callback
geocode(longitude, latitude, options)
@callback geocode(longitude :: number(), latitude :: number(), options :: keyword()) :: [ Geospatial.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{}
Link to this callback
get_by_id(id, options)
@callback get_by_id(id :: String.t(), options :: keyword()) :: [Geospatial.Address.t()]
Lookup for an address by id
Link to this callback
search(address, options)
@callback search(address :: String.t(), options :: keyword()) :: [Geospatial.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
Link to this function
coordinates(arg1)
@spec coordinates([number() | String.t()]) :: Geo.Point.t() | nil
Returns a Geo.Point
for given coordinates
Link to this function
endpoint(provider)
Link to this function
timezone(point)
@spec timezone(nil | Geo.Point.t()) :: nil | String.t()
Returns the timezone for a Geo.Point