OpenLayers OpenLayers
Show
Ignore:
Timestamp:
10/04/07 18:51:23 (1 year ago)
Author:
crschmidt
Message:

Pullup r4819 from trunk: fixing GeoJSON serializer breakage caused by draft4
update. (Closes #1062)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/openlayers/2.5/lib/OpenLayers/Format/GeoJSON.js

    r4794 r4830  
    448448                        geojson.type = "FeatureCollection"; 
    449449                        if(element.layer && element.layer.projection) { 
    450                             this.createCRSObject(element); 
     450                            geojson.crs = this.createCRSObject(element); 
    451451                        } 
    452452                    } else if(geojson.type != "FeatureCollection") { 
     
    470470            geojson = this.extract.feature.apply(this, [obj]); 
    471471            if(obj.layer && obj.layer.projection) { 
    472                 this.createCRSObject(obj); 
     472                geojson.crs = this.createCRSObject(obj); 
    473473            } 
    474474        } 
     
    480480     * Method: createCRSObject 
    481481     * Create the CRS object for an object. 
     482     * 
     483     * Parameters: 
     484     * object - {<OpenLayers.Feature.Vector>}  
     485     * 
     486     * Returns: 
     487     * {Object} An object which can be assigned to the crs property 
     488     * of a GeoJSON object. 
    482489     */ 
    483490    createCRSObject: function(object) { 
    484491       var proj = object.layer.projection; 
     492       var crs = {} 
    485493       if (proj.match(/epsg:/i)) { 
    486494           var code = parseInt(proj.substring(proj.indexOf(":") + 1)); 
    487495           if (code == 4326) { 
    488                geojson.crs = { 
     496               crs = { 
    489497                   "type": "OGC", 
    490498                   "properties": { 
     
    493501               }; 
    494502           } else {     
    495                geojson.crs = { 
     503               crs = { 
    496504                   "type": "EPSG", 
    497505                   "properties": { 
     
    501509           }     
    502510       } 
     511       return crs; 
    503512    }, 
    504513