I have a website where I store locations in a MySQL database and GeoCode using the address provided by the database.
Now I want to add a feature which will find the closest places to the specified point e.g. the location they are standing now or typing. I’m coding the geocoder and google maps in JavaScript and jQuery and I get the results using PHP to fetch from the database.
I read about the viewport but I can’t figure out how it would work in my situation where I need to show my own database locations and not Google’s.
Can anybody help? And it would be awesome if you have some kind of example.
radius search:
3959 is the Earth radius in Miles. Replace this value with
radius in KM, or any unit, to get results on the same unit.
centerLat and centerLon are the center of the search (your
input), while lat and lon are fields in the table.