fix geojson not accepting geometry arrays, close #1840

This commit is contained in:
Vladimir Agafonkin 2013-07-10 19:21:39 +03:00
parent 1f6b981aab
commit 1781cda04a
2 changed files with 5 additions and 3 deletions

View File

@ -5,7 +5,7 @@ Leaflet Changelog
## 0.7-dev (master)
An in-progress version being developed on the `master` branch.
An in-progress version being developed on the `master` branch. Includes all fixes from the `stable` branch.
* Added `TileLayer` `maxNativeZoom` option that allows displaying tile layers on zoom levels above their maximum by **upscaling tiles**. [#1802](https://github.com/Leaflet/Leaflet/issues/1802) [#1798](https://github.com/Leaflet/Leaflet/issues/1798)
@ -18,6 +18,7 @@ An in-progress version being developed on the `stable` branch.
* Fixed a regression that prevented the map from responding to drag on areas covered with `ImageOverlay` (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1821](https://github.com/Leaflet/Leaflet/issues/1821)
* Fixed a regression with `worldCopyJump: true` breaking the map on small zoom levels (by [@danzel](https://github.com/danzel)). [#1831](https://github.com/Leaflet/Leaflet/issues/1831)
* Fixed a bug where `TileLayer.Canvas` wasn't immediately redrawn when `redraw` is called (by [@tofferrosen](https://github.com/tofferrosen)). [#1797](https://github.com/Leaflet/Leaflet/issues/1797) [#1817](https://github.com/Leaflet/Leaflet/issues/1817)
* Fixed a bug where `GeoJSON` ignored non-feature geometries passed in an array. [#1840](https://github.com/Leaflet/Leaflet/issues/1840)
## 0.6.2 (June 28, 2013)

View File

@ -16,12 +16,13 @@ L.GeoJSON = L.FeatureGroup.extend({
addData: function (geojson) {
var features = L.Util.isArray(geojson) ? geojson : geojson.features,
i, len;
i, len, feature;
if (features) {
for (i = 0, len = features.length; i < len; i++) {
// Only add this if geometry or geometries are set and not null
if (features[i].geometries || features[i].geometry || features[i].features) {
feature = features[i];
if (feature.geometries || feature.geometry || feature.features || feature.coordinates) {
this.addData(features[i]);
}
}