Loading ...
Sorry, an error occurred while loading the content.

How to add a marker to the map

Expand Messages
  • gene_arnold
    Could I get some help on how to add a marker to a map? Thing is I m only able to add markers to the map with the addoverlay function and not the addmarker one.
    Message 1 of 1 , Jun 11, 2007
    View Source
    • 0 Attachment
      Could I get some help on how to add a marker to a map? Thing is I'm
      only able to add markers to the map with the addoverlay function and
      not the addmarker one. Since I can't use the add marker function I'm
      guessing this is why I can't use the removemarker function. What I
      have so far is a nice table with addresses in it and 2 hyperlinks.
      One link will add the marker to the map and the other is used to
      remove it. Where I have a problem is since I'm setting the marker.id
      myself if the person clicks the add marker link twice I now have two
      markers with the same id on the map and can't remove it :( I was
      hoping there was a clear all way to clean up the map. Here is a
      snippet of my code. Thanks all :)

      function mapIt(objmap,lat,long,id)
      {
      //debugger;
      //Create new point for map
      var myPoint = new YGeoPoint(lat,long);

      // Create a marker positioned at a lat/lon
      var marker = new YMarker(myPoint);

      marker.id = id;

      objmap.addOverlay(marker);

      // Display the map centered on a lattitude and longitude
      objmap.drawZoomAndCenter(myPoint, 1);

      map.addMarker(YGeoPoint, 123)
      }

      function removeIt(objmap,MarkerID)
      {
      //debugger;
      var m = objmap.getMarkerObject(MarkerID)
      //m.hide();
      objmap.removeOverlay(m)
      }
    Your message has been successfully submitted and would be delivered to recipients shortly.