[OpenLayers-Users] Click to get nearest point on track

Phil Scadden p.scadden at gns.cri.nz
Wed Nov 28 14:00:48 PST 2012


> I would like to allow the user to click anywhere on the displayed track or fairly near it, and a javascript function would be fired with the lat and long passed to it of the corresponding point on the track (or if the click is not quite on the track then the NEAREST corresponding point on the track).
If you absolutely have to do this in JS, then I suggest to see what 
support you can find in JSTS. Otherwise, it would be lot faster to do 
this with a servlet.

This is quite straightforward with wfs, but I have never played with 
your format.
> If it is possible, is there likely to be any confusion between this click and a click-to-drag/pan the map?
I have a tool bar with different button to control what function a mouse 
click does. Ie one for zoom/pan, another for polygon select, another for 
point queries which is what this is. You enable/disable controls 
depending on mouse-click. You do need to extend UI beyond basic OL 
offerings but look at the examples.
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users


-- 
Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St, 
Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232

Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.



More information about the Users mailing list