Add new ol.format.filter.Contains spatial operator

This commit is contained in:
Frederic Junod
2017-10-06 08:44:02 +02:00
parent 9a50f9ff75
commit dfe9e9b59a
4 changed files with 94 additions and 0 deletions

View File

@@ -514,6 +514,43 @@ describe('ol.format.WFS', function() {
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
it('creates a contains filter', function() {
var text =
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
' typeName="area" srsName="EPSG:4326" ' +
' xmlns:topp="http://www.openplans.org/topp">' +
' <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">' +
' <ogc:Contains>' +
' <ogc:PropertyName>the_geom</ogc:PropertyName>' +
' <gml:Polygon xmlns:gml="http://www.opengis.net/gml">' +
' <gml:exterior>' +
' <gml:LinearRing>' +
' <gml:posList srsDimension="2">' +
' 10 20 10 25 15 25 15 20 10 20' +
' </gml:posList>' +
' </gml:LinearRing>' +
' </gml:exterior>' +
' </gml:Polygon>' +
' </ogc:Contains>' +
' </ogc:Filter>' +
'</wfs:Query>';
var serialized = new ol.format.WFS().writeGetFeature({
srsName: 'EPSG:4326',
featureTypes: ['area'],
filter: ol.format.filter.contains(
'the_geom',
new ol.geom.Polygon([[
[10, 20],
[10, 25],
[15, 25],
[15, 20],
[10, 20]
]])
)
});
expect(serialized.firstElementChild).to.xmleql(ol.xml.parse(text));
});
it('creates a intersects filter', function() {
var text =
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +