How do I get Map Coordinates for an Address?
The Autoaddress API can return map coordinates for a full or partial address match. First, you call FindAddress to return an addressId for the address, then call GetEcadData passing it the addressId.
Example FindAddress call:
$.ajax({ type: "GET", dataType: "jsonp", url: "https://api.autoaddress.ie/2.0/FindAddress", data : { key: "YOUR_KEY", address: "YOUR_ADDRESS_OR_POSTCODE", vanityMode : true, addressProfile : "Demo5LineV2" }, success: function(data){ //do something with data } });
Sample FindAddress response containing addressId:
{ "result": { "code": 100, "text": "PostcodeAppended" }, "isUniqueAddress": true, "postcode": "D08XY00", "addressId": 1702105351, "addressType": { "code": 2150, "text": "NonResidentialAddressPoint" } ...
Pass the addressId into the GetEcadData function as the ecadid parameter as shown below.
Example GetEcadData call:
$.ajax({ type: "GET", dataType: "jsonp", url: "https://api.autoaddress.ie/2.0/GetEcadData", data : { key: "YOUR_KEY", ecadid: "YOUR_ECAD_ID" }, success: function(data){ //do something with data } });The response to this call is returned as JSON and contains all the information from the ECAD database for the address you entered. One of the JSON elements is called "spatialInfo" which contains the map coordinates for the address. If the addressId entered refers to a location that is larger than a building, it will also return bounding box information.
Sample spatialInfo data for a building:
"spatialInfo": { "ecadId": 1401182204, "ing": { "location": { "easting": 315130.94, "northing": 233997.19 } }, "itm": { "location": { "easting": 715056.72, "northing": 734023.49 } }, "etrs89": { "location": { "longitude": -6.272101, "latitude": 53.343913 } }, "spatialAccuracy": "3" }
Sample spatial info data that returns a bounding box:
"spatialInfo": { "ecadId": 1100000117, "ing": { "location": { "easting": 301545.48, "northing": 241852.22 }, "boundingBox": { "min": { "easting": 297546.36, "northing": 238992.27 }, "max": { "easting": 302542.41, "northing": 243710.63 } } }, "itm": { "location": { "easting": 701474.25, "northing": 741876.91 }, "boundingBox": { "min": { "easting": 697475.98, "northing": 739017.57 }, "max": { "easting": 702470.95999, "northing": 743734.91 } } }, "etrs89": { "location": { "longitude": -6.473473, "latitude": 53.417243 }, "boundingBox": { "min": { "longitude": -6.534047, "latitude": 53.391451 }, "max": { "longitude": -6.458508, "latitude": 53.434064 } } }, "spatialAccuracy": "3" }
Definitions:
Name | Description |
---|---|
ing | Irish National Grid (Easting, Northing). |
itm | Irish Transverse Mercator (Easting, Northing). |
etrs89 | ETRS89 (Latitude, Longitude). The European Terrestrial Reference system is a precise subset of the IRTF (International Terrestrial Reference Frame) with geographic coordinates (latitudes and longitudes) based on the GRS80 ellipsoid and has become the adopted reference system for Europe. Coordinates interchangeably with WGS84 coordinates as they deviate by less than one meter. |
spatialAccuracy | Integer denotes spatial accuracy. N.B. spatial accuracy = 4 indicates the coordinates are unverified and should not be used. |
See Get ECAD Data for more information on calling the GetEcadData function and the data it returns from the ECAD database.