Geocoding
The geocoding API is used to convert a known address (like "Unter den Linden 78 10117 Berlin") into geo-coordinates.
Endpoints
The API is callable via GET
and POST
and returns the geo-coordinates and the corresponding correct postal address.
GET/v1/geocode/search
curl -X GET https://api.apistax.io/v1/geocode/search?query=Wiedner%20Hauptstraße%2032,%201040%20Wien \
-H 'Authorization: Bearer API_KEY_HERE'
POST/v1/geocode/search
curl -X POST https://api.apistax.io/v1/geocode/search \
-H 'Authorization: Bearer API_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{ "query": "Wiedner Hauptstraße 32, 1040 Wien" }'
Response
Both endpoints return the result in JSON format and with HTTP status 200. If the address is not recognized, an empty response with HTTP status 204 is returned.
{
"position": {
"latitude": 48.1954,
"longitude": 16.36688
},
"address": {
"houseNumber": "32",
"street": "Wiedner Hauptstraße",
"city": "Vienna",
"postalCode": "1040",
"country": "Austria",
"countryCode": "AT"
}
}
Parameters
query: String
The query as a free-text address.
language: String = en
The language used for result localization based on ISO 639-1.
For example: en
or fr
Possible errors
Identifier | Description |
---|---|
message.queryMustNotBeBlank |
Parameter query is required and must not be blank. |
message.languageMustBeValid |
Parameter language must be valid and covered by ISO 639. |
It should be noted that there are a number of common error messages, which can be found in the "Possible errors" section of the general documentation.