0
votes

I am a WP7 developer. I have longitude and latitude of a location and getting complete information defined by the coordinate ie longitude and latitude by using Bing maps API

http://dev.virtualearth.net/REST/v1/Locations/37.09024,-95.712891?o=json&key=APIKEY

Above latitude and longitude is USA location, I'm able to get addressLine,adminDistrict,adminDistrict2,countryRegion,formattedAddress and postalCode but not country code(ISO ALPHA-2 Code) like IN for India, US for United States, countryRegion in json response consists country name, My app limitation is to use country code not country name.Did anything i missed in API url. Please help me

3

3 Answers

0
votes

You need to add a seperate parameter "incl=ciso2" for country code as it comes under additional info. Modify your query string like this. http://dev.virtualearth.net/REST/v1/Locations/37.09024,-95.712891?incl=ciso2&o=json&key=APIKEY.

Doing this you will have an additonal field in the address object "countryregioniso2" which will have the 2 digit country code.

0
votes

The field name if you have added &incl=ciso2 to url will be "countryRegionIso2" and this still works.