Merge pull request #733 from ahocevar/fid

Store the feature's commonly used id. r=@fredj,@bartvde
This commit is contained in:
ahocevar
2013-05-24 06:15:00 -07:00
9 changed files with 51 additions and 2 deletions

View File

@@ -144,6 +144,9 @@ ol.parser.GeoJSON.prototype.parseFeature_ = function(json, opt_options) {
geometry = null,
options = opt_options || {};
var feature = new ol.Feature(json.properties);
if (goog.isDef(json.id)) {
feature.setFeatureId(json.id);
}
if (geomJson) {
var type = geomJson.type;
var callback = options.callback;

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_) {