[Geojson] FeatureCollection in FeatureCollection?

Sean Gillies sgillies at frii.com
Wed Oct 29 14:21:25 PDT 2008


Christopher Schmidt wrote:
> On Wed, Oct 29, 2008 at 08:07:05PM +0100, Henrik Hjelte wrote:
>> 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.
> 
> Why is it important that the gas stations are a FeatureCollection? I'd
> simply make a FeatureCollection with one line, and multiple gas
> stations. 
> 
> Regards,

Yes. It's not explicitly said in the spec, but GeoJSON collections can
(as suggested) be heterogeneous, having different flavors of features.

Sean




More information about the GeoJSON mailing list