Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
04-04-2014, 04:40 PM #1
- Join Date
- Aug 2013
- Thanked 0 Times in 0 Posts
Adding Directions into the Google Maps API
I was searching google (even went to the second page ) and was trying to find an example of embedded the google maps api into a website but also adding another feature.
Right now, I have a pointer at wheere our company is located, but was wondering if there would be a possible way to maybe add a button that will get your current location and give directions on the map on how to get to our location. Also maybe even take the text direction and somehow display that. We have a direction from the highway section but maybe replace those direcetions with the text directions from your current location.
Any starting points?
Not looking for answers, just a push in the right direction.
04-04-2014, 05:24 PM #2
Google has published lots of code examples for the maps API - have a look at this page
Sounds to me like what you want to do is to combine geolocation with the directions service (displaying text directions)
It would make sense to me to:
1. Have a "get directions to here from my location" button in the infowindow for your company location marker
2. On clicking that button, the geolocation code runs
3. Once the geolocation result is returned, feed that to the directions service as the start point, with the end point being your company.
It's all fairly simple and well-documented if you take it step by step. You might want to add some error handling in case geolocation fails. Let us know if you run into problems