Store the KML Placemark identifier

This commit is contained in:
Frederic Junod
2013-05-24 09:29:30 +02:00
parent 8c0f1f979a
commit a452915d8a
3 changed files with 9 additions and 1 deletions

View File

@@ -104,6 +104,7 @@ ol.parser.KML = function(opt_options) {
'Placemark': function(node, obj) {
var container = {properties: {}};
var sharedVertices, callback;
var id = node.getAttribute('id');
this.readChildNodes(node, container);
if (goog.isDef(container.track)) {
var track = container.track, j, jj;
@@ -125,6 +126,9 @@ ol.parser.KML = function(opt_options) {
container.properties['altitude'] = track.points[i].coordinates[2];
}
var feature = new ol.Feature(container.properties);
if (!goog.isNull(id)) {
feature.setFeatureId(id);
}
var geom = track.points[i];
if (geom) {
sharedVertices = undefined;
@@ -150,6 +154,9 @@ ol.parser.KML = function(opt_options) {
}
}
feature = new ol.Feature(container.properties);
if (!goog.isNull(id)) {
feature.setFeatureId(id);
}
if (container.geometry) {
sharedVertices = undefined;
if (this.readFeaturesOptions_) {