With most features for the map, you can find out if they are currently displayed by using the getMap methods. Here's an example:
if(mymarker.getMap()) mymarker.setMap(null); //turn off the marker if it was shown This will also work with polylines. In your case, since you only want one at a time, I might suggest that you only use 1 polyline. You can store and update the path with mypolyline.setPath(arrayOfLatLngPoints). You can also only use 2 markers (one start, one end). With markers you would simply update the position: startMarker.setPosition(myStartingPoint). Chad Killingsworth On Jun 28, 4:41 pm, 3D-kreativ <[email protected]> wrote: > Hi! > > I have made a map with three different walking path that I show as > polylines. I just want to show one polyline + one start and one goal > marker. Every time someone choose to show another walking path by > showing a another polyline the script must first check if there are > any other polylines and start and goal marker on the map and hide > them. > > That is my problem, to know in some way if a polyline is set and how > to hide it. Aswell how to hide single markers on the map? I have > modified and shorten the walking path on the map just to make the code > as simple as posible. I vave also tried to make a function that hides > a polyline, but I closed that with // because it didn't work. I have a > "hide" button for each polyline, but this is only to show how I mean. > I only want buttons to show polylines. The hiding process I want in > the code. I hope you readers understand what I mean? Please have a > look at the site and the code. > > Preciate some help! Thanks! > > http://fredagsmat.se/map.html -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
