[OpenLayers-Users] snap to road
Stephen Woodbridge
woodbri at swoodbridge.com
Wed Mar 18 12:23:24 EDT 2009
emmexx wrote:
> I started to study OL a couple of weeks ago so I don't master it pretty
> well.
> I wrote some simple code based on the examples.
> I'm going to write a web application that will have to manage complex
> data about cycleways and users will draw routes on a map.
>
> I don't know if the user will be restricted to use just one map
> (opencyclemap or gmaps or something else) but I'd like to know if the
> following features are available in OL:
>
> 1. is it possible to get info from the "map"? I mean, if I click on a
> road is it possible to get some kind of info from the map about that road?
>
> 2. is it possible to use snapping on a layer map rather than on a vector
> layer?
maxx,
You can not do this strictly in OL, but you can do it with some help
from the server. Here is the high-level approach to the problem.
1) user clicks on map
2) in OL, you get the click, convert it to lat/lon and pass it to the server
3) the server then returns info about the nearest line and maybe it
snaps the point to that line and returns that info also
3a) if the server returns the geometry of the feature, then you can snap
to that in javascript
4) you get the return package of data and use in OL
WMS and Mapserver let you query more info based on a coordinate.
You might need to write an AJAX handler on the server to help process
your query requests.
I will leave the details to others and maybe someone can point out an
example that does some of these pieces.
-Steve W
More information about the Users
mailing list