Max Distance Limit in Google Maps
Hi Folks,
I need to be able to cap the search distance from a zip code query to 20 miles and only return any relevant markers within that distance on the map.
Any help will be greatly appreciated
Thanks
Hi Folks,
I need to be able to cap the search distance from a zip code query to 20 miles and only return any relevant markers within that distance on the map.
Any help will be greatly appreciated
Thanks
You will want to store the latitude and longitude of the locations in your database. Then you can use a query to only return results in a certain radius based on the location like:
SELECT
`id`,
(
6373 *
acos(
cos( radians( :lat ) ) *
cos( radians( `lat` ) ) *
cos(
radians( `long` ) - radians( :long )
) +
sin(radians(:lat)) *
sin(radians(`lat`))
)
) `distance`
FROM
`location`
HAVING
`distance` < :distance
ORDER BY
`distance`
LIMIT
25
:lat and :long are the points the passed by the user where lat and long are the points stored in the database.
This is something I can help with in a premium support ticket.
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.