GetGeocode (GetGeocode v0.0.3) View Source
The main module with get/1
function to retrieve data from CEP (brazilian format), full address format (Nominatim), or a tuple with coordinates {lat, lng}
.
Link to this section Summary
Functions
Gets geodata from input
.
Returns a tuple with {:ok, %GetGeocode.Geocode{}}
.
Link to this section Functions
Gets geodata from input
.
Returns a tuple with {:ok, %GetGeocode.Geocode{}}
.
Examples
# CEP format
iex> GetGeocode.get "69030000"
{:ok,
%GetGeocode.Geocode{
city: "Manaus",
coords: %GetGeocode.Coords{lat: "-3.1054153", lng: "-60.0547259"},
full_details: "Rua Izaurina Braga, Compensa, Manaus, Região Geográfica Imediata de Manaus, Região Geográfica Intermediária de Manaus, Amazonas, Região Norte, 69000-000, Brasil",
neighborhood: "Compensa",
postalcode: "69030-000",
state: "AM",
street: "Rua Izaurina Braga"
}}
# with full name
iex> GetGeocode.get "Rua Compensa, Compensa, Amazonas"
{:ok,
%GetGeocode.Geocode{
city: "Manaus",
coords: %GetGeocode.Coords{lat: "-3.0967331", lng: "-60.0499325"},
full_details: "Rua Guanapuris, Compensa, Manaus, Região Geográfica Imediata de Manaus, Região Geográfica Intermediária de Manaus, Amazonas, Região Norte, 69000-000, Brasil",
neighborhood: "Compensa",
postalcode: "69000-000",
state: "Amazonas",
street: "Rua Guanapuris"
}}
Also works with input being a tuple with coordinates, like {lat, lng}
.
iex> GetGeocode.get {-3.0999329, -60.0552931}
{:ok,
%GetGeocode.Geocode{
city: "Manaus",
coords: %GetGeocode.Coords{lat: "-3.1004858", lng: "-60.0549478"},
full_details: "Rua Boa Esperança, Compensa, Manaus, Região Geográfica Imediata de Manaus, Região Geográfica Intermediária de Manaus, Amazonas, Região Norte, 69000-000, Brasil",
neighborhood: "Compensa",
postalcode: "69000-000",
state: "Amazonas",
street: "Rua Boa Esperança"
}}