Pullup r4819 from trunk: fixing GeoJSON serializer breakage caused by draft4

update. (Closes #1062)


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.5@4830 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-10-04 22:51:23 +00:00
parent 4f62fdcfc8
commit e65caac909
2 changed files with 30 additions and 4 deletions

View File

@@ -184,6 +184,23 @@
t.eq(types, {'Point':15, 'Polygon': 2, 'LineString':2}, "Correct number of each type");
}
function test_Format_GeoJSON_writeWithCRS(t) {
t.plan(2)
var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(1,2));
feature.fid = 0;
var output = '{"type":"Feature","id":0,"properties":{},"geometry":{"type":"Point","coordinates":[1,2]},"crs":{"type":"OGC","properties":{"urn":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}';
layer = new OpenLayers.Layer.Vector();
layer.projection = "EPSG:4326";
feature.layer = layer;
var parser = new OpenLayers.Format.GeoJSON();
test_out = parser.write(feature);
t.eq(test_out, output, "Output is equal for vector with layer in EPSG:4326 ");
feature.layer.projection = "EPSG:2805";
var output = '{"type":"Feature","id":0,"properties":{},"geometry":{"type":"Point","coordinates":[1,2]},"crs":{"type":"EPSG","properties":{"code":2805}}}';
test_out = parser.write(feature);
t.eq(test_out, output, "Output is equal for vector with point");
}
function test_Format_GeoJSON_write(t) {
t.plan(10);