Initial GetFeature verification

This commit is contained in:
Björn Harrtell
2020-08-10 03:50:39 +02:00
parent daa0824b17
commit a58bff0981
5 changed files with 116 additions and 7 deletions

View File

@@ -27,6 +27,7 @@ import {
like as likeFilter,
not as notFilter,
or as orFilter,
resourceId as resourceIdFilter,
within as withinFilter,
} from '../../../../src/ol/format/filter.js';
import {parse} from '../../../../src/ol/xml.js';
@@ -1382,4 +1383,28 @@ describe('ol.format.WFS', function () {
expect(serialized).to.xmleql(parse(text));
});
});
describe('WFS 2.0.0', function () {
let getFeatureXml;
before(function (done) {
afterLoadText('spec/ol/format/wfs/2.0.0/GetFeature.xml', function (xml) {
getFeatureXml = xml;
done();
});
});
it('GetFeature', function () {
const wfs = new WFS({
version: '2.0.0',
});
const filter = resourceIdFilter('bugsites.3');
const serialized = wfs.writeGetFeature({
featureNS: 'http://www.openplans.org/spearfish',
featureTypes: ['bugsites'],
featurePrefix: 'sf',
filter,
});
expect(serialized).to.xmleql(parse(getFeatureXml));
});
});
});

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This example demonstrates a WFS 2.0 GetFeature POST request.
This filter selects a single feature with id "bugsites.3".
See also:
WFS Standard: http://www.opengeospatial.org/standards/wfs
Filter Encoding Standard: http://www.opengeospatial.org/standards/filter
-->
<wfs:GetFeature service="WFS" version="2.0.0"
xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:fes="http://www.opengis.net/fes/2.0"
xmlns:sf="http://www.openplans.org/spearfish" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
<wfs:Query typeNames="sf:bugsites">
<fes:Filter>
<fes:ResourceId rid="bugsites.3"/>
</fes:Filter>
</wfs:Query>
</wfs:GetFeature>