[OpenLayers-Users] How do I get a marker icons lon/lat?

Christopher Schmidt crschmidt at metacarta.com
Mon Jun 4 18:41:39 EDT 2007


On Mon, Jun 04, 2007 at 11:19:03AM -0400, Ali Khan wrote:
> Hey, so i've got a few markers on a page when i click the marker i want 
> to query a database and load the result into a div. the latter part i 
> have down. In the database the URL or Lon/Lat will be stored of the 
> marker (Each marker will have a unique image).
> 
> So far i have this
>     markers.events.register("click", markers, function(e) {
>             alert(this.icon.url);
> }
> 
> however this.icon.url seems to not be valid according to FireBug and 
> isn't causing an alert box. How can I get the URL of a Marker icon or 
> perhaps the Lon/Lat instead?

'markers' is probably not the object you want to register a click event
on. You'll need to register these events on each individual marker,
using markers.events.register("click", marker... ) 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list