WMS GetFeatureInfo

Richard Duivenvoorde rdmailings at DUIF.NET
Thu Jan 31 11:50:18 PST 2008


Hi Milo,
did you succeed?

I've mapserver running here with a flamingo client example.
All configs below, hope this is helpfull:


This is de layer def from the mapfile:

LAYER
   NAME pc4p
   DEBUG ON
   TRANSPARENCY ALPHA
   TOLERANCE 15
   DUMP TRUE
   METADATA
       "wms_title" "PC4CODE"
       "wms_feature_info_mime_type"  "text/html"
       "gml_featureid" "oid" ## REQUIRED
       "ows_feature_info_mime_type"  "text/html"
       "ows_include_items" "all"
       #"gml_include_items" "PC4NAAM"
       "gml_include_items" "all"
       "wms_include_items" "all"
   END # METADATA
     # query templates for queries
     # MUST BE AVAILABLE FOR GETFEATUREINFO REQUESTS
     # responds to OGC:WMS 
request=GetFeatureInfo......&info_format=text/html
     HEADER   "C:\ms4w\Apache\htdocs\ol\pc_header.html"
     TEMPLATE "C:\ms4w\Apache\htdocs\ol\pc.html"
     FOOTER "C:\ms4w\Apache\htdocs\ol\pc_footer.html"
   TYPE POINT
   STATUS ON
   CLASSITEM 'HUISHOUDEN'
   DATA pc4
   PROJECTION
     "init=epsg:28992"
   END
   CLASS
     EXPRESSION ([HUISHOUDEN] > 10000)
     STYLE
         SYMBOL 'punt'
         SIZE 60
         COLOR 255 0 0
         OUTLINECOLOR 255 0 0
     END
   END
   CLASS
     EXPRESSION ([HUISHOUDEN] > 2000)
     STYLE
         ANTIALIAS TRUE
         SYMBOL 'punt'
         SIZE 15
         COLOR 255 0 0
         OUTLINECOLOR 255 0 0
     END
   END

This is the kind of url's flamingo is firing:
http://localhost/cgi-bin/mapserv.exe?map=test.map&REQUEST=GetFeatureInfo&SERVICE=WMS&FEATURE_COUNT=10&Y=177&X=407&SRS=EPSG:28992&VERSION=1.1.1&EXCEPTIONS=application/vnd.ogc.se_xml&INFO_FORMAT=application/vnd.ogc.gml&QUERY_LAYERS=pc4p&LAYERS=pc4p&HEIGHT=333&WIDTH=916&BBOX=-297620.12012012,300000,582620.12012012,620000

This is the gml output of mapserver which is nicely shown in flamingo:

<?xml version="1.0" encoding="ISO-8859-1"?>

<msGMLOutput
	 xmlns:gml="http://www.opengis.net/gml"
	 xmlns:xlink="http://www.w3.org/1999/xlink"
	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<pc4p_layer>
		<pc4p_feature>
			<gml:boundedBy>
				<gml:Box srsName="EPSG:28992">
					<gml:coordinates>88589.000000,463018.000000 
88589.000000,463018.000000</gml:coordinates>
				</gml:Box>
			</gml:boundedBy>
			<PC4CODE>2241</PC4CODE>
			<PC4NR>2241</PC4NR>
			<PC4NAAM>ZIJLWATERING EN HAVEN</PC4NAAM>
			<XCOORD>88589</XCOORD>
			<YCOORD>463018</YCOORD>
			<PC3CODE>224</PC3CODE>
			<PC2CODE>22</PC2CODE>
			<PC1CODE>2</PC1CODE>
			<PROVC>28</PROVC>
			<PROVC_NM>Zuid-Holland</PROVC_NM>
			<GEMCODE>0629</GEMCODE>
			<GEMNR>629</GEMNR>
			<GEMNAAM>Wassenaar</GEMNAAM>
			<WOONPLAATS>WASSENAAR</WOONPLAATS>
			<HUISHOUDEN>4557</HUISHOUDEN>
			<NETNUMMER>070</NETNUMMER>
		</pc4p_feature>
		<pc4p_feature>
			<gml:boundedBy>
				<gml:Box srsName="EPSG:28992">
					<gml:coordinates>87278.000000,438832.000000 
87278.000000,438832.000000</gml:coordinates>
				</gml:Box>
			</gml:boundedBy>
			<PC4CODE>3125</PC4CODE>
			<PC4NR>3125</PC4NR>
			<PC4NAAM>INDUSTRIEGEBIED T.N.V. RIJKSWEG2</PC4NAAM>
			<XCOORD>87278</XCOORD>
			<YCOORD>438832</YCOORD>
			<PC3CODE>312</PC3CODE>
			<PC2CODE>31</PC2CODE>
			<PC1CODE>3</PC1CODE>
			<PROVC>28</PROVC>
			<PROVC_NM>Zuid-Holland</PROVC_NM>
			<GEMCODE>0606</GEMCODE>
			<GEMNR>606</GEMNR>
			<GEMNAAM>Schiedam</GEMNAAM>
			<WOONPLAATS>SCHIEDAM</WOONPLAATS>
			<HUISHOUDEN>151</HUISHOUDEN>
			<NETNUMMER>010</NETNUMMER>
		</pc4p_feature>
	</pc4p_layer>
</msGMLOutput>

This is the corresponding flamingo config:
<?xml version="1.0" encoding="UTF-8"?>
<FLAMINGO xmlns:fmc="fmc" lang="en" tooltipdelay="500" >
<YGUIDE id="my" y="50%"/>
<XGUIDE id="mx" x="50%"/>
<XGUIDE id="x10" x="10"/>
<fmc:ToolGroup  listento="map1"  left="x10" top="10">
<fmc:ToolPan  left="30" clickdelay="0" pandelay="0"/>
<fmc:ToolZoomin left="60" zoomdelay="0" clickdelay="0"/>
<fmc:ToolZoomout left="90" zoomdelay="0" clickdelay="0"/>
<fmc:ToolIdentify  left="120"/>
</fmc:ToolGroup>
<!-- identify window -->
<fmc:Window left="90" top="10" width="200" height="350" visible="false" 
skin="g" canclose="true" canresize="true" showresizebutton="true" 
defocusalpha="70">
     <string id="title" en="Informatie:"/>
     <fmc:Identifyresults width="100%" height="100%" listento="map1">
         <!-- progress gebeuren, bij mij (engels) zie je nu lekker niks -->
         <string id="startidentify"  en="" nl="Info wordt opgehaald"/>
         <string id="identify"  en="" nl="[progress]%"/>
         <string id="finishidentify"  en="" nl="Informatie"/>
         <!--<string id="startidentify"  en="Loading" nl="Info wordt 
opgehaald"/>
         <string id="identify"  en="[progress]%" nl="[progress]%"/>
         <string id="finishidentify"  en="Information" nl="Informatie"/>-->
     </fmc:Identifyresults>
</fmc:Window>

<fmc:MonitorLayer id="monitor" left="150" top="15" listento="map1"/>
<!--
<fmc:Debugger listento="map1" left="50%" top="0" height="50%" 
right="right" />
<fmc:Debugger listento="pc4" left="50%" top="50%" height="50%" 
right="right" />
-->
<fmc:Map id="map1" left="0" top="0" bottom="bottom" right="75%" 
visible="true" extent="-15000,300000, 300000, 620000" 
fullextent="-15000,300000, 300000, 620000">
<fmc:LayerIdentifyIcon  id="identifyicon"  />
<fmc:LayerGrid id="grid" gridwidth="10" gridheight="10"/>
<!--<fmc:LayerOGWMS id="pc4" visible="true" 
url="http://localhost/cgi-bin/mapserv.exe?map=test.map" service="WMS" 
version="1.1.1" srs="EPSG:28992" query_layers="" layers="pc4"/>-->
<fmc:LayerOGWMS id="pc4" visible="true" 
url="http://localhost/cgi-bin/mapserv.exe?map=test.map" service="WMS" 
version="1.1.1" srs="EPSG:28992" query_layers="pc4p" layers="pc4,pc4p"/>
<fmc:LayerOGWMS id="ref" visible="true" 
url="http://localhost/cgi-bin/mapserv.exe?map=ontrackreferentie.map" 
service="WMS" version="1.1.1" srs="EPSG:28992" query_layers="" 
layers="top25,top50,top250v,nlbasis,plaatsen"/>

</fmc:Map>
</FLAMINGO>

Hope this is helpfull ;-)

Richard Duivenvoorde

Milo van der Linden wrote:
> Hello Bart,
> 
> I think that is what I already did. Instead of feature_info_mime_type, I 
> got wms_feature_mime_type; can that be a typo?
> I added feature_info_mime_type to the web section to test, but there is 
> no effect, still no featureinfo. I am also posting on the flamingo-mc 
> forum to see if they got some suggestions.
> 
> In the Map section I got:
>  
> ---- snippet ----
> WEB
>     IMAGEPATH 'E:/maptemp/'
>     IMAGEURL '/ms_tmp/'
>     HEADER "./templates/query_header.html"
>     FOOTER "./templates/query_footer.html"
> 
>     METADATA
>       "wms_title" "Bouwfonds - Digitale kaart"
>       "wms_onlineresource" 
> "http://www.xx.xx/cgi-bin/mapserv.exe?map=E:\\mapconfig\\bouwfonds.map"
>       "wms_srs" "EPSG:4326 EPSG:28992"
>       "ows_schemas_location" "http://schemas.opengis.net"
>       "wms_feature_mime_type" "application/vnd.ogc.gml"
>     END
>   END
> 
> And for my Layer:
> 
> ---- snippet ----
> LAYER
>     NAME 'percelen'
>     TYPE POLYGON
>     DUMP TRUE
>     TEMPLATE 'ttt'
>     DATA '.\mapdata\rga\percelen_laag_poly_merged.shp'
>     METADATA
>       "wms_title" "percelen"
>       "wms_srs" "EPSG:28992"
>       "gml_featureid" "id"
>       "gml_include_items" "all"
>     END
>     STATUS ON
>     TRANSPARENCY 100
>     PROJECTION
>      "init=epsg:28992"
>     END
>     CLASS
>        NAME 'percelen'
>        STYLE
>          SYMBOL 0
>          SIZE 6
>          OUTLINECOLOR 180 208 208
>          #COLOR 180 208 208
>        END
>     END
>   END
> 
> 
> Bart van den Eijnden schreef:
>> Milo,
>>
>> the WMS client determines the info_format. I assume QGIS is asking for 
>> MIME or text/plain.
>>
>> You need to add the following METADATA to your layers:
>>
>> OWS_INCLUDE_ITEMS "all"
>>
>> Maybe even GML_INCLUDE_ITEMS "all" I am not sure. Give it a try.
>>
>> If Flamingo wants GML, it will request with 
>> info_format=application/vnd.ogc.gml. If it doesn't you can probably 
>> set the default/MIME format of Mapserver to this (METADATA at the WEB 
>> level called feature_info_mime_type).
>>
>> Template can remain empty, I always TEMPLATE blank.html where 
>> blank.html does not even exist on the filesystem.
>>
>> Best regards,
>> Bart
>>
>> On Jan 30, 2008 5:48 PM, Milo van der Linden <mlinden at zeelandnet.nl 
>> <mailto:mlinden at zeelandnet.nl>> wrote:
>>
>>     Hello list,
>>
>>     I have been spending 4 hours looking around the mapserver website and
>>     various other resources but no luck.
>>
>>     As a Mapserver WMS client I am using flamingo-mc. flamingo-mc is
>>     able to
>>     perform a getFeatureInfo and requires gml as response.
>>
>>     For now I have some sort of response because with qGIS I get:
>>     WMS identify result for 225, 337
>>
>>     ---------------
>>
>>     GetFeatureInfo results:
>>
>>     Layer 'percelen'
>>
>>     Feature 507:
>>
>>
>>     But it is clearly no gml and I haven't set the fields from the
>>     table to
>>     be returned.
>>
>>     So:
>>
>>     - What do I have to put in my (currently empty) TEMPLATE file?
>>     - Can I enter all the GML that I need to return in my TEMPLATE and
>>     does
>>     anyone have a sample for this?
>>
>>     - How can I make sure that the information returned is in the gml
>>     mime-type?
>>
>>
>>     Any help would be appreciated!
>>
>>     Kind regards,
>>
>>     Milo van der Linden
>>
>>
> 



More information about the MapServer-users mailing list