radiantearth / stac-spec

SpatioTemporal Asset Catalog specification - making geospatial assets openly searchable and crawlable
https://stacspec.org
Apache License 2.0
777 stars 178 forks source link

GeometryCollection not allowed according to Item schema #1160

Closed aznan2 closed 2 months ago

aznan2 commented 2 years ago

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.

m-mohr commented 2 years ago

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

matthewhanson commented 2 years ago

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

m-mohr commented 2 years ago

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?

matthewhanson commented 2 years ago

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.

m-mohr commented 2 years ago

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?). :-)

matthewhanson commented 2 years ago

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

m-mohr commented 11 months ago

Discussed during the sprint: We don't allow GeometryCollection and remove it from the Item Spec Markdown.

PowerChell commented 4 months ago

Just needs a PR and then can close @matthewhanson