Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 670719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:17:42+00:00 2026-05-14T00:17:42+00:00

I just started working using Google Maps API yesterday, and trying to set up

  • 0

I just started working using Google Maps API yesterday, and trying to set up drive directions to my map. My problem is: when I call the function load,

// [...]  
gdir = new GDirections(map, directionsPanel);  
// [...]  
gdir.load("from: " + fromAddress + " to: " + toAddress);  

it returns a map whose markers are not draggable. So, I need to make them draggable in order to recalculate the directions, but I can’t get the markers objects.

Someone knows how can I do it?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:17:42+00:00Added an answer on May 14, 2026 at 12:17 am

    You need to add a handler on the GDirections object for the addoverlay event:

    GEvent.addListener(gdir, "addoverlay", onGDirectionsAddOverlay);
    

    When your onGDirectionsAddOverlay handler is called you can iterate through the new markers and replace them with draggable copies:

    for (var i = 0; i <= gdir.getNumRoutes(); i++) 
    {
        var originalMarker = gdir.getMarker(i);
        latLngs[i] = originalMarker.getLatLng();
        icons[i] = originalMarker.getIcon();
        newMarkers[i] = new GMarker(latLngs[i], { icon: icons[i], draggable: true, title: 'Kan flyttes' });
        map.addOverlay(newMarkers[i]);
    
        // add stuff to your newMarkers[i] drag end event...
        // ...
    
        //Bind 'click' event to original markers 'click' event
        copyClick(newMarkers[i], originalMarker);
    
        // Now we can remove the original marker safely
        map.removeOverlay(originalMarker);
    }
    

    You can find a working example of this here (source).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just started using virtualenv, and it was working normally until yesterday. Now, and
I am just getting started working with Google API and OAuth2. When the client
I am working on ubuntu OS,I have started working on pentaho-BI using eclipse.. Just
Just started working with .NET and MVC(1). I'm having a problem wherein in my
I've just started using google charts and want to use it in a small
So I've just started working with linq as well as using lambda expressions. I've
I am pretty new to image capturing using java. Just started working in java.
I just started learning Zend. I managed to get the basic working (using zf
I just started working on a project that will run on google app engine
I've just started working with Java, and I've been trying to get the console

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.