Street number in results from reverse geocoding

2720
2
Jump to solution
12-18-2015 05:51 AM
StanislavDusek
New Contributor

Hello,

do you know if there is some way how I can use reverse geocoding and get street name and street number in two separate fields?

In some countries, the street number comes before the street name, in other countries, it comes after (for instance "1013 College Blvd" in USA, but "Zuidstraat 54" in Belgium) and it wouldn't be wise to get it from parsing output string in my opinion.

locator.on("location-to-address-complete", function(evt) {

if (evt.address.address) {

  var str_address = "Address: "+ evt.address.address.Address + "\n"; // In here, I get for instance "1013 College Blvd" in USA, but "Zuidstraat 54" in Belgium.

  var str_city = "City: "+ evt.address.address.City + "\n";

  // ...

}

});

Thanks in advance,

Stanislav

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
ChrisSmith7
Frequent Contributor

outFields isn't specified in the reverse geocoding documentation - reverseGeocode—ArcGIS REST API: World Geocoding Service | ArcGIS for Developers  - but I thought I'd try it anyways, e.g. http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?location=2.2945%2C...

No luck, unfortunately... I don't believe there is a "standardize address" operation, but, you could send the address string to "find" or "find candidates" to get this type of information (address from your example, I think):

1013 College Blvd, Dallas, NC 28034

http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=1013 College Blvd, Dall...

{
"spatialReference": {
  "wkid": 4326,
  "latestWkid": 4326
},
"locations": [
  {
  "name": "1013 College Blvd, Dallas, North Carolina, 28034",
  "extent": {
  "xmin": -81.196256000000005,
  "ymin": 35.321224000000001,
  "xmax": -81.194255999999996,
  "ymax": 35.323224000000003
  },
  "feature": {
  "geometry": {
  "x": -81.195255354450239,
  "y": 35.322223652200876
  },
  "attributes": {
  "Loc_name": "USA.PointAddress",
  "Score": 100,
  "Match_addr": "1013 College Blvd, Dallas, North Carolina, 28034",
  "Addr_type": "PointAddress",
  "Type": "",
  "PlaceName": "",
  "Place_addr": "",
  "Phone": "",
  "URL": "",
  "Rank": "",
  "AddBldg": "",
  "AddNum": "1013",
  "AddNumFrom": "",
  "AddNumTo": "",
  "Side": "R",
  "StPreDir": "",
  "StPreType": "",
  "StName": "College",
  "StType": "Blvd",
  "StDir": "",
  "StAddr": "1013 College Blvd",
  "Nbrhd": "",
  "City": "Dallas",
  "Subregion": "",
  "Region": "North Carolina",
  "Postal": "28034",
  "PostalExt": "",
  "Country": "USA",
  "LangCode": "ENG",
  "Distance": 0,
  "X": -81.195256000000001,
  "Y": 35.322223999999999,
  "DisplayX": -81.195301000000001,
  "DisplayY": 35.32206,
  "Xmin": -81.196256000000005,
  "Xmax": -81.194255999999996,
  "Ymin": 35.321224000000001,
  "Ymax": 35.323224000000003
  }
  }
  }
]
}

Of course, this would be another API call... Maybe we can ask Esri to add support for outFields in the reverse geocoder?

View solution in original post

2 Replies
ChrisSmith7
Frequent Contributor

outFields isn't specified in the reverse geocoding documentation - reverseGeocode—ArcGIS REST API: World Geocoding Service | ArcGIS for Developers  - but I thought I'd try it anyways, e.g. http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/reverseGeocode?location=2.2945%2C...

No luck, unfortunately... I don't believe there is a "standardize address" operation, but, you could send the address string to "find" or "find candidates" to get this type of information (address from your example, I think):

1013 College Blvd, Dallas, NC 28034

http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find?text=1013 College Blvd, Dall...

{
"spatialReference": {
  "wkid": 4326,
  "latestWkid": 4326
},
"locations": [
  {
  "name": "1013 College Blvd, Dallas, North Carolina, 28034",
  "extent": {
  "xmin": -81.196256000000005,
  "ymin": 35.321224000000001,
  "xmax": -81.194255999999996,
  "ymax": 35.323224000000003
  },
  "feature": {
  "geometry": {
  "x": -81.195255354450239,
  "y": 35.322223652200876
  },
  "attributes": {
  "Loc_name": "USA.PointAddress",
  "Score": 100,
  "Match_addr": "1013 College Blvd, Dallas, North Carolina, 28034",
  "Addr_type": "PointAddress",
  "Type": "",
  "PlaceName": "",
  "Place_addr": "",
  "Phone": "",
  "URL": "",
  "Rank": "",
  "AddBldg": "",
  "AddNum": "1013",
  "AddNumFrom": "",
  "AddNumTo": "",
  "Side": "R",
  "StPreDir": "",
  "StPreType": "",
  "StName": "College",
  "StType": "Blvd",
  "StDir": "",
  "StAddr": "1013 College Blvd",
  "Nbrhd": "",
  "City": "Dallas",
  "Subregion": "",
  "Region": "North Carolina",
  "Postal": "28034",
  "PostalExt": "",
  "Country": "USA",
  "LangCode": "ENG",
  "Distance": 0,
  "X": -81.195256000000001,
  "Y": 35.322223999999999,
  "DisplayX": -81.195301000000001,
  "DisplayY": 35.32206,
  "Xmin": -81.196256000000005,
  "Xmax": -81.194255999999996,
  "Ymin": 35.321224000000001,
  "Ymax": 35.323224000000003
  }
  }
  }
]
}

Of course, this would be another API call... Maybe we can ask Esri to add support for outFields in the reverse geocoder?

StanislavDusek
New Contributor

Thanks, good idea! 🙂

0 Kudos