Implement read/write transforms for ol.format.KML

This commit is contained in:
tsauerwein
2014-08-08 16:40:46 +02:00
parent 31dbbc6a8c
commit b05f880f7c
6 changed files with 163 additions and 17 deletions
+5 -9
View File
@@ -864,17 +864,13 @@ ol.format.GPX.prototype.writeFeatures;
ol.format.GPX.prototype.writeFeaturesNode = function(features, opt_options) {
//FIXME Serialize metadata
var gpx = ol.xml.createElementNS('http://www.topografix.com/GPX/1/1', 'gpx');
if (goog.isDef(opt_options)) {
if (!goog.isDef(opt_options.dataProjection)) {
// for convenience set a default dataProjection
opt_options = {
featureProjection: opt_options.featureProjection,
dataProjection: this.readProjectionFromDocument(null)
};
}
}
// for convenience set a default dataProjection
opt_options = ol.format.XMLFeature.setDefaultDataProjection(
opt_options, this.readProjectionFromDocument(null));
features = ol.format.XMLFeature.transformFeaturesWithOptions(
features, true, opt_options);
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */
({node: gpx}), ol.format.GPX.GPX_SERIALIZERS_,
ol.format.GPX.GPX_NODE_FACTORY_, features, []);