initial version of the WFS parser for 1.0.0 and 1.1.0
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
goog.provide('ol.test.parser.ogc.WFS_v1_0_0');
|
||||
|
||||
describe('ol.parser.ogc.WFS_v1_0_0', function() {
|
||||
|
||||
var parser = new ol.parser.ogc.WFS();
|
||||
|
||||
describe('reading and writing', function() {
|
||||
|
||||
it('handles read of transaction response', function(done) {
|
||||
var url = 'spec/ol/parser/ogc/xml/wfs_v1_0_0/Transaction_Response.xml';
|
||||
afterLoadXml(url, function(xml) {
|
||||
var obj = parser.read(xml);
|
||||
expect(obj.insertIds.length).to.equal(2);
|
||||
expect(obj.insertIds[0]).to.equal('parcelle.40');
|
||||
expect(obj.insertIds[1]).to.equal('parcelle.41');
|
||||
expect(obj.version).to.equal('1.0.0');
|
||||
expect(obj.success).to.be(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('handles writing Query with BBOX Filter', function(done) {
|
||||
var url = 'spec/ol/parser/ogc/xml/wfs_v1_0_0/query0.xml';
|
||||
afterLoadXml(url, function(xml) {
|
||||
var p = new ol.parser.ogc.WFS_v1_0_0({featureTypes: ['states'],
|
||||
featurePrefix: 'topp', featureNS: 'http://www.openplans.org/topp'});
|
||||
var filter = new ol.expr.Call(
|
||||
new ol.expr.Identifier(ol.expr.functions.EXTENT),
|
||||
[new ol.expr.Literal(1), new ol.expr.Literal(2),
|
||||
new ol.expr.Literal(3), new ol.expr.Literal(4),
|
||||
undefined,
|
||||
new ol.expr.Identifier('the_geom')]);
|
||||
var output = p.writers[p.defaultNamespaceURI]['Query'].apply(
|
||||
p, [{filter: filter, featureType: 'states'}]);
|
||||
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('goog.dom.xml');
|
||||
goog.require('ol.expr.Call');
|
||||
goog.require('ol.expr.Identifier');
|
||||
goog.require('ol.expr.Literal');
|
||||
goog.require('ol.parser.ogc.WFS');
|
||||
goog.require('ol.parser.ogc.WFS_v1_0_0');
|
||||
@@ -0,0 +1,11 @@
|
||||
<wfs:WFS_TransactionResponse version="1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc">
|
||||
<wfs:InsertResult>
|
||||
<ogc:FeatureId fid="parcelle.40"/>
|
||||
<ogc:FeatureId fid="parcelle.41"/>
|
||||
</wfs:InsertResult>
|
||||
<wfs:TransactionResult>
|
||||
<wfs:Status>
|
||||
<wfs:SUCCESS/>
|
||||
</wfs:Status>
|
||||
</wfs:TransactionResult>
|
||||
</wfs:WFS_TransactionResponse>
|
||||
@@ -0,0 +1,10 @@
|
||||
<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
|
||||
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
|
||||
<ogc:BBOX>
|
||||
<ogc:PropertyName>the_geom</ogc:PropertyName>
|
||||
<gml:Box xmlns:gml="http://www.opengis.net/gml">
|
||||
<gml:coordinates decimal="." cs="," ts=" ">1,2 3,4</gml:coordinates>
|
||||
</gml:Box>
|
||||
</ogc:BBOX>
|
||||
</ogc:Filter>
|
||||
</wfs:Query>
|
||||
Reference in New Issue
Block a user