Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bing Maps REST API Convert Coordinates to Zip Code or Similar

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?

like image 722
firebellys Avatar asked Dec 28 '25 03:12

firebellys


2 Answers

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.

like image 142
Steve Chadbourne Avatar answered Dec 30 '25 16:12

Steve Chadbourne


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.

like image 27
Derek Lakin Avatar answered Dec 30 '25 16:12

Derek Lakin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!