Mobilizon.Service.Geospatial.Provider behaviour (Mobilizon v2.0.2) View Source

Provider Behaviour for Geospatial stuff.

Supported backends

Shared options

  • :lang Lang in which to prefer results. Used as a request parameter or through an Accept-Language HTTP header. Defaults to "en".
  • :country_code An ISO 3166 country code. String or nil
  • :limit Maximum limit for the number of results returned by the backend. Defaults to 10
  • :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.

Link to this section Summary

Callbacks

Get an address from longitude and latitude coordinates.

Search for an address

Functions

Returns a Geo.Point for given coordinates

Returns the timezone for a Geo.Point

Link to this section Callbacks

Link to this callback

geocode(longitude, latitude, options)

View Source

Specs

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{}
Link to this callback

search(address, options)

View Source

Specs

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 to nil.
  • type Filter by type of results. Allowed values:
    • :administrative (cities, regions)

Examples

iex> search("10 rue Jangot")
%Address{}

Link to this section Functions

Specs

coordinates([number() | String.t()]) :: Geo.Point.t() | nil

Returns a Geo.Point for given coordinates

Specs

endpoint(atom()) :: String.t()

Specs

timezone(nil | Geo.Point.t()) :: nil | String.t()

Returns the timezone for a Geo.Point