GeoJSON strings should not include internal feature ids, r=bbinet (closes #3313)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12109 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2011-06-20 07:47:52 +00:00
parent 2aab742ced
commit 18ad6643b6
2 changed files with 38 additions and 8 deletions

View File

@@ -530,12 +530,15 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
*/
'feature': function(feature) {
var geom = this.extract.geometry.apply(this, [feature.geometry]);
return {
var json = {
"type": "Feature",
"id": feature.fid == null ? feature.id : feature.fid,
"properties": feature.attributes,
"geometry": geom
};
if (feature.fid != null) {
json.id = feature.fid;
}
return json;
},
/**