Database Reference
In-Depth Information
</ms:countries>
</gml:featureMember>
14. AsaresultoftheWFS
GetFeature
requestexecutedinthepreviousstep,
MapServerhasreturnedtoyouonlythefirstfivefeaturesofthe
countries
layers. Now, use the
GetFeature
request for making a query to the layer
usingafilterandgettingbackthecorrespondingfeatures.BytypingtheURL,
http://localhost/cgi-bin/mapserv?map=/var/www/data/coun-
tries.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature&TYPENAME=countries&MAXFEATURES=5&Filter=<Filter>
<PropertyIsEqualTo><PropertyName>name</PropertyName>
<Literal>Italy</Literal></PropertyIsEqualTo></Filter>
,
you will get the feature in the database that has the
name
field set to
Italy
.
15. After testing the WFS requests in a browser, try to open the WFS service
in QGIS using the
Add WFS Layer
button (alternatively, navigate to
Layer
|
Add WFS Layer
or use the QGIS browser). You should see the same
MapServer on Localhost connection
youcreatedafewstepsearlier.Click
on the
Connect
button and select the
countries
layer, add it to the QGIS
project, and browse through it by zooming, panning, and identifying some
features.ThebiggestdifferencewhencomparedtoWMSisthat,withWFS,
youreceivethefeaturegeometriesfromtheserverandnotjustanimage,so
you can even export the layer to a different format, such as a shapefile or
spatialite!