[OpenLayers-Users] Dragging a DOM element onto an OpenLayers map

Marc Jansen jansen.marc at gmx.de
Tue Jul 29 09:58:01 EDT 2008


Hey Kevin,

...all is possible, but I'm sure you know that. :-)

Are your list-items already dragable? If not, I would suggest using an 
existing solution of any JS-framework out there (jQuery and the like).
As for the rest you need a callback on the "drag-end"-event of the li 
that checks if the element is on the map, if yes, it extracts the 
coordinates, and then communicates with your server to store everything. 
Meanwhile you place a marker on your map as described e.g. here:
http://dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers/Layer/Markers-js.html#OpenLayers.Layer.Markers.addMarker

Sorry, but I cannot post ready-to-use code.

-- Marc



Kevin Marsh schrieb:
> I have a list of items in an unordered list (ul) on the same page as  
> my OpenLayers maps. I'd like to be able to drag a list item (li) onto  
> OpenLayers, send an AJAX request (to store the coordinate info on the  
> server), then place a marker on the map in that position.
>
> Is this possible? I've looked through the examples and didn't find  
> anything similar.
>
> Kevin Marsh
> Partner, <form> && f(x)
> Web Incubation, Design, and Development
> Toledo, Ohio
> http://formandfx.com
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>   




More information about the Users mailing list