CloudMade/Leaflet — Issue #391: L.GeoJSON pointToLayer doesn't work with GeometryCollection
Author: javadze
Created: 2011-12-09 09:46:13+00:00
State: open

If geoJson type is GeometryCollection wood be recursively invoked function "geometryToLayer":

case "GeometryCollection":
for (i = 0, len = geometry.geometries.length; i < len; i++) {
layer = this.geometryToLayer(geometry.geometries[i]);
layers.push(layer);
}
return new L.FeatureGroup(layers);

Function interface is: geometryToLayer: function(geometry, pointToLayer)
And second parameter of this function is not passed into.

Fix:

case "GeometryCollection":
for (i = 0, len = geometry.geometries.length; i < len; i++) {
layer = this.geometryToLayer(geometry.geometries[i], pointToLayer);
layers.push(layer);
}
return new L.FeatureGroup(layers);