dist/leaflet-dvf.js
function (featureCollection, indexKey) {
		var features = featureCollection.features;
		var feature;
		var properties;
		var featureIndex = {};
		var value;

		for (var index = 0; index < features.length; ++index) {
			feature = features[index];

			properties = feature.properties;

			value = properties[indexKey];

			// If the value already exists in the index, then either create a GeometryCollection or append the
			// feature's geometry to the existing GeometryCollection
			if (value in featureIndex) {
				var existingFeature = featureIndex[value];

				if (existingFeature.geometry.type !== 'GeometryCollection') {
					featureIndex[value] = {
						type: 'Feature',
						geometry: {
							type: 'GeometryCollection',
							geometries: [feature.geometry, existingFeature.geometry]
						}
					};
				}
				else {
					existingFeature.geometry.geometries.push(feature.geometry);
				}
			}
			else {
				featureIndex[value] = feature;
			}
		}

		return featureIndex;
	}
function (featureCollection, indexKey) {
		var features = featureCollection.features;
		var feature;
		var properties;
		var featureIndex = {};
		var value;

		for (var index = 0; index < features.length; ++index) {
			feature = features[index];

			properties = feature.properties;

			value = properties[indexKey];

			// If the value already exists in the index, then either create a GeometryCollection or append the
			// feature's geometry to the existing GeometryCollection
			if (value in featureIndex) {
				var existingFeature = featureIndex[value];

				if (existingFeature.geometry.type !== 'GeometryCollection') {
					featureIndex[value] = {
						type: 'Feature',
						geometry: {
							type: 'GeometryCollection',
							geometries: [feature.geometry, existingFeature.geometry]
						}
					};
				}
				else {
					existingFeature.geometry.geometries.push(feature.geometry);
				}
			}
			else {
				featureIndex[value] = feature;
			}
		}

		return featureIndex;
	}
function ( featureCollection , indexKey ) { var features = featureCollection . features ; var feature ; var properties ; var featureIndex = { } ; var value ; for ( var index = 0 ; index < features . length ; ++ index ) { feature = features [ index ] ; properties = feature . properties ; value = properties [ indexKey ] ; // If the value already exists in the index, then either create a GeometryCollection or append the // feature's geometry to the existing GeometryCollection if ( value in featureIndex ) { var existingFeature = featureIndex [ value ] ; if ( existingFeature . geometry . type !== 'GeometryCollection' ) { featureIndex [ value ] = { type : 'Feature' , geometry : { type : 'GeometryCollection' , geometries : [ feature . geometry , existingFeature . geometry ] } } ; } else { existingFeature . geometry . geometries . push ( feature . geometry ) ; } } else { featureIndex [ value ] = feature ; } } return featureIndex ; }
Indexes a GeoJSON FeatureCollection using the provided key
Indexes a GeoJSON FeatureCollection using the provided key