[Geojson] Need to know the type of a Feature

Sean Gillies sean.gillies at gmail.com
Thu Nov 8 08:17:32 PST 2012


Dear Antoine,

Yours sounds like a pretty good use case for a GeoJSON profile:
http://sgillies.net/blog/1156/the-right-profile. A very important part
of the profile would be specification of the vocabulary of possible
feature types, yes?

Speaking of spec revision, we went through a round of proposals and
discussion last fall. I'm open to doing that again if there is enough
interest.

Yours,

On Tue, Nov 6, 2012 at 6:35 AM, Riche, Antoine (GE Energy)
<antoine.riche at ge.com> wrote:
> Hello Tim.
>
> Thanks for your quick response. I obviously did not read the spec
> carefully enough, and I'll add a member called "name" to my features
> right away :-)
>
> We don't really need the "name" member to be part of the spec for our
> project, where we have control over both the server and the client
> sides. This could be a useful addition though. Whether this is a strong
> enough reason to produce another version of the spec I don't know -
> maybe this could just be put on a wish list for now.
>
> Antoine.
>
> -----Original Message-----
> From: Tim Schaub [mailto:tschaub at opengeo.org]
> Sent: 05 November 2012 20:11
> To: Riche, Antoine (GE Energy)
> Cc: geojson at lists.geojson.org
> Subject: Re: [Geojson] Need to know the type of a Feature
>
> Hello Antoine,
>
> In case it's not already clear, the spec allows you to add arbitrary
> members to features or other GeoJSON objects.
>
> http://geojson.org/geojson-spec.html#geojson-objects
>
> So adding a "name" member to Feature objects would still be valid
> GeoJSON.
>
> Are you interested in having the spec edited so that parsers would
> preserve the "name" member or in hopes that people would start sharing
> known feature types?
>
> Tim
>
> On Mon, Nov 5, 2012 at 8:11 AM, Riche, Antoine (GE Energy)
> <antoine.riche at ge.com> wrote:
>> The GeoJSON format does not provide a way to describe the type of a
>> Feature. The "type" member of a Feature object just says it is a
>> Feature, so parsing GeoJSON data does not enable a web client to find
>> out whether a feature is a motorway or a footpath, whether it is a gas
>
>> pipe or a cable. This information however might be needed for the
>> response to a WMS GetFeatureInfo request, as there might be several
>> features of different types in the same position (where the user
>> clicks on a map). Generally speaking a FeatureCollection can be
>> heterogeneous, so providing a mean to distinguish the features it
>> contains would be useful.
>>
>> I can think if a couple of ways to add this information to the GeoJSON
>
>> format :
>>
>> 1 - Add a member called "name" to Feature objects, e.g.
>>     { "type": "Feature",
>>       "name": "Cable",
>>       "geometry": {"type": "LineString", "coordinates": [[102.0,
>> 0.5],[108.5,12.0]]},
>>       "properties": {"depth": "1.5 metres"}
>>     }
>>
>> 2 - Allow the type value of a Feature to be any string, e.g.
>>     { "type": "Cable",
>>       "geometry": {"type": "LineString", "coordinates": [[102.0,
>> 0.5],[108.5,12.0]]},
>>       "properties": {"depth": "1.5 metres"}
>>     }
>> Although this loosens the third rule for GeoJSON Objects
>> <http://www.geojson.org/geojson-spec.html> , this could be handled by
>> parsers as long as the value of the type member is relaxed for Feature
>
>> objects only - note the type "Feature" remains valid for anonymous
>> features.
>>
>> The benefit of the first solution is backward compatibility (as long
>> as parsers ignore members whose name is unknown). The benefit of the
>> second solution is that it is less verbose - which is one of the goals
> of JSON.
>>
>> Regards,
>> Antoine Riche.
>>
>> _______________________________________________
>> Geojson mailing list
>> Geojson at lists.geojson.org
>> http://lists.geojson.org/listinfo.cgi/geojson-geojson.org
>
>
>
> --
> Tim Schaub
> OpenGeo http://opengeo.org/
> Expert service straight from the developers.
> _______________________________________________
> Geojson mailing list
> Geojson at lists.geojson.org
> http://lists.geojson.org/listinfo.cgi/geojson-geojson.org



-- 
Sean Gillies



More information about the GeoJSON mailing list