On Mar 10, 12:32 pm, "[email protected]"
<[email protected]> wrote:
> If you click on any of the markers there is a link inside the info
> window with the message "remove pin" - when that link is clicked I
> would like the marker to be removed. However I still cant get this to
> work - I have tried to put all the markers into a universal array
> named M, but I am still having the same problems. The remove pin link
> sends back a value (m_number) which should be the markers position in
> the array M, and the removeMarker() function runs this line:
>
> map.removeOverlay(m[m_number]);
>
> but this still doesnt work.
>
> Am I being dim here? Is there a obvious solution staring me in the
> face? Ive tried various things but nothing works, and Im sure I am
> doing something silly which is stopping this from working but
> currently have no clue as to what Im doing wrong.

What you are currently doing is adding GLatLngs to m[], not GMarkers.
A marker is a GMarker object, not a GLatLng.

I would suggest altering your makeStartMarkers function thus
  var m0 = new GLatLng(52.849421992870795, -3.0402115881634018);
  //m[0]=new GLatLng(52.849421992870795, -3.0402115881634018);
  //m[0]=m0;
  var m[0] = createMarker(m0, 0, "Newgate Clocks");

so that each marker created and added by createMarker is stored in
your array m[].

Then you should be able to remove the marker within removeMarker,
because m[0] will be a marker:
  function removeMarker(m_number) {
    map.getInfoWindow().hide();
    map.removeOverlay(m[m_number]);
    }

For the future: you don't need 12 decimal places on a GLatLng. Six is
enough to get a marker located to within inches. And do be careful
with case-sensitivity when describing Javascript: an array named M is
not the same as an array named m.

Andrew
--~--~---------~--~----~------------~-------~--~----~
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