[Geojson] FeatureCollection in FeatureCollection?

Henrik Hjelte henrik at evahjelte.com
Wed Oct 29 12:07:05 PDT 2008


Hello,

According to the specs,
1. You can not have a nested FeatureCollection in a FeatureCollection.
2. You can not have a Feature in a Feature.
This is strange to me.

Consider this case:
I have a map with a LineString that represents a route between two cities.
Also I have a FeatureCollection of gas stations (Features).

I want to save this as one unit of geoJson.
Naturally I would make it into a FeatureCollection.
But a FeatureCollection can only contain Features, since quoting 2.3:
>> """ Each element in the array is a feature object as defined above. """

Lets try that,
I can put the LineString in a Feature, easy.
But I can not put the FeatureCollection of gas stations in a Feature.
Since, quoting 2.2:
>> """The value of the geometry member is a geometry object as defined above
or a JSON null value"""
And a FeatureCollection object is not under the Geometry object heading 2.1.

There is a really bad solution: make a Feature with properties "gasStations"
and "route", but that is
bad since then you can't automatically work with the data for example to
find a bounding box.
You will have to pinpoint that these two features are geographical data.

Then I am stuck? Or am I reading something the wrong way.

/Henrik Hjelte
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geojson.org/pipermail/geojson-geojson.org/attachments/20081029/941ef9f0/attachment.htm>


More information about the GeoJSON mailing list