[mapserver-users] WFS GetFeature on Mapserver doesn't work

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Thu Apr 15 00:08:54 PDT 2010


Hi,

Your GetCapabilities says:

</Capability>
−
<FeatureTypeList>
−
<Operations>
<Query/>
</Operations>
</FeatureTypeList>

Conclusion: feature type list is empty, so it does not make sense to continue to GetFeature before the layer settings are corrected and the layer appears in the GetCapabilities.  Now, have a look at document http://mapserver.org/ogc/wfs_server.html and compare your mapfile with it. Most obvious reason for your failure is that your layer is missing DUMP TRUE.

-Jukka Rahkonen-

sunny74 wrote:

 
> Dear Friends,
> 
> I am trying to get WFS working on Mapserver but both 
> Getcapabilities and
> GetFeature are giving me errors.
> 
> I am firing the following urls directly in the browser:
> 
> Getcapabilities(map from DB )
> 
> http://localhost:81/cgi-bin/mapserv.exe?map=d:/Delhi1_wfs_post
gres.map&SERVICE=WFS&VERSION=1.0.0&&REQUEST=GETcapabilities
> 
> GetFeature
> 
> http://localhost:81/cgi-bin/mapserv.exe?map=d:/Delhi1_wfs_post
gres.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=GETfeature
> &typename=delhi_district
> 
> delhi_district is the name of my table in the postgres DB.
> 
> The o/p from Getcapabilities is:
> 
> <WFS_Capabilities version="1.0.0" updateSequence="0"
> xsi:schemaLocation="http://www.opengis.net/wfs
> http://schemas.opengis.net/wfs/1.0.0/WFS-capabilities.xsd">
>> <!--
>  MapServer version 5.2.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
> OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG
> SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER
> SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT
> SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI 
> SUPPORTS=THREADS
> SUPPORTS=GEOS SUPPORTS=RGBA_PNG INPUT=JPEG INPUT=POSTGIS INPUT=OGR
> INPUT=GDAL INPUT=SHAPEFILE 
> -->
>> <Service>
> <Name>MapServer WFS</Name>
> <Title>GMap WFS Demo Server</Title>
>> <OnlineResource>
> http://localhost:81/cgi-bin/mapserv.exe?map=d:/Delhi1_wfs_post
gres.map&
> </OnlineResource>
> </Service>
>> <Capability>
>> <Request>
>> <GetCapabilities>
>> <DCPType>
>> <HTTP>
> <Get
> onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=d:
/Delhi1_wfs_postgres.map&"/>
> </HTTP>
> </DCPType>
>> <DCPType>
>> <HTTP>
> <Post
> onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=d:
/Delhi1_wfs_postgres.map&"/>
> </HTTP>
> </DCPType>
> </GetCapabilities>
>> <DescribeFeatureType>
>> <SchemaDescriptionLanguage>
> <XMLSCHEMA/>
> </SchemaDescriptionLanguage>
>> <DCPType>
>> <HTTP>
> <Get
> onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=d:
/Delhi1_wfs_postgres.map&"/>
> </HTTP>
> </DCPType>
>> <DCPType>
>> <HTTP>
> <Post
> onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=d:
/Delhi1_wfs_postgres.map&"/>
> </HTTP>
> </DCPType>
> </DescribeFeatureType>
>> <GetFeature>
>> <ResultFormat>
> <GML2/>
> </ResultFormat>
>> <DCPType>
>> <HTTP>
> <Get
> onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=d:
/Delhi1_wfs_postgres.map&"/>
> </HTTP>
> </DCPType>
>> <DCPType>
>> <HTTP>
> <Post
> onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=d:
/Delhi1_wfs_postgres.map&"/>
> </HTTP>
> </DCPType>
> </GetFeature>
> </Request>
> </Capability>
>> <FeatureTypeList>
>> <Operations>
> <Query/>
> </Operations>
> </FeatureTypeList>
>> <ogc:Filter_Capabilities>
>> <ogc:Spatial_Capabilities>
>> <ogc:Spatial_Operators>
> <ogc:Equals/>
> <ogc:Disjoint/>
> <ogc:Touches/>
> <ogc:Within/>
> <ogc:Overlaps/>
> <ogc:Crosses/>
> <ogc:Intersect/>
> <ogc:Contains/>
> <ogc:DWithin/>
> <ogc:BBOX/>
> </ogc:Spatial_Operators>
> </ogc:Spatial_Capabilities>
>> <ogc:Scalar_Capabilities>
> <ogc:Logical_Operators/>
>> <ogc:Comparison_Operators>
> <ogc:Simple_Comparisons/>
> <ogc:Like/>
> <ogc:Between/>
> </ogc:Comparison_Operators>
> </ogc:Scalar_Capabilities>
> </ogc:Filter_Capabilities>
> </WFS_Capabilities>
> 
> The o/p from GetFeature is:
> 
> <ServiceExceptionReport version="1.2.0"
> xsi:schemaLocation="http://www.opengis.net/ogc
> http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">
>> <ServiceException code="InvalidParameterValue" locator="typename">
> 
> msWFSGetFeature(): WFS server error. TYPENAME 
> 'delhi_district' doesn't exist
> in this server.  Please check the capabilities and 
> reformulate your request.
>   
> </ServiceException>
> </ServiceExceptionReport>
> 
> So none of the outputs are proper
> 
> My map File is as below:
> 
> # Map file created from QGIS project file D:/QGIS
> 1.3/projects/delhi_trial.qqs.qgs
> # Edit this file to customize for your map interface
> # (Created with PyQgis MapServer Export plugin)
> MAP
>   NAME Delhi1_postgres.map
>   # Map image size
>   SIZE 600 600
>   UNITS dd
>   SYMBOLSET 'C:\ms4w\Apache\htdocs\Delhi\Symbols.txt'
>   FONTSET 'C:\ms4w\Apache\htdocs\Delhi\fonts.txt'
>   EXTENT 76.507859 27.613907 78.439621 28.941223
>   CONFIG "PROJ_LIB" "C:\ms4w\proj\nad"
>   PROJECTION
>     'proj=longlat'
>     'ellps=WGS84'
>     'datum=WGS84'
>     'no_defs'
>   END
> 
>   # Background color for the map canvas -- change as desired
>   IMAGECOLOR 192 192 192
>   IMAGEQUALITY 95
>   IMAGETYPE png
>   OUTPUTFORMAT
>     NAME png
>     DRIVER 'GD/PNG'
>     MIMETYPE 'image/png'
>     #IMAGEMODE PC256
>     EXTENSION 'png'
>   END
>   # Legend
>   LEGEND
>       IMAGECOLOR 255 255 255
>     STATUS ON
>     KEYSIZE 18 12
>     LABEL
>       TYPE BITMAP
>       SIZE MEDIUM
>       COLOR 0 0 89
>     END
>   END
> 
>   # Web interface definition. Only the template parameter
>   # is required to display a map. See MapServer documentation
>   WEB
>     # Set IMAGEPATH to the path where MapServer should
>     # write its output.
>     IMAGEPATH '/tmp/'
> 
>     # Set IMAGEURL to the url that points to IMAGEPATH
>     # as defined in your web server configuration
>     IMAGEURL '/tmp/'
> 
>     # WMS server settings
>     METADATA
>     "wfs_title"            "GMap WFS Demo Server"  ## REQUIRED
>     "wfs_onlineresource"  
> "http://localhost:81/cgi-bin/mapserv.exe?map=d:/Delhi1_wfs_pos
tgres.map"  ##
> Recommended
>     "wfs_srs"               "EPSG:42304 EPSG:42101 EPSG:4269 
> EPSG:4326"  ##
> Recommended
>     "wfs_request_method"    "GET"
>      'queryable'          'true'
>      "wfs_feature_info_mime_type" "gml"
>     END
> 
>     #Scale range at which web interface will operate
>     # Template and header/footer settings
>     # Only the template parameter is required to display a map. See
> MapServer documentation
>   END
> 
>   LAYER
>     CONNECTIONTYPE postgis
> 		CONNECTION "host=localhost dbname=DelhiDB 
> user=postgres password=postgres
> port=5432"
> 		DATA "the_geom FROM delhi_district as foo USING 
> UNIQUE gid USING
> SRID=4326"
> 
>     NAME 'delhi_district'
>     TYPE POLYGON
>     LABELITEM "polygon_nm"
>     CLASSITEM "polygon_nm"
>      METADATA
>         "wfs_title"    "WFS Map" ## REQUIRED
>         "wfs_version" "1.0.0"
>         "wfs_srs" "EPSG:4326"
>         "wfs_typename" "delhi_district"
>         "wfs_service" "WFS"
>         "gml_featureid" "gid"
>      END
>     
>     STATUS DEFAULT
>     HEADER   ../templates/Demo_header.html
>     TEMPLATE ../templates/Demo_query_body1.html
>     FOOTER ../templates/Demo_footer.html
>     
>     TRANSPARENCY 100
>     PROJECTION
>     'proj=longlat'
>     'ellps=WGS84'
>     'datum=WGS84'
>     'no_defs'
>     END
>     CLASS
>        EXPRESSION 'Ghaziabad' 
>        NAME 'Ghaziabad' 
>        GROUP 'Ghaziabad'
>        STYLE
>          SYMBOL "quadrat" 
>          SIZE 2 
>          OUTLINECOLOR 0 0 0
>          COLOR 255 0 127
>        END
>     END
>     CLASS
>        EXPRESSION 'Gautam Buddha Nagar' 
>        NAME 'Gautam Buddha Nagar' 
>        GROUP 'Gautam Buddha Nagar'
>        STYLE
>          SYMBOL "quadrat" 
>          SIZE 2 
>          OUTLINECOLOR 0 0 0
>          COLOR 0 0 255
>        END
>     END
> 
>     CLASS
>        EXPRESSION 'North West' 
>        NAME 'North West' 
>        GROUP 'North West'
>        STYLE
>          SYMBOL "quadrat" 
>          SIZE 2 
>          OUTLINECOLOR 0 0 0
>          COLOR 255 0 255
>        END
>     END
>     CLASS
>        EXPRESSION 'South West' 
>        NAME 'South West' 
>        GROUP 'South West'
>        STYLE
>          SYMBOL "quadrat" 
>          SIZE 2 
>          OUTLINECOLOR 0 0 0
>          COLOR 255 170 0
>        END
>     END
>     CLASS
>        EXPRESSION 'West' 
>        NAME 'West' 
>        GROUP 'West'
>        STYLE
>          SYMBOL "quadrat" 
>          SIZE 2 
>          OUTLINECOLOR 0 0 0
>          COLOR 85 170 255
>        END
>     END
>     CLASS
>        EXPRESSION 'New Delhi' 
>        NAME 'New Delhi' 
>        GROUP 'New Delhi'
>        STYLE
>          SYMBOL "quadrat" 
>          SIZE 2 
>          OUTLINECOLOR 0 0 0
>          COLOR 170 170 0
>        END
>     END
>     CLASS
>        EXPRESSION 'East' 
>        NAME 'East' 
>        GROUP 'East'
>        STYLE
>          SYMBOL "quadrat" 
>          SIZE 2 
>          OUTLINECOLOR 0 0 0
>          COLOR 170 85 255
>        END
>     END
>     CLASS
>        EXPRESSION 'North East' 
>        NAME 'North East' 
>        GROUP 'North East'
>        STYLE
>          SYMBOL "quadrat" 
>          SIZE 2 
>          OUTLINECOLOR 0 0 0
>          COLOR 127 255 185
>        END
>     END
>     CLASS
>        EXPRESSION 'North' 
>        NAME 'North' 
>        GROUP 'North'
>        STYLE
>          SYMBOL "quadrat" 
>          SIZE 2 
>          OUTLINECOLOR 0 0 0
>          COLOR 170 0 0
>        END
>     END
>     CLASS
>        EXPRESSION 'South' 
>        NAME 'South' 
>        GROUP 'South'
>        STYLE
>          SYMBOL "quadrat" 
>          SIZE 2 
>          OUTLINECOLOR 0 0 0
>          COLOR 255 170 0
>        END
>     END
>     CLASS
>        EXPRESSION 'Faridabad' 
>        NAME 'Faridabad' 
>        GROUP 'Faridabad'
>        STYLE
>          SYMBOL "quadrat" 
>          SIZE 2 
>          OUTLINECOLOR 0 0 0
>          COLOR 0 170 255
>        END
>     END
>     CLASS
>        EXPRESSION 'Gurgaon' 
>        NAME 'Gurgaon' 
>        GROUP 'Gurgaon'
>        STYLE
>          SYMBOL "quadrat" 
>          SIZE 2 
>          OUTLINECOLOR 0 0 0
>          COLOR 0 255 170
>        END
>     END
> END
> END
> 
> Why doesn't it work?
> 
> Once this gets working I can invoke it using OL script.
> 
> Thanks for your attention and efforts.
> 
> -- 
> View this message in context: 
> http://n2.nabble.com/WFS-GetFeature-on-Mapserver-doesn-t-work-
> tp4905757p4905757.html
> Sent from the Mapserver - User mailing list archive at Nabble.com.
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 


More information about the MapServer-users mailing list