ability to write out PropertyNames in a GetFeature request
This commit is contained in:
@@ -42,11 +42,13 @@ ol.parser.ogc.WFS_v1 = function(opt_options) {
|
|||||||
node.setAttribute('maxFeatures', options.maxFeatures);
|
node.setAttribute('maxFeatures', options.maxFeatures);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO set xsi:schemaLocation
|
|
||||||
for (var i = 0, ii = this.featureTypes.length; i < ii; i++) {
|
for (var i = 0, ii = this.featureTypes.length; i < ii; i++) {
|
||||||
options.featureType = this.featureTypes[i];
|
options.featureType = this.featureTypes[i];
|
||||||
this.writeNode('Query', options, null, node);
|
this.writeNode('Query', options, null, node);
|
||||||
}
|
}
|
||||||
|
this.setAttributeNS(
|
||||||
|
node, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||||
|
'xsi:schemaLocation', this.schemaLocation);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -63,9 +63,8 @@ ol.parser.ogc.WFS_v1_0_0 = function(opt_options) {
|
|||||||
}
|
}
|
||||||
if (goog.isDef(options.propertyNames)) {
|
if (goog.isDef(options.propertyNames)) {
|
||||||
for (var i = 0, ii = options.propertyNames.length; i < ii; i++) {
|
for (var i = 0, ii = options.propertyNames.length; i < ii; i++) {
|
||||||
this.writeNode('ogc:PropertyName', {
|
this.writeNode('PropertyName', options.propertyNames[i],
|
||||||
property: options.propertyNames[i]
|
'http://www.opengis.net/ogc', node);
|
||||||
}, 'http://www.opengis.net/ogc', node);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (goog.isDef(options.filter)) {
|
if (goog.isDef(options.filter)) {
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ ol.parser.ogc.WFS_v1_1_0 = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (goog.isDef(options.filter)) {
|
if (goog.isDef(options.filter)) {
|
||||||
this.writeNode('ogc:Filter', options.filter,
|
this.writeNode('Filter', options.filter,
|
||||||
'http://www.opengis.net/ogc', node);
|
'http://www.opengis.net/ogc', node);
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
|
|||||||
@@ -37,6 +37,20 @@ describe('ol.parser.ogc.WFS_v1_0_0', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('handles writing GetFeature with PropertyName', function(done) {
|
||||||
|
var url = 'spec/ol/parser/ogc/xml/wfs_v1_0_0/getfeature0.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 output = p.writers[p.defaultNamespaceURI]['GetFeature'].apply(
|
||||||
|
p, [{propertyNames: [new ol.expr.Identifier('STATE_NAME'),
|
||||||
|
new ol.expr.Identifier('STATE_FIPS'),
|
||||||
|
new ol.expr.Identifier('STATE_ABBR')]}]);
|
||||||
|
expect(goog.dom.xml.loadXml(p.serialize(output))).to.xmleql(xml);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
11
test/spec/ol/parser/ogc/xml/wfs_v1_0_0/getfeature0.xml
Normal file
11
test/spec/ol/parser/ogc/xml/wfs_v1_0_0/getfeature0.xml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<wfs:GetFeature service="WFS" version="1.0.0" xmlns:topp="http://www.openplans.org/topp"
|
||||||
|
xmlns:wfs="http://www.opengis.net/wfs"
|
||||||
|
xmlns:ogc="http://www.opengis.net/ogc"
|
||||||
|
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-transaction.xsd">
|
||||||
|
<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
|
||||||
|
<ogc:PropertyName>STATE_NAME</ogc:PropertyName>
|
||||||
|
<ogc:PropertyName>STATE_FIPS</ogc:PropertyName>
|
||||||
|
<ogc:PropertyName>STATE_ABBR</ogc:PropertyName>
|
||||||
|
</wfs:Query>
|
||||||
|
</wfs:GetFeature>
|
||||||
Reference in New Issue
Block a user