Reverse Geocode

Edited

Reverse geocode a location. Returns the nearest building to the location within the specified maxDistance.

Please read API Overview first


API Endpoint

The Reverse Geocode API endpoint won't change. It can be set as a constant.

https://api.autoaddress.ie/2.0/ReverseGeocode

N.B. This EndPoint URL resolves to a dynamic IP address, please be aware of this when making DNS and Firewall decisions.


Request

To reverse geocode a location, a simple  GET request from your desired language is all that is needed.

  • cURL

curl -v "https://api.autoaddress.ie/2.0/ReverseGeocode?key=YOUR_KEY&longitude=LONGITUDE&latitude=LATITUDE&maxDistance=MAX_DISTANCE&vanityMode=true&addressProfileName=Demo5LineV2"
  • jQuery

$.ajax({
   type: "GET",
   dataType: "jsonp",
   url: "https://api.autoaddress.ie/2.0/ReverseGeocode",
   data : {
       key: "YOUR_KEY",
       longitude: LONGITUDE,
       latitude: LATITUDE,
       maxDistance: MAX_DISTANCE,
       vanityMode: true,
       addressProfileName: "Demo5LineV2"
   },
   success: function(data){
       //do something with data
   }
});
  • Angular JS

$http.jsonp('https://api.autoaddress.ie/2.0/ReverseGeocode',{
   params: {
      key: "YOUR_KEY",
       longitude: LONGITUDE,
       latitude: LATITUDE,
       maxDistance: MAX_DISTANCE,
       vanityMode: true,
       addressProfileName: "Demo5LineV2"
   }
}).success(function(data){
   //do something with data
});
  • Ruby

require 'json'
require 'net/http'

uri = URI.parse("https://api.autoaddress.ie/2.0/ReverseGeocode?key=YOUR_KEY&longitude=LONGITUDE&latitude=LATITUDE&maxDistance=MAX_DISTANCE&vanityMode=true&addressProfileName=Demo5LineV2")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = http.get(uri.request_uri)
result = JSON.parse(response.body)
  • Python

import json
import urllib2
 
Response = urllib2.urlopen ("https://api.autoaddress.ie/2.0/ReverseGeocode?key=YOUR_KEY&longitude=LONGITUDE&latitude=LATITUDE&maxDistance=MAX_DISTANCE&vanityMode=true&addressProfileName=Demo5LineV2")jsonResult = json.load(Response)
  • C#

using System.IO;
using System.Net;

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.autoaddress.ie/2.0/ReverseGeocode?key=YOUR_KEY&longitude=LONGITUDE&latitude=LATITUDE&maxDistance=MAX_DISTANCE&vanityMode=true&addressProfileName=Demo5LineV2");request.Method = WebRequestMethods.Http.Get;
request.Accept = "application/json";

using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
   var result = new StreamReader(response.GetResponseStream()).ReadToEnd();
}

Response

The following is a sample JSON response returned for a Reverse Geocode API request.

{
  "hits": [
    {
      "addressId": 1401182204,
      "postalAddress": [
        "INNS COURT",
        "WINETAVERN STREET",
        "DUBLIN 8"
      ],
      "vanityAddress": [
        "Inns Court",
        "Winetavern Street",
        "Dublin 8"
      ],
      "reformattedAddress": [
        "Inns Court", 
        "Winetavern Street", 
        null, 
        null, 
        "Dublin 8" 
      ],
      "distance": 26.4,
      "links": [
        {
          "rel": "getEcadData",
          "href": "https://api.autoaddress.ie/2.0/getecaddata?key=YOUR_KEY&txn=dd588e57-004b-4850-bfc7-871e386f7585&ecadId=1401182204"
        }
      ]
    }
  ],
  "input": {
    "key": "YOUR_KEY",
    "txn": "dd588e57-004b-4850-bfc7-871e386f7585",
    "latitude": 53.343761,
    "longitude": -6.271796,
    "maxDistance": 50.0,
    "language": "en",
    "country": "ie",
    "vanityMode": true,
    "addressProfileName": "Demo5LineV2"
  },
  "links": [
    {
      "rel": "self",
      "href": "https://api.autoaddress.ie/2.0/reversegeocode?key=YOUR_KEY&longitude=-6.271796&latitude=53.343761&maxDistance=50&vanityMode=true&addressProfileName=Demo5LineV2"
    }
  ]
}

Input Fields

Name

Type

Default

Description

key*

string

None

Licence key
IMPORTANT: The key parameter name must be all lower case.

longitude*

double

None

Longitude (ETRS89)

latitude*

double

None

Latitude (ETRS89)

maxDistance

double

50

Maximum distance to search from location in metres. Must be less than or equal to 100.

language

string

"en"

Language for returned address. Allowed values are "en" for English and "ga" for Irish.

country

string

"ie"

Country to be searched. Allowed values are "ie" for Ireland.

geographicAddress

boolean

false

Return geographic address.

vanityMode

boolean

false

Return vanity address format, if it exists.

addressProfileName

string

If supplied a reformatted address (according to profile rules) is returned in reformattedAddress field in JSON response.

txn

string

None

Transaction ID from previous call in the session

* Required Field


Output Fields

Name

Type

Description

hits

hit [ ]

An array of Hit objects (described below).

input

object

Input object with request input fields.

links

link [ ]

An array of Link objects (described below).

Hit Object

Name

Type

Description

addressId

integer

Address ID of building (i.e., ECAD ID for Ireland)

postalAddress

string [ ]

Postal address in requested language for the building

geographicAddress

string [ ]

Geographic address in requested language for the building

vanityAddress

string [ ]

Vanity address in case it was requested per input, and it is available

reformattedAddress

string [ ]

Address that was reformatted in case addressProfileName was supplied in input fields

reformattedAddressResult

enum

Reformatted address result

  • Success = 100

  • AddressElementTruncated = 101

  • AddressElementLost = 102

  • AddressElementLostAndTruncated = 103

  • AddressElementAbbreviated = 110

distance

double

Distance of building from location in metres

Link Object

Name

Type

Description

rel

string

API response usually includes an array of HATEOAS links. This allows interaction with the API solely through the hyperlinks we provide you. You no longer need to hardcode logic into your client in order to use our API.

href

string

The hyperlink the client should follow is stored in the value of “href” property. That value can have some internal parameters, so the client should not parse it or modify it in any way.