问题
I am making a market type application, in which users enter product details and product address, now I Geocode this address into latitude and longitude using Google Geodcoder and further I process this information into MySql Database. The proximity search is working flawless if I provide a user defined radius for searching in the vicinity. However I am not able to determine as to how will I handle it at the border of a country. I dont want people from India to be able to view a product from Pakistan, this will prove a disaster for my application as both are at war. Any Suggestions as to how can I overcome this.
I had some other suggestions too at: https://dba.stackexchange.com/questions/39115/zip-based-search-in-mysql/39138?noredirect=1#comment69710_39138
However I want the best and the most efficient way of doing this. Any help would be highly appreciated.
回答1:
You can check the following PDF and for restriction of countries, I think you can restrict the search to a country by including the Where Country = 'XCountry' in your search query.
http://www.arubin.org/files/geo_search.pdf
回答2:
You could either take note of the country from the address when it is entered, or reverse geocode the lat/lon and pull the country from that.
https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false
来源:https://stackoverflow.com/questions/15968245/proximity-search-based-on-latitude-and-longitude