Do not encode geometry in properties if geometryName is different
This commit is contained in:
@@ -508,7 +508,7 @@ ol.format.GeoJSON.prototype.writeFeatureObject = function(
|
||||
ol.format.GeoJSON.writeGeometry_(geometry, opt_options));
|
||||
}
|
||||
var properties = feature.getProperties();
|
||||
goog.object.remove(properties, 'geometry');
|
||||
goog.object.remove(properties, feature.getGeometryName());
|
||||
if (!goog.object.isEmpty(properties)) {
|
||||
goog.object.set(object, 'properties', properties);
|
||||
}
|
||||
|
||||
@@ -498,6 +498,15 @@ describe('ol.format.GeoJSON', function() {
|
||||
}
|
||||
});
|
||||
|
||||
it('writes out a feature with a different geometryName correctly',
|
||||
function() {
|
||||
var feature = new ol.Feature({'foo': 'bar'});
|
||||
feature.setGeometryName('mygeom');
|
||||
feature.setGeometry(new ol.geom.Point([5, 10]));
|
||||
var geojson = format.writeFeatures([feature]);
|
||||
expect(geojson.features[0].properties.mygeom).to.eql(undefined);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#writeGeometry', function() {
|
||||
|
||||
Reference in New Issue
Block a user