Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    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.

  2. #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Thanked 665 Times in 660 Posts
    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


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts