2
votes

Bing Maps API has been great for figuring out all my GPS information sent from a WP7 phone. But I'm not sure how to deal with Zip Codes. I know it varies per country. I'm curious what is the best way to get a Zip code (or similar) from a latitude/longitude. Bing Maps doesn't always return a City with Area code. Sometimes it will bring back "Populated Area" such as the bay area or San Francisco. The zip node in the XML will be blank.

Are there hacks to get around this? Or am I looking at some other complicated calculation and a second web service call?

3

3 Answers

1
votes

I ended up using the google api to get this type of information. I wanted to get the suburb I was in and Bing would not return this. May be worth a look to see if Google will return the zip code.

1
votes

You can use the Locations API to get the location information for a specified point. If you only want the postal code for the specified location, then you just set the includeEntityTypes parameter to PostCode1, though you can request several as a comma-separated list.

As you are no doubt aware, you can also choose between an XML or JSON response.

1
votes

I'm not sure if there's an easier way to do this with the API, but you can definitely accomplish this without using another service although it's a bit of extra work. You can add a custom tile layer using shape files such as the ones provided here: http://www.census.gov/geo/www/cob/zt_metadata.html