[OpenLayers-Users] WFS GetFeature on Mapserver doesn't work
Robert Sanson
SansonR at asurequality.com
Wed Apr 7 17:21:24 EDT 2010
Here is a WFS GetFeature request that work for me against my Mapserver
installation:
http://myserver/cgi-bin/agbwfs.exe?farmid=AS00001&request=getfeature&typename=farm&service=wfs&version=1.0.0&BBOX=1472102,5119440,1475670,5123000
The typename is just the layer name in the Mapserver map file.
Looking through your map file, you shouldn't have:
CONNECTIONTYPE WFS
CONNECTION "/cgi-bin/mapserv.exe?map=Delhi1_wfs.map&"
in your layer definition, since the Shape file is local. You just need
the DATA line. The above two are referencing itself. They should only be
used where you are using your Mapserver as a cascading mapservice ie. to
bring in data from other Web servers.
Instead of using the OGC filter statements, you could just pass
Polygon_nm=Ghaziabad in your URL, and have a FILTER line in your layer
definition:
FILTER "WHERE Polygon_nm = '%Polygon_nm%'
That's how I deal with my farmid=AS00001 in my example.
Regards,
Robert
>>> sunny74 <sb.ray at hotmail.com> 8/04/2010 2:43 a.m. >>>
Dear Friends,
I am making a WFS GetFeature request on Mapserver.
My url is:
http://localhost:81/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/Delhi/Delhi1_wfs.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=GETfeature
&REQUEST=getfeature&typename=Adminbndy3&Filter=<Filter><PropertyIsEqualTo><PropertyName>Polygon_nm</PropertyName><Literal>Ghaziabad</Literal></PropertyIsEqualTo></Filter>
but I get the error
<ServiceExceptionReport version="1.2.0"
xsi:schemaLocation="http://www.opengis.net/ogc
http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd" (
'http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd"' )>
*
<ServiceException code="InvalidParameterValue" locator="typename">
msWFSGetFeature(): WFS server error. TYPENAME 'adminbndy3' doesn't
exist in
this server. Please check the capabilities and reformulate your
request.
</ServiceException>
</ServiceExceptionReport>
My map file is
# 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_wfs.map
# Map image size
SIZE 600 600
UNITS dd
FONTSET 'fonts.txt'
EXTENT 76.507859 27.613907 78.439621 28.941223
PROJECTION
'proj=longlat'
'ellps=WGS84'
'datum=WGS84'
'no_defs'
END
# Background color for the map canvas -- change as desired
IMAGECOLOR 192 192 192
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/'
# WFS server settings
METADATA
'wfs_title' 'Delhi1_wfs.map'
'wfs_onlineresource' '/cgi-bin/mapserv.exe?map=Delhi1_wfs.map&'
'wfs_srs' 'EPSG:4326'
'queryable' 'true'
#'gml_include_items' 'all'
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
NAME "Adminbndy3"
TYPE POLYGON
CONNECTIONTYPE WFS
CONNECTION "/cgi-bin/mapserv.exe?map=Delhi1_wfs.map&"
DATA 'D:/Delhi_NCR_boundaries/Delhi/Adminbndy3.shp'
METADATA
'wfs_title' 'Adminbndy3'
'gml_featureid' 'Polygon_nm'
'gml_include_items' 'all'
'wfs_typename' 'Adminbndy3'
'wfs_version' '1.0.0'
'wfs_request_method' 'GET'
'wfs_connectiontimeout' '60'
"wfs_maxfeatures" "1"
END
STATUS ON
DUMP TRUE
PROJECTION
'proj=longlat'
'ellps=WGS84'
'datum=WGS84'
'no_defs'
END
CLASS
NAME 'Adminbndy3'
STYLE
SYMBOL 0
SIZE 2
OUTLINECOLOR 0 0 0
COLOR 0 255 127
END
END
END
END
Although getfeature is not working getcapabilities is working,url is
http://localhost:81/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/Delhi/Delhi1_wfs.map&SERVICE=WFS&VERSION=1.0.0&&REQUEST=getcapabilities
The response 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" (
'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>
*
<!--
WARNING: Mandatory metadata '..._title' was missing in this context.
-->
<Title>Delhi1_wfs.map</Title>
*
<OnlineResource>
*
*
*
*
*
onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/Delhi/Delhi1_wfs.map&"/
(
'http://onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/Delhi/Delhi1_wfs.map&"/'
)>
</HTTP>
</DCPType>
*
<DCPType>
*
<HTTP>
<Post
onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/Delhi/Delhi1_wfs.map&"/>
</HTTP>
</DCPType>
</GetCapabilities>
*
<DescribeFeatureType>
*
<SchemaDescriptionLanguage>
<XMLSCHEMA/>
</SchemaDescriptionLanguage>
*
<DCPType>
*
<HTTP>
<Get
onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/Delhi/Delhi1_wfs.map&"/>
</HTTP>
</DCPType>
*
<DCPType>
*
<HTTP>
<Post
onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/Delhi/Delhi1_wfs.map&"/>
</HTTP>
</DCPType>
</DescribeFeatureType>
*
<GetFeature>
*
<ResultFormat>
<GML2/>
</ResultFormat>
*
<DCPType>
*
<HTTP>
<Get
onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/Delhi/Delhi1_wfs.map&"/>
</HTTP>
</DCPType>
*
<DCPType>
*
<HTTP>
<Post
onlineResource="http://localhost:81/cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/Delhi/Delhi1_wfs.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>
Can some one correct my Getfeature info url so that I get to retrieve
the
desired info from .shp files.My shapefile has the name Adminbndy3 so I
have
the same name as typename.
Basically I have created a WMS layer and trying to create this layer
atop
that WMS layer so as to show a different color for a particular
feature.
I following the example in the link
http://trac.openlayers.org/wiki/Highlighting
http://trac.openlayers.org/wiki/Highlighting
(the first one)
Does anybody have a working example of any the methods for
highlighting
given in the above link.
If yes pls send it across.
Thanks for your attention & efforts.
--
View this message in context:
http://n2.nabble.com/WFS-GetFeature-on-Mapserver-doesn-t-work-tp4865349p4865349.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
This message has been scanned for malware by SurfControl plc. www.surfcontrol.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100408/eba1fdd6/attachment.html
More information about the Users
mailing list