ability to parse a FeatureCollection

The trick here was to delete featureNS so autoConfig would kick in
This commit is contained in:
Bart van den Eijnden
2013-10-23 17:04:20 +02:00
parent c4e7d4437c
commit 46b79d88f8
3 changed files with 67 additions and 1 deletions

View File

@@ -71,7 +71,9 @@ ol.parser.ogc.WFS_v1_0_0 = function() {
return node;
}
});
this.setFilterParser(new ol.parser.ogc.Filter_v1_0_0());
var filter = new ol.parser.ogc.Filter_v1_0_0();
delete filter.getGmlParser().featureNS;
this.setFilterParser(filter);
};
goog.inherits(ol.parser.ogc.WFS_v1_0_0,
ol.parser.ogc.WFS_v1);

View File

@@ -0,0 +1,23 @@
goog.provide('ol.test.parser.ogc.WFS_v1');
describe('ol.parser.ogc.WFS', function() {
var parser = new ol.parser.ogc.WFS();
describe('reading and writing', function() {
it('handles read of FeatureCollection', function(done) {
var url = 'spec/ol/parser/ogc/xml/wfs_v1/FeatureCollection.xml';
afterLoadXml(url, function(xml) {
var obj = parser.read(xml);
expect(obj.features.length).to.equal(1);
done();
});
});
});
});
goog.require('goog.dom.xml');
goog.require('ol.parser.ogc.WFS');

View File

@@ -0,0 +1,41 @@
<wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" xmlns:topp="http://www.openplans.org/topp" xmlns:gml="http://www.opengis.net/gml">
<gml:featureMember>
<topp:states fid="states.3">
<topp:the_geom>
<gml:MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates decimal="." cs="," ts=" ">-75.70742,38.557476 -75.71106,38.649551 -75.724937,38.83017 -75.752922,39.141548 -75.761658,39.247753 -75.764664,39.295849 -75.772697,39.383007 -75.791435,39.723755 -75.775269,39.724442 -75.745934,39.774818 -75.695114,39.820347 -75.644341,39.838196 -75.583794,39.840008 -75.470345,39.826435 -75.42083,39.79887 -75.412117,39.789658 -75.428009,39.77813 -75.460754,39.763248 -75.475128,39.741718 -75.476334,39.719971 -75.489639,39.714745 -75.610725,39.612793 -75.562996,39.566723 -75.590187,39.463768 -75.515572,39.36694 -75.402481,39.257637 -75.397728,39.073036 -75.324852,39.012386 -75.307899,38.945911 -75.190941,38.80867 -75.083138,38.799812 -75.045998,38.44949 -75.068298,38.449963 -75.093094,38.450451 -75.350204,38.455208 -75.69915,38.463066 -75.70742,38.557476</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
</gml:MultiPolygon>
</topp:the_geom>
<topp:STATE_NAME>Delaware</topp:STATE_NAME>
<topp:STATE_FIPS>10</topp:STATE_FIPS>
<topp:SUB_REGION>S Atl</topp:SUB_REGION>
<topp:STATE_ABBR>DE</topp:STATE_ABBR>
<topp:LAND_KM>5062.456</topp:LAND_KM>
<topp:WATER_KM>1385.022</topp:WATER_KM>
<topp:PERSONS>666168.0</topp:PERSONS>
<topp:FAMILIES>175867.0</topp:FAMILIES>
<topp:HOUSHOLD>247497.0</topp:HOUSHOLD>
<topp:MALE>322968.0</topp:MALE>
<topp:FEMALE>343200.0</topp:FEMALE>
<topp:WORKERS>247566.0</topp:WORKERS>
<topp:DRVALONE>258087.0</topp:DRVALONE>
<topp:CARPOOL>42968.0</topp:CARPOOL>
<topp:PUBTRANS>8069.0</topp:PUBTRANS>
<topp:EMPLOYED>335147.0</topp:EMPLOYED>
<topp:UNEMPLOY>13945.0</topp:UNEMPLOY>
<topp:SERVICE>87973.0</topp:SERVICE>
<topp:MANUAL>44140.0</topp:MANUAL>
<topp:P_MALE>0.485</topp:P_MALE>
<topp:P_FEMALE>0.515</topp:P_FEMALE>
<topp:SAMP_POP>102776.0</topp:SAMP_POP>
</topp:states>
</gml:featureMember>
</wfs:FeatureCollection>