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.
source to share
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
source to share