ZGIS / semantique

Semantic Querying in Earth Observation Data Cubes
https://zgis.github.io/semantique/
Apache License 2.0
16 stars 6 forks source link

Spatial relational operators #6

Closed luukvdmeer closed 1 year ago

luukvdmeer commented 2 years ago

Description

In the current version we have already specific temporal relational operators (during, after and before) next to the regular relational operators (equal, greater, less, ..). These are meant for usage on arrays that have timestamps as their pixel values. Such arrays are obtained when extracting the time dimension coordinates from a spatio-temporal array. They are mainly useful when applying temporal filters.

Following the same idea, there should also be specific spatial relational operators that can be used on arrays that have x,y coordinate tuples as their pixel values. Such arrays are obtained when extracting the space dimension from a spatio-temporal array. They will mainly be useful when applying spatial filters.

The right-hand side in such a spatial relational expression would then be an object of class SpatialExtent which during query recipe construction can be referenced by e.g. sq.geometry() (just like sq.time_instant() and sq.time_interval() can already be used to reference TemporalExtent objects).

Spatial relational operators include:

An instruction using such expression could look like:

sq.entity("water").filter_space("intersects", sq.geometry(<geopandas object>))

Additional context

See here

whisperingpixel commented 2 years ago

Thanks @luukvdmeer for the initiative, we should continue investigating spatial analysis options and it's good to push it further. Just for clarification for me:

I would be happy to contribute to answer follow-up questions, e.g.

luukvdmeer commented 1 year ago

The geopandas object is an area provided by the user, and should be a subset of the total AOI. In this way, it can be used to spatially filter pixels for a certain result, just as you can temporally filter pixels e.g. by keeping only those inside a certain year or month within the overall time span.

The intersects operators is implemented already (it uses the centroid of each pixel, i.e. pixels are filtered out if their centroid does not intersect with the provided area). For now I don't think it is needed to add more, lets first see if this feature is useful at all. Also note that this functionality is not "ported" to the Sen2Cube frontend, since we don't have a block to define spatial polygons.