Allow null GeoJSON geometries.

This change checks if a geometry/ies in GeoJSON are set as null, in
which case it will skip it.
This commit is contained in:
Brian Herbert 2012-12-27 12:15:08 +09:00
parent a9c12f1d81
commit 2a38a809d3

View File

@ -20,7 +20,13 @@ L.GeoJSON = L.FeatureGroup.extend({
if (features) {
for (i = 0, len = features.length; i < len; i++) {
this.addData(features[i]);
// Only add this if geometry or geometries are set and not null
if ((typeof features[i].geometries !== undefined && features[i].geometries !== null) &&
(typeof features[i].geometry !== undefined && features[i].geometry !== null)) {
this.addData(features[i]);
}
}
return this;
}