GeoJSON format output produces invalid CRS, p=hoxworth, r=me (closes #3022)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11876 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -495,16 +495,16 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
|
||||
var code = parseInt(proj.substring(proj.indexOf(":") + 1));
|
||||
if (code == 4326) {
|
||||
crs = {
|
||||
"type": "OGC",
|
||||
"type": "name",
|
||||
"properties": {
|
||||
"urn": "urn:ogc:def:crs:OGC:1.3:CRS84"
|
||||
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
|
||||
}
|
||||
};
|
||||
} else {
|
||||
crs = {
|
||||
"type": "EPSG",
|
||||
"type": "name",
|
||||
"properties": {
|
||||
"code": code
|
||||
"name": "EPSG:" + code
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
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"}}}';
|
||||
var output = '{"type":"Feature","id":0,"properties":{},"geometry":{"type":"Point","coordinates":[1,2]},"crs":{"type":"name","properties":{"name":"urn:ogc:def:crs:OGC:1.3:CRS84"}}}';
|
||||
var layer = new OpenLayers.Layer.Vector();
|
||||
layer.projection = "EPSG:4326";
|
||||
feature.layer = layer;
|
||||
@@ -259,7 +259,7 @@
|
||||
var 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";
|
||||
output = '{"type":"Feature","id":0,"properties":{},"geometry":{"type":"Point","coordinates":[1,2]},"crs":{"type":"EPSG","properties":{"code":2805}}}';
|
||||
output = '{"type":"Feature","id":0,"properties":{},"geometry":{"type":"Point","coordinates":[1,2]},"crs":{"type":"name","properties":{"name":"EPSG:2805"}}}';
|
||||
test_out = parser.write(feature);
|
||||
t.eq(test_out, output, "Output is equal for vector with point");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user