On Jul 29, 9:44 pm, kenja <[email protected]> wrote:
> We have an application where we've created custom icons for each point
> on the map.
>
> We process and display the icons as follows:
> for (var i = 0; i < locations.length; i++) { // cycle thru locations
>         points[i] = new GLatLng(locations[i].getAttribute("lat"),locations
> [i].getAttribute("lng"));
>         bounds.extend(points[i]);
>         if(locations[i].getAttribute("icon")=="DESTINATION"){
>                 markers[i] = new GMarker(points[i], dest_icon);
>         }
>         else if(locations[i].getAttribute("icon")=="ORIGIN"){
>                 markers[i] = new GMarker(points[i], origin_icon);
>         }
>         else if(locations[i].getAttribute("icon")=="CURRENT"){
>                 markers[i] = new GMarker(points[i], box_icon);
>         }else{
>                 markers[i] = new GMarker(points[i], transfer_icon);
>         }
>         map.addOverlay(markers[i]);
>
> }
>
> That function works great and displays the markers as we want.  We
> recently switched from using loadFromWaypoints() to load() for our
> gDirections calls and now we seem to be getting the google default
> markers in addition to the custom markers.  Commenting out the
>
> map.addOverlay(markers[i]);
>
> line takes away our custom markers, as expected, but the default ones
> remain.  How does one specify that we don't want to display default
> markers on the returned directions?  Can we override them somehow?
>
> Below is the function that is displaying the directions (and the
> default markers it seems).
>
> function addDirections( leg ) {
>         var directions = new GDirections(map);
>         directions.load("from: " + leg[0] + " to: " + leg[1],
> {'preserveViewport': 'true'});
>     }
>
> Thanks for your help!


Please post a link to your map, not code.
You have 2 options:
1. let the GDirections class add the polyline and the markers to the
map automatically, then remove the markers and replace them with your
custom ones.
or
2. don't let the GDirections class add the polyline and markers,
capture them, add the polyline, replace the markers with your custom
ones.

  -- Larry
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to