stac-spec icon indicating copy to clipboard operation
stac-spec copied to clipboard

GeometryCollection not allowed according to Item schema

Open aznan2 opened this issue 4 years ago • 8 comments
trafficstars

The section for the geometry field in item-spec.md refers to RFC 7946, section 3.1, which includes all seven geometry types, so I assume that the intent is that items can have a GeometryCollection.

In the JSON schema, the geometry field must be null or conform to https://geojson.org/schema/Geometry.json. However, this file only defines the six base geometry types and does not allow for the object to be a GeometryCollection.

Not sure if this is actually an issue with the GeoJSON schema but as things stand, items with a GeometryCollection as its geometry will not validate against the schema.

aznan2 avatar Oct 25 '21 14:10 aznan2

Hmm, indeed. It seems the GeoJSON Geometry schema is somewhat incomplete and we'd need to add the GeometryCollection schema separately...

m-mohr avatar Oct 25 '21 16:10 m-mohr

The GeometryCollection geometry type was intentionally left out, because it's not a widely supported geometry type, and the current GeoJSON spec recommends against the use of them: https://datatracker.ietf.org/doc/html/rfc7946#page-9

matthewhanson avatar Oct 25 '21 17:10 matthewhanson

But still, the spec doesn't cover that and it would at least need a clarification in the Markdown then.

Where is it discouraged though? I only see that they should not be nested?

m-mohr avatar Oct 25 '21 17:10 m-mohr

The language may have been updated, I've generally used the advice given in https://macwright.com/2015/03/23/geojson-second-bite.html#multi-geometries but granted that's a bit old now. GeometryCollections historically have not been well supported by tooling, and I think the use case for them is pretty rare and narrow, since you can do the same thing with more flexibility using a FeatureCollection.

I think doing intersections with geometry collections may be more difficult implementation wise, as backends may not supported mixed geometry single queries.

matthewhanson avatar Oct 25 '21 17:10 matthewhanson

Yes, all agreed. We have also discouraged the usage in openEO etc, but we need to find a good way to disallow them in the Markdown then (is that breaking? Or is it not breaking because it's enforced by the schema?). :-)

m-mohr avatar Oct 25 '21 19:10 m-mohr

I think in the markdown we can still reference the RFC, but state that GeometryCollection is not supported, which is enforced by the schema.

matthewhanson avatar Oct 25 '21 22:10 matthewhanson

We don't allow GeometryCollection and remove it from the Item Spec Markdown.

m-mohr avatar Sep 26 '23 19:09 m-mohr