[mapserver-users] Trouble Importing Layer from Web Feature Service

John Schattel John.Schattel at noaa.gov
Thu Feb 21 16:00:12 EST 2008


I am trying to test our Web Feature Service (WFS) using MapServer as a 
WFS client.  I am using the layer definition shown below in the .map 
file.  The request sent by MapServer looks good (see below layer 
definition) and the response from the WFS looks good (for brevity sake, 
I'm only including a couple of the features returned).  When I try to 
turn on the layer in Chameleon 2.4 
(http://localhost/chameleon/samples/sample_ogc.phtml), I get a red X 
where the image should be.  Is this a case where MapServer doesn't 
support the XML it is receiving?  If so, can anyone tell me what aspect 
of the XML is giving MapServer problems?

In advance, thanks for any help you can offer as I try to get MapServer 
and the our WFS to work together.

John

 LAYER
  NAME NDFD
  GROUP "VECTOR"
  TYPE POINT
  STATUS OFF
  # this is a remote OGC:WFS
  CONNECTIONTYPE WFS

  # the server URL prefix
  # MapServer will add the OGC:WMS specific
  # keyword value pairs accordingly
  #CONNECTION 
"http://map.ns.ec.gc.ca/envdat/map.aspx?service=WFS&version=1.0.0&request=GetFeature"
  CONNECTION 
"http://www.weather.gov/mdl/survey/pgb_survey/dev/OGC_services/ndfdOWSserver.php"

  PROJECTION
   "init=epsg:4326"
  END

  # base info MapServer needs to know to generate the
  # OGC:WFS GetFeature request
  METADATA

   # MapServer default sends POST
   # force to GET
   # "wfs_request_method" "GET"
  
   # how long (in seconds) should MapServer use
   # in issuing and receiving the data?
   "wfs_connectiontimeout" "60"

   # Filter to get a small amount of NDFD data
   "wfs_filter" 
"<PropertyName>wx</PropertyName><PropertyName>maxt</PropertyName>"

   # which version of the OGC:WFS should MapServer communicate with
   "wfs_version" "1.0.0"

   # service type for connection
   # this info is a bit redundant
   "wfs_service" "WFS"

   # what is the feature type you are querying
   "wfs_typename" "Forecast_Gml2Point"

   # what is the spatial extent?
   "wfs_latlonboundingbox" "-121.2 20.2 -60.89 50.0"
   #
  END
  #
  # MapServer will then use this information to generate a string like:
  # 
http://map.ns.ec.gc.ca/envdat/map.aspx?version=<wfs_version>&service=<wfs_service>&request=GetFeature&typename=<wfs_typename>
  #
  # missing required keyword value pairs get generated according
  # to the application using this mapfile, i.e.:
  # &bbox, &filter, etc.
 END

MapServer sent request

<?xml version="1.0" ?>
<GetFeature
service="WFS"
version="1.0.0"
outputFormat="GML2">
<Query typeName="Forecast_Gml2Point">
<Filter><PropertyName>wx</PropertyName><PropertyName>maxt</PropertyName></Filter></Query>
</GetFeature>

GML returned by WFS to MapServer

<?xml version="1.0" encoding="UTF-8"?>
<app:NdfdForecastCollection
xmlns="http://www.weather.gov/mdl/survey/pgb_survey/dev/OGC_services"
xmlns:app="http://www.weather.gov/mdl/survey/pgb_survey/dev/OGC_services"
xmlns:ows="http://www.opengis.net/ows"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.weather.gov/mdl/survey/pgb_survey/dev/OGC_services 
http://www.weather.gov/mdl/survey/pgb_survey/dev/OGC_services/schema/dwGML_WFS_GMLv212.xsd 
">

   <gml:boundedBy>
      <gml:Box srsName="EPSG:4326">
         <gml:coordinates>13.48,-176.65 71.30,145.72</gml:coordinates>
      </gml:Box>
   </gml:boundedBy>
   <gml:featureMember>
      <app:Forecast_Gml2Point>
         <gml:position>
            <gml:Point srsName="EPSG:4326">
               <gml:coordinates>-97.6,35.4</gml:coordinates>
            </gml:Point>
         </gml:position>
         <app:validTime>2008-02-20T23:36:00</app:validTime>
         <app:maximumTemperature>44.0</app:maximumTemperature>
         <app:weatherCoverage>chance</app:weatherCoverage>
         <app:weatherIntensity>light</app:weatherIntensity>
         <app:weatherType>drizzle</app:weatherType>
         <app:weatherQualifier>none</app:weatherQualifier>
         <app:weatherVisibility>none</app:weatherVisibility>
      </app:Forecast_Gml2Point>
   </gml:featureMember>

   <gml:featureMember>
      <app:Forecast_Gml2Point>
         <gml:position>
            <gml:Point srsName="EPSG:4326">
               <gml:coordinates>-95.9,36.2</gml:coordinates>
            </gml:Point>
         </gml:position>
         <app:validTime>2008-02-20T23:36:00</app:validTime>
         <app:maximumTemperature>37.0</app:maximumTemperature>
         <app:weatherCoverage>patchy</app:weatherCoverage>
         <app:weatherCoverage>patchy</app:weatherCoverage>
         <app:weatherIntensity>light</app:weatherIntensity>
         <app:weatherIntensity>light</app:weatherIntensity>
         <app:weatherType>drizzle</app:weatherType>
         <app:weatherType>freezing drizzle</app:weatherType>
         <app:weatherQualifier>none</app:weatherQualifier>
         <app:weatherQualifier>none</app:weatherQualifier>
         <app:weatherVisibility>none</app:weatherVisibility>
         <app:weatherVisibility>none</app:weatherVisibility>
      </app:Forecast_Gml2Point>
   </gml:featureMember>

</app:NdfdForecastCollection>


More information about the mapserver-users mailing list