In the GeoJson spec

'An object of type "FeatureCollection" must have a member with the name "features". The value corresponding to "features" is an array. Each element in the array is a feature object as defined above.'

I wish to include a FeatureCollection inside another FeatureCollection.

Appending each feature of the child to the parent's features would mean they can no longer be identified - unless a new property is to each child features before appending.

Would it be legal GeoJSON to add it as a different member?

{ "type": "FeatureCollection",
"features": [ ],
"childfeaturecollection": { "type": "FeatureCollection",
             "features": [ ]

This is legal JSON, and doesn't seem to break in a GeoJSON parser.

Based on the related question How widely supported are nested FeatureCollections in GeoJSON?, I assume that most systems would just ignore the childfeaturecollection member unless a special handler is implemented.

2 Answers 2


The child FeatureCollection would be considered a Foreign Member as per the specification

So it is a legal object, but applications will not necessarily treat it as a GeoJson object.

Another approach is to use a JSON array of FeatureCollections. Note that the array is just JSON. Only the items in the array are GeoJson objects, since according to the spec,

A GeoJSON text is a JSON text and consists of a single GeoJSON object.


It wouldn't be valid GeoJSON I presume, but I doubt it would break most Readers. Problem is, if you do not have a software supporting it, it will get lost in most software like OpenLayers and Leaflet. The GeoJSON read by OpenLayers for example is transfered into OpenLayer's internal geo-format and your nested featurecollection will be lost because OpenLayers does not look for it and it is discarded upon import. Of course you could write your own reader in OL, but then you will have to think about the nested feature representation in OL too. Anyway, as long as your GeoJSON has an features array and each feature has a geometry and a properties property, I believe you can add to your GeoJSON almost anything. You just need the software that can use your data format.

  • I guess it depends whether I wanted OpenLayers etc to read the child features. If so I could add the child collection's features to the parent's feature array and then give each child feature a property attribute so they could be identified.
    – intotecho
    Commented Jan 15, 2016 at 6:30
  • 1
    I have to admit that I am not totally sure here what you want to achieve with this data structure. It certainly is kind of unusual. Maybe there is a better solution for you if you explain a little bit more in depth what kind of data you want to represent with this structure and why and how those feature collections are linked together.
    – Frank
    Commented Jan 15, 2016 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.