I am new to google maps API. I have created a membership site that businesses use to offer discounts to my members. My goal is to display a map of the businesses near them that are offering a discount, let them get directions and let them search for businesses by zip code or just by moving the map. Can someone tell me what google map API in need to accomplish this and maybe links to documentation so I can start coding. Thanks for the help in advance.
Asked
Active
Viewed 46 times
1 Answers
1
You'll have to practice all of that. Make examples of all your sub-questions.
- Getting started: map with one marker: https://developers.google.com/maps/documentation/javascript/adding-a-google-map
Then put two or three markers there.
- Compute distance between two locations: Google Maps - How to get the distance between two point in metre?
You must have a database that has the location of the clients and (another table with) the location of the businesses.
- Routing / Directions: https://developers.google.com/maps/documentation/javascript/examples/directions-simple
In a for-loop you can see if each business is within reach. Something like
for(var i in business_locations) {
if( google.maps.geometry.spherical.computeDistanceBetween(client_location, business_locations[i]) < max_radius) {
// now create the marker
}
}
You can also filter the data that you get from the DB; Fastest Way to Find Distance Between Two Lat/Long Points
These are the puzzle pieces. You have some work to do.

Emmanuel Delay
- 3,619
- 1
- 11
- 17
-
Thank you very much. I don't mind the work, I look forward to it. – bbedson Aug 06 '17 at 17:01