-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarified use of geometries in aggregate_spatial processes #253
Conversation
…* geometries are a single entity in computations. GeometryCollections are considered being multiple entities. #252
Hmm. According to the simple feature access standard, a |
I agree with Edzer - GeomCollection is a single geometry in the same way as a MultiPolygon. I propose we require the parameter to always be an array, e.g. a FeatureCollection, and the aggregation happens over each of elements of the array (FeatureCollection). I would try to avoid API with branching behaviour based on (runtime) type of parameter objects - such things tend to be difficult to document and cause weird issues. |
Indeed, thanks for sounding in. I was wondering about that, too, and was unsure about GeometryCollection. I should have had a look into the spec. So instead of making it "per Geometry", the wording should be about "per Feature" (with plain geometries being a single Feature). I'll change it accordingly. We can't change the actual input data type right now to not introduce breaking changes, but I think the actual input data type is okay, it just needs a clarification. @mkadunc |
It’s OK indeed. I guess we can’t formally specify geojson FeatureCollection as param type, so we could just clarify in text that this is the kind of geojson that is expected. |
Okay, I rewrote that part:
|
e26e59f
to
91eee13
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, seems logically straightforward and understandable to me.
Co-authored-by: Jonathan Bahlmann <[email protected]>
So this would make the current VITO GeometryCollection handling invalid ? That would be annoying as we have internal use cases depending on it, and there is also a lot of documentation/demo's/webinars showing this "wrong way". |
How do you handle GeometryCollection? @soxofaan |
we return a separate aggregation for each geometry in the collection |
Hmm... the issue here is that GeometryCollection is defined to be a Geometry itself, which makes sense to me if you'd, for example, want to run a use case, which e.g. aggregates over multiple geometry types at once. There's no other way to achieve this except for using a geometry collection. Unfortunately, this was not defined well enough, but looking at SFA there's probably no other way to interpret it in a consistent way with SFA. And for interoperability, we should define it now rather than leaving it open... Edit: The only other implementation of aggregate_spatial right now is Sentinel Hub. Let me quickly confirm how they handle those cases. |
Perhaps we can also repeat the warning that's included in the geojson spec:
And reflect that in our own examples by not using geometrycollection at all. It's anyway a type that you would use for features composed of a combination of polygons and lines or points, so rather exotic. |
@jdries according to https://datatracker.ietf.org/doc/html/rfc7946#page-12 , a featureCollection is an array of feature objects; each feature object needs to have a geometry (section 3.2). Sets of geometries for multiple features should never be put in a GeometryCollection, that is how I read this. If a single feature has a GeometryCollection as geometry type, so be it. I agree that we can discourage use of GeometryCollection in general. They are part of a formalism, and hence "needed", but almost always a nuisance, I see them rarely used intentionally. |
I've added the following:
GEE: has two processes, reduceRegion (takes a Geometry [including a GeometryCollection, in GEE terminology a 'MultiGeometry'], returns one value) and reduceRegions (takes a FeatureCollectin, returns multiple results). Sentinel Hub: Seems to require passing an array. Have not looked into details, maybe Miha can sound in how they implement it? |
@m-mohr I can't seem to find that process (in the web editor), what am I missing here? @soxofaan I've been failing in passing multiple geometries to VITO back-end. Could you kindly explain how to do this? Passing geojson FeatureCollection (js client) doesn't work, passing shapely MultiPolygon results in only one output (which is expected I think, but shapely talks about Multi~ Collections as geometry collections, which completes my confusion). Already mentioned here. |
@jonathom I was referring to the native GEE functions, not openEO processes. |
Sentinel Hub service natively handles either a single The sentinel-hub-python-driver does indeed expect the geometries = self.validate_parameter(arguments, "geometries", required=True, allowed_types=[list]) |
@jonathom it is illustrated in this notebook: https://github.com/Open-EO/openeo-python-client/blob/master/examples/notebooks/openeo-terrascope-webinar.ipynb (scroll down half way, to the section about "time series") |
Is anyone up for a final review? PS: The openEO Sentinel Hub implementation is a bit confusing as it says in the process description of the back-end that it expects an object, but in reality expects an array. |
Merging for now as no new feedback came in. If there's anything to discuss, please open a new issue. |
Improvements for aggregate_spatial processes, see #252:
MultiPolgon
, but two values will be computed for aFeatureCollection
orGeometryCollection
containing two polygons.geometries
to have related descriptions in a single place.This behavior of MultiPolygons / Polygons is aligned with the VITO implementation AFAIK. Not sure about GeometryCollections.