Proximity search based on Latitude and Longitude

杀马特。学长 韩版系。学妹 提交于 2020-01-05 10:31:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!