I have no experience of geolocation and what services/APIs are out there so I'm asking for help.
I want to be able to store geolocations that could be a street, city, province, country or continent. And I want to be able to answer these q开发者_开发百科uestions:
What is the distance between geolocation A to geolocation B?
Is geolocation A contained by geolocation B? e.g. is Paris inside Europe?
If it was just a matter of geographical coordinates it would be simpler, but I want to compare proximity between geographical regions and see if one is contained by another. I imagine two ways of how this can be done:
- a database of hierarchical structure of country->province->city->street, each node having a geographical coordinate to find the distances and to find if one node containes another you do a tree search.
- represent cities, countries etc. as geographical shapes that you can see if they intersect and you can calculate the distance between.
In order to solve it either way I need to know either the geographical shape or the hierarchy of a given geolocation. So how can I get this information?
Thanks
Q1: Yahoo GeoPlanet is what you are looking for. They have this hierical mapping unlike google.
Q2: Google Geocoding API supplies you with bounds of an object. When you have fetched it from Yahoo you could get the bounds off Google. :D
精彩评论