[OpenLayers-Users] GetFeature info from a MapServer WMS
percy
percyd at pdx.edu
Fri Jul 18 17:49:30 EDT 2008
here's an example from your openlayers download, modify your version to
point to your server, etc
http://openlayers.org/dev/examples/getfeatureinfo.html
there's a nice "cookbook" for serving WMS data on the OneGeology website:
http://www.onegeology.org/misc/downloads.html
and here's a relevant section from one of my mapfiles below. It should
work just fine with a postgis connection instead of shapefile, as I am using
HTH,
Percy
------------mapfile stuff-------------
LAYER
NAME "Geologic_Map_Of_North_America"
TYPE polygon
STATUS On
data GMNA_South_Union_wgs84
TOLERANCE 0
TOLERANCEUNITS pixels
TRANSFORM TRUE
DUMP TRUE
HEADER "templates/GMNA_query_header.html"
TEMPLATE "templates/GMNA_query_body.html"
FOOTER "templates/GMNA_query_footer.html"
Metadata
"WMS_TITLE" "Geologic Map Of North America"
"WMS_SRS" "epsg:4326"
GML_INCLUDE_ITEMS
"DisplayNam,OneGeology,Lithologic,GeologicAg,AgeMin,AgeMax,AgeMetadat"
WMS_INCLUDE_ITEMS
"DisplayNam,OneGeology,Lithologic,GeologicAg,AgeMin,AgeMax,AgeMetadat"
END # metadata
END #layer
-------------------end of mapfile stuff-----------
Yves Moisan wrote:
> 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
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
--
David Percy
Geospatial Data Manager
Geology Department
Portland State University
http://gisgeek.pdx.edu
503-725-3373
More information about the Users
mailing list