- dataLayer.eachLayer(function (layer) {
- var feature = layer.feature;
- layersById[feature.id] = layer;
- $.extend(feature, {
- typeName: featureTypeName(feature),
- url: "/browse/" + feature.type + "/" + feature.id,
- name: featureName(feature)
- });
+ var features = dataLayer.buildFeatures(xml);
+
+ function addFeatures() {
+ dataLayer.addData(features);
+
+ layersById = {};
+
+ dataLayer.eachLayer(function (layer) {
+ var feature = layer.feature;
+ layersById[feature.id] = layer;
+ $.extend(feature, {
+ typeName: featureTypeName(feature),
+ url: "/browse/" + feature.type + "/" + feature.id,
+ name: featureName(feature)