From fd145c82b1abdd819c3c07107db7428bc3bd1ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 5 Apr 2011 07:07:01 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Format/GeoJSON.js | 8 ++++---- tests/Format/GeoJSON.html | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers/Format/GeoJSON.js b/lib/OpenLayers/Format/GeoJSON.js index 7a6053cd0c..c3e55c2d30 100644 --- a/lib/OpenLayers/Format/GeoJSON.js +++ b/lib/OpenLayers/Format/GeoJSON.js @@ -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 } }; } diff --git a/tests/Format/GeoJSON.html b/tests/Format/GeoJSON.html index 0ee547977e..03f00377a0 100644 --- a/tests/Format/GeoJSON.html +++ b/tests/Format/GeoJSON.html @@ -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"); }