[OpenLayers-Users] selecting a feature in a base layer
Alexandre Dube
adube at mapgears.com
Sun Feb 15 11:21:59 EST 2009
Hi,
You can only interact with vector features, not just plain images. The
layer you're referring to ( country boundaries ) is a WMS layer so it
returns an image only.
If the server that renders that image is also configured to return
geometry ( like a WFS server for example ) then you could have a vector
layer of country boundaries and interact with it. One major problem with
this that the polygon features returned would contain a lot of geometry
and take a lot of time to display. Browsing your map would be slow too.
A common practice is to have a WMS layer on top zoom levels and have
your vector features displayed on lower levels.
See the following example showing what I mean (zoom in/out the map) :
http://dev4.mapgears.com/bdga/bdgaWFS-T.html
If you have your own data to play with, I would suggest you to read the
following articles to create your own WFS server and play with your own
data : http://mapserver.org/ogc/wfs_server.html
Best of luck with your learning and welcome to the community,
Alexandre
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
>
--
Alexandre Dubé
Mapgears
www.mapgears.com
More information about the Users
mailing list