Subject: [Geojson] Nestability

From: phryk <[email-masked]>
Date: Sat, 22 Dec 2018 17:43:08 +0100

So first off, let me say that I have no background in geoinformatics and am
coming to geojson from a kind of weird angle.

I'm writing a distinctly no-js webframework/cms with some fancy SVG
integration. One of the features I'm currently working on is better SVG
maps. I already implemented simple geojson->SVG rendering for
[Multi]Polygons and can render an arbitrarily bbox'd map.

Now that I'm this far, I stopped and thought a good deal about how I
want my data structured and have come to the conclusion that I want
nested Features in order to express hierarchical relations and attach
semantic info (via Feature's 'properties' dict), which I can then make
highlightable on the SVG map (again, without js) via CSS' :hover and
:target pseudoclasses.

Examples for data like that would be:
Nation > State > Municipality > District

or (for mapping military conflict)
Faction > Military Branch > Division > Regiment

When I reread the spec to make sure that's something I can do with geoJSON,
I noticed that it sadly isn't, as FeatureCollection does not count as Feature.

I also noticed that the spec recommends not to nest GeometryCollections,
even though nesting is valid for them.

This leaves me with three questions:

What's the reason for geoJSON to be so averse to nested data when much of
the world seems to be organized in a fashion that can be expressed very
well as a tree?

Is there a chance of the next version of geoJSON making
FeatureCollection count as Feature (and giving it the associated
'properties' key)?

Also, of course, I'm wondering if I'm just trying to saddle the wrong
pony here – is there maybe a nice simple spec that is a better fit for
what I'm trying to do and I'm simply not aware of it?

Best wishes,

    phryk