Skip to content

Conversation

snkashis
Copy link
Member

This allows for arrays of FeatureCollections, which previously would be bypassed.
I tested it with the feature-group-bounds test and a modified geojson-sample.js.

This references issue #1298.

if (features[i].geometries || features[i].geometry) {
if (features[i].type === 'FeatureCollection') {
this.addData(features[i].features);
} else if (features[i].geometries || features[i].geometry) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be simpler to just add a features[i].features check in this condition.

if (features[i].geometries || features[i].geometry) {
if (features[i].features) {
this.addData(features[i].features);
} else if (features[i].geometries || features[i].geometry) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that objects with features property are still handled well (see the first line of the method), so you don't need else if here, just everything in one condition.

@snkashis
Copy link
Member Author

Ah, the oneliner is what I had set up originally, then overanalyzed and decided to change it. In now.

@mourner
Copy link
Member

mourner commented Jan 21, 2013

Looks good, thanks!

mourner added a commit that referenced this pull request Jan 21, 2013
Handle arrays of feature collections, #1298
@mourner mourner merged commit a000304 into Leaflet:master Jan 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants