Skip to content

Commit

Permalink
WFS server: add support for <gml:Envelope> in <fes:Intersects>
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jun 5, 2020
1 parent 75e7d71 commit d4dc036
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mapogcfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,8 @@ static CPLXMLNode* FLTFindGeometryNode(CPLXMLNode* psXMLNode,
*pbPolygon = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "Box")))
*pbPolygon = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "Envelope")))
*pbPolygon = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "LineString")))
*pbLine = 1;
else if ((psGMLElement= CPLGetXMLNode(psXMLNode, "MultiLineString")))
Expand Down
51 changes: 51 additions & 0 deletions msautotest/wxs/expected/wfs_filter_200_intersects_envelope.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Content-Type: text/xml; subtype="gml/3.2.1"; charset=UTF-8

<?xml version='1.0' encoding="UTF-8" ?>
<wfs:FeatureCollection
xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mapserver.gis.umn.edu/mapserver http://localhost/path/to/wfs_simple?SERVICE=WFS&amp;VERSION=2.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=popplace&amp;OUTPUTFORMAT=application%2Fgml%2Bxml%3B%20version%3D3.2 http://www.opengis.net/wfs/2.0 http://ogc.dmsolutions.ca/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://ogc.dmsolutions.ca/gml/3.2.1/gml.xsd"
timeStamp="" numberMatched="1" numberReturned="1">
<wfs:boundedBy>
<gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326">
<gml:lowerCorner>44.61104 -65.81602</gml:lowerCorner>
<gml:upperCorner>44.61104 -65.81602</gml:upperCorner>
</gml:Envelope>
</wfs:boundedBy>
<!-- WARNING: No featureid defined for typename 'popplace'. Output will not validate. -->
<wfs:member>
<ms:popplace>
<gml:boundedBy>
<gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326">
<gml:lowerCorner>44.61104 -65.81602</gml:lowerCorner>
<gml:upperCorner>44.61104 -65.81602</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point gml:id=".1" srsName="urn:ogc:def:crs:EPSG::4326">
<gml:pos>44.61104 -65.81602</gml:pos>
</gml:Point>
</ms:msGeometry>
<ms:AREA>0.000</ms:AREA>
<ms:PERIMETER>0.000</ms:PERIMETER>
<ms:POPPLACE_>118</ms:POPPLACE_>
<ms:POPPLACE_I>2</ms:POPPLACE_I>
<ms:UNIQUE_KEY>CAJOA</ms:UNIQUE_KEY>
<ms:NAME>Digby</ms:NAME>
<ms:NAME_E></ms:NAME_E>
<ms:NAME_F></ms:NAME_F>
<ms:UNIQUE_K_1></ms:UNIQUE_K_1>
<ms:UNIQUE_K_2></ms:UNIQUE_K_2>
<ms:REG_CODE>12</ms:REG_CODE>
<ms:NTS50>021A12</ms:NTS50>
<ms:LAT>443700</ms:LAT>
<ms:LONG>654600</ms:LONG>
<ms:SGC_CODE>1203006</ms:SGC_CODE>
<ms:CAPITAL>0</ms:CAPITAL>
<ms:POP_RANGE>2</ms:POP_RANGE>
</ms:popplace>
</wfs:member>
</wfs:FeatureCollection>

4 changes: 4 additions & 0 deletions msautotest/wxs/wfs_filter.map
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@
# RUN_PARMS: wfs_filter_intersects.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=popplace&FILTER=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-61.63,45.04 -60.78,45.04 -60.78,46.08 -61.63,46.08</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>" > [RESULT]
#
# RUN_PARMS: wfs_filter_200_intersects.xml [MAPSERV] [POST]<?xml version="1.0"?><GetFeature service="WFS" version="2.0.0" xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns="http://www.opengis.net/wfs/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/fes/2.0 http://schemas.opengis.net/filter/2.0/filterAll.xsd http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd"><Query typeNames="popplace"><fes:Filter><fes:Intersects><fes:ValueReference>Geometry</fes:ValueReference><gml:Polygon gml:id="bla" srsName="CRS:84"><gml:exterior><gml:LinearRing><gml:posList>-61.63 45.04 -60.78 45.04 -60.78 46.08 -61.63 46.08</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></fes:Intersects></fes:Filter></Query></GetFeature>[/POST] > [RESULT_DEVERSION]

#
# RUN_PARMS: wfs_filter_200_intersects_envelope.xml [MAPSERV] [POST]<?xml version="1.0"?><GetFeature service="WFS" version="2.0.0" xmlns:fes="http://www.opengis.net/fes/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns="http://www.opengis.net/wfs/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/fes/2.0 http://schemas.opengis.net/filter/2.0/filterAll.xsd http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd"><Query typeNames="popplace"><fes:Filter><fes:Intersects><fes:ValueReference>Geometry</fes:ValueReference><gml:Envelope srsName="urn:ogc:def:crs:EPSG::26920"><gml:lowerCorner>272868.16 4938053.09</gml:lowerCorner><gml:upperCorner>281261.3 4951109.39</gml:upperCorner></gml:Envelope></fes:Intersects></fes:Filter></Query></GetFeature>[/POST] > [RESULT_DEVERSION]

#
# Verify DWITHIN Result: Sydney
# RUN_PARMS: wfs_filter_dwithin.xml [MAPSERV] QUERY_STRING="map=[MAPFILE]&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=popplace&FILTER=<Filter><DWithin><PropertyName>Geometry</PropertyName><gml:Point><gml:coordinates>-60.18,46.10</gml:coordinates></gml:Point><Distance units='dd'>0.05</Distance></DWithin></Filter>" > [RESULT]
Expand Down

0 comments on commit d4dc036

Please sign in to comment.