[OpenLayers-Users] GetFeature info from a MapServer WMS

Yves Moisan yves.moisan at boreal-is.com
Fri Jul 18 16:39:14 EDT 2008


Hi All,

Audience of this message : users of MapServer (WMS).

I'm trying to find examples of how to retrieve attributes from a postgis
table served via MapServer WMS.  I have my points in OL, now I want and
"info" on them.  I understand I have to enable the layer to be queryable
in my mapfile.  So I googled and found a top level directive (QUERY \n
STATUS ON), but that was found to be an offending command.  I also found
a bunch of other directives, so my mapfile now looks like this : 

 METADATA
   # OGC:WMS specific tags
   "ows_title"    "Resettlement Sites"  
   "ows_abstract"    "RAP Resettlement Sites"
   "ows_keywordlist"    "Resettlement, TFM" 
   "ows_srs" "EPSG:32735"
   "wms_opaque"    "0"
   "wms_group_title" "Data"
   "wms_group_abstract"  Data"
   "wms_dataurl_href" "http://someserver:8081/data/"
   "wms_dataurl_format" "text/html"
   "ows_metadataurl_type" "FGDC"
   "ows_metadataurl_href"
"http://someserver:8081/ms_ogc_workshop/index.html"
   "ows_metadataurl_format" "text/html"
   "ows_extent" "389443 8816705 442791 8858984"

   # OGC:WFS specific tags

# /WFS_Capabilities/FeatureTypeList/FeatureType[*]/MetadataURL/@format
   "wfs_metadataurl_format" "TXT"
   # specify which fields to include when returning queries
   "gml_include_items" "all" 

The mapfile top level projection is set to 900913 and that gets
translated fine overtop of a Google base layer.  

On the OL side, I found some InfoButton code which I think I have
adapted correctly for my layer.  I don't see anything when I click on my
map.  I'm obviously missing something and I won't go into the details,
but rather I will just ask for pointers to example MapServer served WMS
layers that are queryable through OL (that is, one clicks and some div
gets populated with attribute content or better some popup appears)
showing all settings.  I am a bit flabergasted by the number of moving
parts.  

Just for the sake of it, I extracted my data and turned it into a
textfile which I then used in OpenLayers.Layer.Text (as per
http://wiki.openstreetmap.org/index.php/Openlayers_POI_layer_example).
OOTB, one gets a nice popup, default icon and default html formatting.
I wonder if one could get as easy a popup solution for a WMS served
queryable layer ?  I wouldn't be so crazy as to generate a textfile on
the fly to duplicate my layer so that it becomes easily queryable ...

Thanx for pointers,

Yves Moisan




More information about the Users mailing list