Google Maps API: GDirections with no Markers

I’ve been working with the Google Maps API quite a lot over the past couple of weeks, but one thing that has continuously thwarted me, has been how to remove the little Info Window maps from a route that has been loaded using GDirections and finally I have found the answer. When you load a GDirections object with the optional map panel in the constructor it automatically places the route and markers on the map. The work around is to not provide any arguments to the constructor, and instead load retrieve the GPolyline with the getPolyline method and the getPolyline: true option. Then in the “load” event, add it to the map and presto.


var dirs = new GDirections();
GEvent.addListener(dirs, "load", function() {
var polyline = dirs.getPolyline();
map.addOverlay(polyline);
});
dirs.loadFromWaypoints("Directions from here to there", {getPolyline: true});

20,628 thoughts on “Google Maps API: GDirections with no Markers

  1. This is very interesting, You are a very skilled blogger. I ave joined your feed and look forward to seeking more of your magnificent post. Also, I ave shared your website in my social networks!

  2. I am not sure where you are getting your info, but good topic.

    I needs to spend some time learning much more or
    understanding more. Thanks for wonderful info I was looking for this info for
    my mission.

  3. Its like you read my mind! You seem to know so much about this,
    like you wrote the book in it or something. I think that you could
    do with some pics to drive the message home
    a little bit, but instead of that, this is
    excellent blog. A great read. I will definitely be back.

    My page male skin care

  4. Please let me know if you’re looking for a author for
    your site. You have some really great articles and I feel I would be a good asset.
    If you ever want to take some of the load off,
    I’d really like to write some material for your blog in exchange for a link
    back to mine. Please send me an e-mail if interested.

    Cheers!

    My website :: paleo diet tips

  5. I seriously love your blog.. Pleasant colors & theme. Did you build this site yourself?

    Please reply back as I’m attempting to create my own personal blog and would like to know where
    you got this from or just what the theme is called.

    Cheers!

  6. Pingback: عمليات استئصال الثدي

  7. Pingback: Ashley Premchand Rocharam

  8. Pingback: cctv installation mhala

Leave a Reply

Your email address will not be published. Required fields are marked *