add an optional argument to getAttributes so we can get a feature's attributes except for the geometry ones
This commit is contained in:
@@ -351,11 +351,7 @@ ol.parser.GeoJSON.prototype.encodeFeatureCollection_ = function(collection) {
|
||||
*/
|
||||
ol.parser.GeoJSON.prototype.encodeFeature_ = function(feature) {
|
||||
var geometry = feature.getGeometry(),
|
||||
attributes = feature.getAttributes();
|
||||
var properties = goog.object.filter(attributes,
|
||||
function(element, index, array) {
|
||||
return !(element instanceof ol.geom.Geometry);
|
||||
});
|
||||
properties = feature.getAttributes(true);
|
||||
return /** @type {GeoJSONFeature} */({
|
||||
type: 'Feature',
|
||||
properties: properties,
|
||||
|
||||
@@ -422,11 +422,10 @@ ol.parser.ogc.GML = function(opt_options) {
|
||||
this.writeNode('_geometry', feature.getGeometry(), this.featureNS,
|
||||
node);
|
||||
}
|
||||
var attributes = feature.getAttributes();
|
||||
var attributes = feature.getAttributes(true);
|
||||
for (var name in attributes) {
|
||||
var value = attributes[name];
|
||||
if (goog.isDefAndNotNull(value) && !(value instanceof
|
||||
ol.geom.Geometry)) {
|
||||
if (goog.isDefAndNotNull(value)) {
|
||||
this.writeNode('_attribute', {name: name, value: value},
|
||||
this.featureNS, node);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user