In addMarker, I''m suggesting something like gpin._mapstraction_marker = marker; And then in addAPI GEvent.addListener(this.maps[api], ''click'', function(marker,location) { // If the user puts their own Google markers directly on the map // then there is no location and this event should not fire. if ( location ) { me.clickHandler(location.y,location.x,location,marker._mapstraction_marker,me); } }); Make sense? ----- Original Message ---- From: dominic depetris <ddepetris1 at yahoo.com> To: Mikel Maron <mikel_maron at yahoo.com>; mapstraction at openstreetmap.org Sent: Monday, November 26, 2007 2:44:32 PM Subject: Re: [Mapstraction] (no subject) OK. I am confused. How do I make the addMarker function set a reference to the proprietary marker? I tried case ''google'': case ''openstreetmap'': var gpin = marker.toGoogle(); marker.setChild(gpin); map.addOverlay(gpin); if (! old) { this.markers.push(marker); // added this line this.markers.push(gpin); } break; and that didn''t work. Were you saying do this.markers.push(marker,gpin); ? Thanks Dom ----- Original Message ---- From: Mikel Maron <mikel_maron at yahoo.com> To: dominic depetris <ddepetris1 at yahoo.com>; mapstraction at openstreetmap.org Sent: Thursday, November 22, 2007 3:33:14 AM Subject: Re: [Mapstraction] (no subject) Ok I see. Of course the marker that is returned by Google to that callback is a proprietary marker, not the Mapstraction marker. So in Mapstraction.addMarker, the proprietary marker needs a reference set to the mapstraction marker. Then the call to me.clickHandler would pass the mapstraction marker. In you doClick callback, you''d then call marker.map.removeMarker(marker), since the Mapstraction marker does already contain a reference to the Map object. Does that make sense? I can clarify if anything is confusing. ----- Original Message ---- From: dominic depetris <ddepetris1 at yahoo.com> To: Mikel Maron <mikel_maron at yahoo.com>; mapstraction at openstreetmap.org Sent: Monday, November 19, 2007 3:48:29 PM Subject: Re: [Mapstraction] (no subject) Hello Mikel, Sorry it took me so long but work has me busy. I implemented what you suggested for Google. It had some small issues. I had to change me.clickHandler(location.y,location.x,location,marker,me); to me.clickHandler(location.y,location.x,marker,me); Now I know when I click a marker. In my doClick function I do the following if (marker) { alert("clicked a marker"+marker.getLatLng()); map.removeMarker(marker); } else { processPoint(point); } The map.removeMarker(marker) doesn''t work. However if I do if (marker) { marker.hide(); } else { processPoint(point); } the marker is hidden. Any ideas? Thanks again Dominic ----- Original Message ---- From: Mikel Maron <mikel_maron at yahoo.com> To: dominic depetris <ddepetris1 at yahoo.com>; mapstraction at openstreetmap.org Sent: Thursday, November 8, 2007 2:33:01 PM Subject: Re: [Mapstraction] (no subject) Hi Dominic I''m thinking something like.. GEvent.addListener(this.maps[api], ''click'', function(marker,location) { // If the user puts their own Google markers directly on the map // then there is no location and this event should not fire. if ( location ) { me.clickHandler(location.y,location.x,location,marker,me); } }); This would need to be repeated for each API Mapstraction.clickHandler would be modified as well. Mapstraction.prototype.clickHandler = function(lat,lon, marker, me) { //FIXME need to consolidate some of these handlers... for(var i = 0; i < this.eventListeners.length; i++) { if(this.eventListeners[i][1] == ''click'') { this.eventListeners[i][0](new LatLonPoint(lat,lon), marker); } } } Then if you wanted your own callback to receive the marker, you''d define it like map.addEventListener(''click'',function (point, marker) { doClick(point, marker); } ); If you were only interested in the point, then the old way should still work. map.addEventListener(''click'',function (point) { doClick(point); } ); Mikel ----- Original Message ---- From: dominic depetris <ddepetris1 at yahoo.com> To: Mikel Maron <mikel_maron at yahoo.com>; mapstraction at openstreetmap.org Sent: Wednesday, November 7, 2007 4:52:18 PM Subject: Re: [Mapstraction] (no subject) Hello Mikel, Please understand that I am not the worlds best Javascript coder so bear with me if I''m a little slow. Currently I do the following; map.addEventListener(''click'',function (point) { doClick(point); } ); where doClick does a bunch of stuff. You are saying that I would need to change the addAPI in the mapstraction.js to do what I want. That''s where I get lost. Would I, for example, for Google, change this GEvent.addListener(this.maps[api], ''click'', function(marker,location) { // If the user puts their own Google markers directly on the map // then there is no location and this event should not fire. if ( location ) { me.clickHandler(location.y,location.x,location,me); } }); to have an if (marker) option? Would I have to change the clickHandler function? Thanks for your help with this, Dominic ----- Original Message ---- From: Mikel Maron <mikel_maron at yahoo.com> To: dominic depetris <ddepetris1 at yahoo.com>; mapstraction at openstreetmap.org Sent: Tuesday, November 6, 2007 6:36:06 AM Subject: Re: [Mapstraction] (no subject) hi Dominic Mapstraction would need some small tweaks to accomplish this. Currently you can register a ''click'' event handler using addEventListener. But the call back function only receives the lat/long of the location clicked -- not a reference to the marker if it exists. The interfaces to each API''s event handling is set up in addAPI. These would need to be modified to pass through a reference to the mapstraction marker. To retrieve the mapstraction marker linked to the proprietary marker, a reference would need to be added in the Marker.setChild method. Mikel ----- Original Message ---- From: dominic depetris <ddepetris1 at yahoo.com> To: mapstraction at openstreetmap.org Sent: Friday, November 2, 2007 12:36:17 PM Subject: [Mapstraction] (no subject) I am trying to figure out how to remove a specific marker on a map. Let?s say there are 10 markers on a map and the user wants to remove one of them by clicking on it. How do I know what marker has been selected? By the way, this program has been extremely helpful. Thanks! Dominic __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Mapstraction mailing list Mapstraction at lists.mapstraction.com http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ ____________________________________________________________________________________ Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ