LibLatLon.Info (LibLatLon v0.5.0) View Source
Main storage struct for holding information about any place/POI/address in the unified form.
Example:
LibLatLon.lookup {41.38777777777778, 2.197222222222222}
%LibLatLon.Info{
address: "Avinguda del Litoral, [...] España",
bounds: %LibLatLon.Bounds{
from: #Coord<[
lat: 41.3876663,
lon: 2.196602,
fancy: "41°23´15.59868˝N,2°11´47.7672˝E"
]>,
to: #Coord<[
lat: 41.3917431,
lon: 2.2031084,
fancy: "41°23´30.27516˝N,2°12´11.19024˝E"
]>
},
coords: #Coord<[
lat: 41.3899932,
lon: 2.2000054,
fancy: "41°23´23.97552˝N,2°12´0.01944˝E"
]>,
details: %{
city: "Barcelona",
city_district: "Sant Martí",
country: "España",
country_code: "es",
county: "BCN",
postcode: "08020",
road: "Avinguda del Litoral",
state: "CAT",
suburb: "la Vila Olímpica del Poblenou"
},
meta: %{
licence: "Data © OpenStreetMap [...]",
osm_id: "47123759",
osm_type: "way",
place_id: "82181109"
}
}
Link to this section Summary
Functions
Formats the String.t
representation of this struct according to
the format given.
Mostly internal helper. You would unlikely call this function yourself.
The same as LibLatLon.Info.from_map/1
, but banged.
Link to this section Types
Specs
t() :: %LibLatLon.Info{ address: binary(), bounds: LibLatLon.Bounds.t(), coords: LibLatLon.Coords.t(), details: map(), meta: map() }
Main type to store geo point in unified form.
LibLatLon.Bounds.t
forbounds
fieldLibLatLon.Coords.t
forcoords
key
address
is a string, representing the whole address in human-readable form.
details
and meta
are not unified maps of fields, as returned
by geo location provider. Their keys differ for different providers.
Link to this section Functions
Specs
Formats the String.t
representation of this struct according to
the format given.
Second parameter format
might include %{field}
inclusions
which will be interpolated in the result with real values.
Examples
iex> info = LibLatLon.lookup({42, 3.14159265}, LibLatLon.Providers.Dummy)
iex> LibLatLon.Info.format(info, "⚑ %{country}, %{city}, %{postcode}.")
"⚑ España, Barcelona, 08021."
Specs
Mostly internal helper. You would unlikely call this function yourself.
Gets the map as returned by geo location provider and contructs fields in unified format.
Specs
The same as LibLatLon.Info.from_map/1
, but banged.