cfbarbero
cfbarbero

Reputation: 1607

Bing API for finding nearby cities

Is there a Bing API for finding nearby cities given a city name or lat/long combination?

Upvotes: 7

Views: 5367

Answers (5)

Marz1k
Marz1k

Reputation: 49

https://pypi.org/project/citiesnearby/ Can help you. Have over 150k cities in its database.

Upvotes: 0

azarc3
azarc3

Reputation: 1307

No, there isn't. However, it's relatively simple to get the bounding box for a given coordinate and then use the Bing Maps API with that. I'm doing this and used this solution to get what I needed...

https://stackoverflow.com/a/14314146/73680

Upvotes: 0

Fraser
Fraser

Reputation: 17094

The short answer is no, there is no Bing API for finding nearby cities.

That said, it would be possible to 'cook your own' using the existing APIs. However, one thing that would need clarification is what 'nearby' means. I presume you mean within a specific radius of a given point (determined by a city name or lat/long combination).

Using the Bing Api it would be fairly trivial to implement an algorithm to reverse geocode a location and then test for places within x distance.

Failing that, you could use something like geoPlugin, it is free and you can put it on your sever - thus avoiding 3rd party up-time issues. http://www.geoplugin.com/webservices/php#php_class

Take a look at the nearby places features, this does exactly what you want. http://www.geoplugin.com/webservices/extras

Upvotes: 0

Kevin
Kevin

Reputation: 11682

I don't know if Bing provides this, but you build your own from the data available from geonames.org

They provide an API to get places near a given lat/lng: http://api.geonames.org/findNearby?lat=47.3&lng=9&username=demo

Or you can also go all out and implement a solution for your own needs using their data, as per this answer: Given the lat/long coordinates, how can we find out the city/country?

Upvotes: 1

Chris B. Behrens
Chris B. Behrens

Reputation: 6295

I think this is what you're looking for: Bing Maps API Sample

Upvotes: 0

Related Questions