[OpenLayers-Users] question about select feature
Eric Lemoine
eric.lemoine at camptocamp.com
Mon Mar 1 02:13:10 EST 2010
On Tuesday, February 23, 2010, Karina Guardado <kguardado at gmail.com> wrote:
> Hello everybody,
>
> I have 2 layers that are point type and I want users to be able to click on one point (of any layer) and get the information(attributes) related to that point. Here is my code
>
> var estaciones = new OpenLayers.Layer.WMS("estaciones",
> "http://myurl/cgi-bin/mapserv?MAP=/var/www/amss_wms2.map",
> {layers:'estaciones', transparent: "true",format:"image/gif"});
>
> var puntos = new OpenLayers.Layer.WMS("puntos",
> "http://myurl/cgi-bin/mapserv?MAP=/var/www/amss_wms2.mapl",
> {layers:'puntos', transparent: "true",format:"image/gif"});
>
> so far what I was using was a text layer to generate a marker and then get the information as follows:
>
> var infpuntos = new OpenLayers.Layer.Text( "infpuntos", {location: "textpunto.php"},
> "http://myurl/cgi-bin/mapserv?MAP=/var/www/amss_wms2.map");
>
> var infestaciones = new OpenLayers.Layer.Text( "infestaciones", {location: "textpunto.php"}, "http://myurl/cgi-bin/mapserv?MAP=/var/www/amss_wms2.map");
>
> but I would like that users could be able to click on one point and get the information without using this text markers. I found information about vector and gml layers with text format but I would like to know how to use them to work with more than one layer or if there are other solutions that someone could recomend.
Hi. Have you considered using the WMSGetFeatureInfo control? You can
check out the getfeatureinfo-control example
<http://trac.openlayers.org/browser/trunk/openlayers/examples/getfeatureinfo-control.html>.
Cheers,
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com
More information about the Users
mailing list