geojson / geojson-ld

GeoJSON in JSON-LD contexts
Other
130 stars 13 forks source link

Need to let "type" be an array #2

Closed ekansa closed 10 years ago

ekansa commented 10 years ago

Yeah! This is really exciting!

One thing that would be useful would by to allow an array of multiple "types". It's often needed to assert that a resource has types beyond what's defined by GeoJSON. I'd like to say that something has type => "FeatureCollection" and type => [uri to my type].

tschaub commented 10 years ago

Note that you can "extend" GeoJSON simply by adding additional members. For example, this would be completely valid GeoJSON:

{
  "type": "Point",
  "categories": ["http://example.com/#whatever"],
  "coordinates": [100.0, 0.0]
}
sgillies commented 10 years ago

No, @ekansa, that can't be done because it will break existing GeoJSON readers.

But if we do not alias GeoJSON "type" to "@type", then you can do this:

{ "@context": { "Feature": "http://example.com/vocab#Feature", "Thingy": "http://example.com/vocab#Thingy" },
{ "type": "Feature",
  "@type": ["Feature", "Thingy"] }

See what I mean? Keep the GeoJSON sense of type, but extend the object with JSON-LD @type.

ekansa commented 10 years ago

Makes sense.

I'll update my experiments to avoid using the aliased @type for non-GeoJSON typing.

sgillies commented 10 years ago

And I'll change the example in the README to highlight this way of extending GeoJSON.