On Apr 22, 6:14 am, xman4belgium <[email protected]> wrote: > Hi, i have a strange issue with new icon i want to display on a Google > Map. > I'm using the GDirections object to show a route between 2 points, and > i'd like to change the icon for one of the 2 points. > > Here is the code I use: > > <script type="text/javascript" language="javascript"> > > var map; > var directionsPanel; > var directions; > > function initialize() { > map = new GMap2(document.getElementById("map_canvas")); > //map.setCenter(new GLatLng(42.351505,-71.094455), 15); > directionsPanel = document.getElementById("route"); > > directions = new GDirections(map, directionsPanel); > GEvent.addListener(directions, "load", onGDirectionsLoad); > var addr1 = "some address"; > var addr2 = document.getElementById("my_address").value; > > directions.load("from:"+addr1+" to:"+addr2); > } > > function onGDirectionsLoad(){ > // Create our own marker icon > var blueIcon = new GIcon(G_DEFAULT_ICON); > blueIcon.image = "http://gmaps-samples.googlecode.com/svn/ > trunk/markers/blue/blank.png"; > > // Set up our GMarkerOptions object > markerOptions = { icon:blueIcon }; > > var mark = directions.getMarker(0); > var newMarker = new GMarker(mark.getLatLng(), markerOptions); > map.removeOverlay(mark); > //alert(newMarker); > map.addOverlay(newMarker); > } > > I do not get any JS error, but still i can't see anything happening ! > > Anybody has an idea ?
I don't see anything obviously wrong. However I am from Missouri (show me that it doesn't work...) Please read and follow the posting guidelines. Post a link to your map that shows the problem, not code. http://groups.google.com/group/Google-Maps-API/web/suggested-posting-guidelines -- 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 -~----------~----~----~----~------~----~------~--~---
