[OpenLayers-Commits] r11876 - in trunk/openlayers: lib/OpenLayers/Format tests/Format

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Apr 5 03:07:05 EDT 2011


Author: erilem
Date: 2011-04-05 00:07:01 -0700 (Tue, 05 Apr 2011)
New Revision: 11876

Modified:
   trunk/openlayers/lib/OpenLayers/Format/GeoJSON.js
   trunk/openlayers/tests/Format/GeoJSON.html
Log:
GeoJSON format output produces invalid CRS, p=hoxworth, r=me (closes #3022)

Modified: trunk/openlayers/lib/OpenLayers/Format/GeoJSON.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Format/GeoJSON.js	2011-04-05 06:52:42 UTC (rev 11875)
+++ trunk/openlayers/lib/OpenLayers/Format/GeoJSON.js	2011-04-05 07:07:01 UTC (rev 11876)
@@ -495,16 +495,16 @@
            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
                    }
                };
            }    

Modified: trunk/openlayers/tests/Format/GeoJSON.html
===================================================================
--- trunk/openlayers/tests/Format/GeoJSON.html	2011-04-05 06:52:42 UTC (rev 11875)
+++ trunk/openlayers/tests/Format/GeoJSON.html	2011-04-05 07:07:01 UTC (rev 11876)
@@ -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");
     }    



More information about the Commits mailing list