All URIs are relative to https://eu1.locationiq.com/v1
Method | HTTP request | Description |
---|---|---|
Reverse | GET /reverse.php | Reverse Geocoding |
Location Reverse (decimal lat, decimal lon, string format, int normalizecity, int addressdetails = null, string acceptLanguage = null, int namedetails = null, int extratags = null, int statecode = null, int showdistance = null, int postaladdress = null)
Reverse Geocoding
Reverse geocoding is the process of converting a coordinate or location (latitude, longitude) to a readable address or place name. This permits the identification of nearby street addresses, places, and/or area subdivisions such as a neighborhood, county, state, or country.
using System.Collections.Generic;
using System.Diagnostics;
using locationiq.Api;
using locationiq.Client;
using locationiq.Model;
namespace Example
{
public class ReverseExample
{
public static void Main()
{
Configuration.Default.BasePath = "https://eu1.locationiq.com/v1";
// Configure API key authorization: key
Configuration.Default.AddApiKey("key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.AddApiKeyPrefix("key", "Bearer");
var apiInstance = new ReverseApi(Configuration.Default);
var lat = 40.7487727; // decimal | Latitude of the location to generate an address for.
var lon = -73.9849336; // decimal | Longitude of the location to generate an address for.
var format = "json"; // string | Format to geocode. Only JSON supported for SDKs
var normalizecity = 1; // int | Normalizes village to city level data to city
var addressdetails = 1; // int | Include a breakdown of the address into elements. Defaults to 1. (optional) (default to 1)
var acceptLanguage = "en"; // string | Preferred language order for showing search results, overrides the value specified in the Accept-Language HTTP header. Defaults to en. To use native language for the response when available, use accept-language=native (optional)
var namedetails = 0; // int | Include a list of alternative names in the results. These may include language variants, references, operator and brand. (optional)
var extratags = 0; // int | Include additional information in the result if available, e.g. wikipedia link, opening hours. (optional)
var statecode = 0; // int | Adds state or province code when available to the statecode key inside the address element. Currently supported for addresses in the USA, Canada and Australia. Defaults to 0 (optional)
var showdistance = 0; // int | Returns the straight line distance (meters) between the input location and the result's location. Value is set in the distance key of the response. Defaults to 0 [0,1] (optional)
var postaladdress = 0; // int | Returns address inside the postaladdress key, that is specifically formatted for each country. Currently supported for addresses in Germany. Defaults to 0 [0,1] (optional)
try
{
// Reverse Geocoding
Location result = apiInstance.Reverse(lat, lon, format, normalizecity, addressdetails, acceptLanguage, namedetails, extratags, statecode, showdistance, postaladdress);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ReverseApi.Reverse: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
lat | decimal | Latitude of the location to generate an address for. | |
lon | decimal | Longitude of the location to generate an address for. | |
format | string | Format to geocode. Only JSON supported for SDKs | |
normalizecity | int | Normalizes village to city level data to city | |
addressdetails | int | Include a breakdown of the address into elements. Defaults to 1. | [optional] [default to 1] |
acceptLanguage | string | Preferred language order for showing search results, overrides the value specified in the Accept-Language HTTP header. Defaults to en. To use native language for the response when available, use accept-language=native | [optional] |
namedetails | int | Include a list of alternative names in the results. These may include language variants, references, operator and brand. | [optional] |
extratags | int | Include additional information in the result if available, e.g. wikipedia link, opening hours. | [optional] |
statecode | int | Adds state or province code when available to the statecode key inside the address element. Currently supported for addresses in the USA, Canada and Australia. Defaults to 0 | [optional] |
showdistance | int | Returns the straight line distance (meters) between the input location and the result's location. Value is set in the distance key of the response. Defaults to 0 [0,1] | [optional] |
postaladdress | int | Returns address inside the postaladdress key, that is specifically formatted for each country. Currently supported for addresses in Germany. Defaults to 0 [0,1] | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
400 | Bad Request | - |
401 | Unauthorized | - |
403 | The request has been made from an unauthorized domain. | - |
404 | No location or places were found for the given input | - |
429 | Request exceeded the rate-limits set on your account | - |
500 | Internal Server Error | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]