[OpenLayers-Users] selecting a feature in a base layer
Stephen Woodbridge
woodbri at swoodbridge.com
Sun Feb 15 11:28:31 EST 2009
Most base layers are images. In you example mapserver is generating an
image from the vector data and sending the image to OL to be displayed.
In a vector layer you will be limited to about 100 vectors before you
overload the browser so it is probably not a suitable solution for your
task at hand.
I'm not sure where the point data is coming from, ie: client/server side
data, but you will probably want to set up a process on the server side
that snaps the point to the road network. If you are thinking about
doing something that is commonly done in GPSs where the current position
tracks road segments, you need to think about a gravity function also.
The purpose of the gravity function is to cause the point to have a
propensity to stay on the current track instead of jumping to parallel
or near by segments as it move over the map. Think about following a
highway, but the actual track is offset to the right of the highway
segments. When you come to an underpass cross street, you do not want
your track to momentarily jump to the cross street then jump back to the
highway.
-Steve
new2ms4w wrote:
> Hi,
>
> I used MapServer with OpenLayers to display the road map of a country. Now,
> I want to select a particular and add a moving object to it.
>
> Adding a moving object to the map is easy. ( I drew a point on the map and
> I'm just moving it by calling OpenLayers.Geometry.move() )
> However I want these points to move only on roads.
>
> So, first I need to select a road and then add the moving object. This is
> the hard part for me.
>
> The examples section has an example (OpenLayers Select Feature Example
> http://www.openlayers.org/dev/examples/select-feature.html ) showing how to
> select a point, line or polygon (or any vector feature) which I draw there
> by either drawing a box or moving mouse over the feature etc.
>
> But how do we select a feature from the base layer? (Does the base layer
> even have features at all?)
> By this what I mean is how do we select the country boundaries in the above
> webpage.
>
> Thank you for your time. I'm a student just started using OpenLayers around
> 1 week back. So, please bear with my questions.
>
> ~PN
More information about the Users
mailing list