Finding proximity by latitude and longitude

I am making a market type application where users enter product information and product address, now I geocode that address into latitude and longitude using Google Geodcoder and then process that information in a MySql database. Proximity search works flawlessly as long as I give the user a specific radius to search in the immediate vicinity. However, I cannot determine how I will handle it at the border of the country. I do not want people from India to be able to see the product from Pakistan, it will be a disaster for my statement as both are at war. Any suggestions as to how I can overcome this.

I had other suggestions too : https://dba.stackexchange.com/questions/39115/zip-based-search-in-mysql/39138?noredirect=1#comment69710_39138

However, I want the best and most efficient way to do this. Any help would be much appreciated.

+1


source to share


2 answers


You can check the following PDF and the country restriction, I think you can restrict your search by country by including Where Country = 'XCountry' in your search .



http://www.arubin.org/files/geo_search.pdf

+2


source


You can either take note of the country by address when it is entered, or reverse geocode lat / lon and infer the country from that.



https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false

+1


source







All Articles