Ensure that GeoRSS format does not fail when reprojection null geometries.

patch=Edgemaster, ar=me (Closes #1258)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@5837 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-01-22 00:17:29 +00:00
parent bf39fa06a9
commit 6937fabe3a
2 changed files with 8 additions and 1 deletions

View File

@@ -155,7 +155,7 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, {
geometry = feature.geometry;
}
if (this.internalProjection && this.externalProjection) {
if (geometry && this.internalProjection && this.externalProjection) {
geometry.transform(this.externalProjection,
this.internalProjection);
}

View File

@@ -35,6 +35,13 @@
t.eq(data[0].geometry.x, -1, "w3c geo x read correctly");
t.eq(data[0].geometry.y, 1, "w3c geo y read correctly");
}
function test_Format_GeoRSS_reproject_null(t) {
t.plan(1);
var parser = new OpenLayers.Format.GeoRSS({'internalProjection':new OpenLayers.Projection("EPSG:4326"), 'externalProjection': new OpenLayers.Projection("EPSG:4326")});
var data = parser.read('<rss xmlns="http://backend.userland.com/rss2" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"><item></item></rss>');
t.eq(data.length, 1, "Parsing items with null geometry and reprojection doesn't fail");
}
function test_Format_GeoRSS_roundtrip(t) {
t.plan(input.length);
var parser = new OpenLayers.Format.GeoRSS();