CloudMade/Leaflet — pull request #877 by basos9 (2012-08-06 14:19:05+00:00)
Title: GeoJSON data enhancements

Hello,
As inspired by our [discussion](https://groups.google.com/forum/#!topic/leaflet-js/4ZJ4Ywcft5U) this adds some things to the GeoJSON

a0) FIX be more strict checking for type: FeatureCollection when parsing geojson

a) FIX onEachFeauture will fire only on each "Feature" layer (Except if it was intentionally firing for geometry layers, but this didn't make sense to me),

b) ADD preserveId option to assign the layer id from the provided geojson feature id (by default this is kept off)

c) ADD storeProps option to keep the feature object's properties (off by default). A new FeatureLayer IFace is extending all the geoJSON sublayers now.
This gives access to layer.getID() and layer.getProperties() (returns null when prop is not defined or when storeProps is false). Properties are assigned by the object cloning technique.
In addition a GeoJSON.getLayerById() method is provided.
This is enough to link a geoJSON sublayer with it's properties via: 1) LayerGroup.eachLayers 2) MouseEvent.target 3) getjsonLayer.getLayerById essentially covering the basic property access scenarios (i.e. iteration over all layers, random access by mouseevent, random access by id).

d) ADD tests for this GeoJSON new features. Modify the geoJSON debug page.

Should these be fine I could update the docs.