1. Introduction to Background 1.1WMS
The Web Map Service (WMS) makes maps using data with geospatial location information. The map is defined as the representation of geographic data visibility. This specification defines three operations: Getcapabitities returns service-level metadata, which is a description of the content and requirements parameters of the service information; Getmap returns a map image whose geospatial reference and size parameters are clearly defined ; Getfeatureinfo (optional) returns information about some of the special features displayed on the map.
The GeoServer website describes its WMS specification as http://docs.geoserver.org/stable/en/user/services/wms/index.html.
1.2WFS Introduction
The Web feature Service (WFS) returns the feature-level GML encoding and provides transactional operations such as adding, modifying, and deleting features, further deepening the Web map service. The OGC Web feature service allows clients to obtain geospatial data using Geographic Markup Language (GML) encoding from multiple Web feature services, which defines five operations: Getcapabilites returns the Web feature service performance description document (described in XML) ; Describefeaturetype returns an XML document that describes any feature structure that can provide a service; Getfeature serves as a request to get a feature instance; Transaction service for a transaction request ; Lockfeature handles the request to lock one or more feature type instances during a transaction.
The GeoServer official website describes its WFS specification as http://docs.geoserver.org/stable/en/user/services/wfs/index.html.
2.WMS Request specification detailed 2.1GetCapabitities (return to service level metadata)
URL Example:
Http://localhost:8680/geoserver/wms?service=wms&version=1.1.1&request=GetCapabilities.
Parameter meaning:
return Result:
The returned result is a descriptive XML document that contains the following three elements:
2.2GetMap (get image)
URL Example:
Http://localhost:8680/geoserver/urbanlayer/wms? layers=urbanlayer%3adiji&styles=&format=image%2fpng&service=wms&version=1.1.1&request= Getmap&srs=epsg%3a3857&bbox=10008053.503544,5274522.8578226,10039584.01305,5292493.614536&width= 579&height=330.
Parameter meaning:
Here you have the following choices for the format returned:
return Result:
Note: This request also supports XML format requests, as follows:
2.3GetFeatureInfo (return feature information)
URL Example:
Http://localhost:8680/geoserver/urbanlayer/wms? request=getfeatureinfo&exceptions=application%2fvnd.ogc.se_xml&bbox=10008053.503544%2c5274522.857823% 2c10039584.01305%2c5292493.614536&service=wms&info_format=text/plain&query_layers=urbanlayer% 3adiji&feature_count=50&layers=urbanlayer%3adiji&width=579&height=330&format=image%2fpng &styles=&srs=epsg%3a3857&version=1.1.1&x=315&y=147.
Parameter meaning:
Here are the following choices for the returned text format (Info_format):
Return result (ignore Chinese garbled):
3.WFS request Specification 3.1GetCapabilities (return to service description document)
URL Example:
Http://localhost:8680/geoserver/wfs?service=wfs&version=1.1.0&request=GetCapabilities.
Parameter meaning:
return Result:
The returned result is a descriptive XML that contains the following five main sections:
3.2DescribeFeatureType (return layer description information)
URL Example:
Http://localhost:8680/geoserver/urbanlayer/ows?service=wfs&version=1.0.0&request=DescribeFeatureType &typename=diji.
Parameter meaning:
return Result:
3.3GetFeature (get layer Features) 3.3.1GET query
Here is a first example:
http://localhost:8080/eGovaGISV14//home/gis/proxy.htm?http://192.168.101.14/geoserver/urbanlayer/wfs?request= getfeature&version=1.1.0&typename=jianfudanhistory&filter=%3cfilter%20xmlns:ogc=%22http:// Www.opengis.net/ogc%22%20xmlns:gml=%22http://www.opengis.net/gml%22%3E%3CIntersects%3E%20%3CPropertyName%3Ethe _geom%3c/propertyname%3e%20%3cgml:envelope%20srsname=%22epsg:4326%22%3e%09%20%3cgml:lowercorner% 3e120.1762573834964%2030.280899047851562%3c/gml:lowercorner%3e%20%09%20%3cgml:uppercorner%3e120.18999029365265 %2030.294631958007812%3c/gml:uppercorner%3e%20%3c/gml:envelope%3e%3c/intersects%3e%3c/filter%3e& Outputformat=json.
Common parameters for this request are: Typenames,featureid,propertyname,filter, Count, SortBy. Where the filter parameter is the most important, mainly responsible for the selection filter. The specific description of filter can be consulted: http://docs.geoserver.org/stable/en/user/filter/function.html.
The returned result is:
{"type": "Featurecollection", "features": [{"Type": "Feature", "id": "jianfudan.322", "geometry": {"type": " Multipolygon "," coordinates ": [[[[[[30.276436000822056,120.20021],[30.275750000822033,120.20021],[ 30.22768400082126,120.22562],[30.245537000821543,120.17343000000001],[30.276436000822056,120.20021]]]}, " Geometry_name ":" The_geom "," Properties ": {" Limitid ":" Displayorder ": null," RegionID ": 3," validfromdate ":" 2016-05-15z "," validtodate ":" 2016-06-14z "," Validflag ": 1," media ": null," shape_length ": null," Shape_area ": null," Graphicid ": 322," Regionname ":" Jianggan District "," eventtypes ": null," otherrequest ": null," Limitname ":" Escalation Area "}},{" type ":" Feature "," id ":" jianfudan.318 "," geometry ": {" type ":" Multipolygon "," coordinates ": [[[[[[]] 30.26407600082185,120.19668600000001],[30.26407600082185,120.196434],[30.262875000821833,120.20785],[ 30.24708200082157,120.203896],[30.255150000821704,120.187164],[30.26407600082185,120.19668600000001]]]}, " Geometry_name ":" The_geom "," Properties ": {" Limitid ":" Displayorder ": null," RegionID ": 3," VALIDFRomdate ":" 2016-05-04z "," validtodate ":" 2016-06-03z "," Validflag ": 1," Media ":" http://172.18.6.197:8081/MediaRoot/ null/20160505/72/84989ee1-9bab-4640-8f24-4a7381f1c4e8/ticket reservation. png "," shape_length ": null," Shape_area ": null," Graphicid ": 318," Regionname ":" Jianggan District "," eventtypes ":" Disorderly build, exposing rubbish, accumulate rubbish muck, road unclean, river unclean (including Ditch, lake) "," Otherrequest ":" Test "," Limitname ":" Escalation Area "}}]," CRS ": {" type ":" EPSG "," Properties ": {" code ":" 4490 "}}
3.3.1.1-Point Query filter
<filter xmlns:ogc= "HTTP://WWW.OPENGIS.NET/OGC" xmlns:gml= "HTTP://WWW.OPENGIS.NET/GML" >
<Intersects>
<PropertyName>the_geom</PropertyName>
<gml:envelope srsname= "epsg:4326" >
<gml:lowercorner>120.15336460382575 30.2743621901609</gml:lowercorner>
<gml:uppercorner>120.167097513982 30.28809510031715</gml:uppercorner>
</gml:Envelope>
</Intersects>
</Filter>
3.3.1.2 Custom Polygon Query filter
<filter xmlns:ogc= "HTTP://WWW.OPENGIS.NET/OGC" xmlns:gml= "HTTP://WWW.OPENGIS.NET/GML" >
<Intersects>
<PropertyName>the_geom</PropertyName>
<gml:multipolygon srsname= "epsg:4326" >
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates xmlns:gml= "HTTP://WWW.OPENGIS.NET/GML" decimal= "cs=", "ts=" ">
120.15677,30.2557 120.15677,30.26351 120.16833,30.26351 120.16833,30.2557 120.15677,30.2557
</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
</gml:MultiPolygon>
</Intersects>
</Filter>
3.3.2Post Query
Because the data size of the GET request is less than 4KB, post is a more common method. Here is a specific example:
It is sent directly to an XML file whose filter can be filled with the same content as the filter in Get.
The specific contents are as follows:
<?xml version= ' 1.0 ' encoding= ' GBK '? ><wfs:getfeature service= ' WFS ' version= ' 1.0.0 ' outputformat= ' JSON '
xmlns:wfs= ' Http://www.opengis.net/wfs '
Xmlns:ogc= ' HTTP://WWW.OPENGIS.NET/OGC '
Xmlns:gml= ' http://www.opengis.net/gml ' xmlns:xsi= ' http://www.w3.org/2001/XMLSchema-instance ' xsi:schemalocation= ' Http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd ' >
<wfs:query typename= ' cell ' >
<wfs:PropertyName>the_geom</wfs:PropertyName>
<wfs:PropertyName>test1</wfs:PropertyName>
<ogc:Filter>
<Or>
<propertyisequalto><propertyname>test1</propertyname><literal>valuetest1</literal ></PropertyIsEqualTo>
<propertyisequalto><propertyname>test2</propertyname><literal>valuetest2</literal ></PropertyIsEqualTo>
</Or>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>
3.4 Transaction (Edit features)
This method supports the enhancement of feature deletions. The XML organization format sent in the POST request is given here directly:
3.4.1 Adding features
<wfs:transaction service= "WFS" version= "1.0.0"
outputformat= "GML2"
Xmlns:opengis= "Http://www.cetusOpengis.com"
Xmlns:wfs= "Http://www.opengis.net/wfs"
Xmlns:ogc= "HTTP://WWW.OPENGIS.NET/OGC"
Xmlns:gml= "HTTP://WWW.OPENGIS.NET/GML"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "Http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd" >
<wfs:insert handle= "Someprj1" >
<opengis:someprj>
<opengis:the_geom>
<gml:point srsname= "http://www.opengis.net/gml/srs/epsg.xml#3395" >
<gml:coordinates decimal= "." Cs= "," ts= "" >13404701.212,3850391.781</gml:coordinates>
</gml:Point>
</opengis:the_geom>
<opengis:ssds>13</opengis:ssds>
<opengis:qqybh>12</opengis:qqybh>
<opengis:status>0</opengis:status>
</opengis:someprj>
</wfs:Insert>
</wfs:Transaction>
3.4.2 Modifying features
<wfs:transaction service= "WFS" version= "1.0.0"
outputformat= "GML2"
Xmlns:opengis= "Http://www.cetusOpengis.com"
Xmlns:wfs= "Http://www.opengis.net/wfs"
Xmlns:ogc= "HTTP://WWW.OPENGIS.NET/OGC"
Xmlns:gml= "HTTP://WWW.OPENGIS.NET/GML"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "Http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd" >
<wfs:update typename= "Opengis:qqyproject" >
<wfs:Property>
<wfs:Name>qqybh</wfs:Name>
<wfs:Value>12</wfs:Value>
</wfs:Property>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>qqybh</ogc:PropertyName>
<ogc:Literal>0</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</wfs:Update>
</wfs:Transaction>
3.4.3 Deleting features
<wfs:transaction service= "WFS" version= "1.0.0"
outputformat= "GML2"
Xmlns:opengis= "Http://www.cetusOpengis.com"
Xmlns:wfs= "Http://www.opengis.net/wfs"
Xmlns:ogc= "HTTP://WWW.OPENGIS.NET/OGC"
Xmlns:gml= "HTTP://WWW.OPENGIS.NET/GML"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation= "Http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd" >
<wfs:delete typename= "Opengis:qqyproject" >
<ogc:Filter>
<ogc:PropertyIsLessThan>
<ogc:PropertyName>qqybh</ogc:PropertyName>
<ogc:Literal>12</ogc:Literal>
</ogc:PropertyIsLessThan>
<ogc:PropertyIsGreaterThan>
<ogc:PropertyName>qqybh</ogc:PropertyName>
<ogc:Literal>0</ogc:Literal>
</ogc:PropertyIsGreaterThan>
</ogc:Filter>
</wfs:Delete>
</wfs:Transaction>
4. Summary
A. Dynamic plots can use GETMAP requests in the WMS.
B. Vector queries can use getfeature requests in the WFS.
C. Feature edits can use transaction requests in the WFS.
--------------------------------------------------------------------------------------------------------------- -----------------
Note: This article is reproduced in the blog Park Xiaohui Li is personal blog naa (http://www.cnblogs.com/naaoveGIS/), thanks to the original author!
Request specification for WMS and WFS in GeoServer (reprint)