[GRASS-dev] Filter STDS by spatial index

Hei,

I do have a use case where I would like to filter maps in a STRDS by spatial extent before e.g. t.rast.univar processes all registered maps.
In particular, I want to process only maps from a STRDS that intersect with the current computational region.

The reason is that the maps registered in the STRDS are collections of single scenes of satellite images or collections of smaller mosaics that cover only parts of the total extent of the STRDS.

Currently, that does not seem to be supported by TGIS, and I see two options to address that:
a) patch the scenes together with a given granularity (e.g. daily mosaics), leave GRASS GIS functions untouched and hope that there is some coverage for reasonable region settings. or:
b) add a spatial filter to the "get_registered_maps"[1] function in abstract_space_time_dataset.py, and then subsequently flags to relevant modules that make use modified function...

For b) I would think that the most efficient way to handle it would be to add a where clause like it was done for the semantic labels? In that case, it may make sense to add an index for north, south, east, and west too, no? Maybe also top and bottom...

My main question, however is if my case is just a corner case, or does some sort of spatial filteing possibility make sense in general / more broadly...

Any feedback is much appreciated, esp. before I evtl. start working on b).

Kind regards,
Stefan

1) https://github.com/OSGeo/grass/blob/main/python/grass/temporal/abstract_space_time_dataset.py#L1604

On December 14, 2022 15:24:28 Stefan Blumentrath Stefan.Blumentrath@gmx.de wrote:

Hei,

I do have a use case where I would like to filter maps in a STRDS by spatial extent before e.g. t.rast.univar processes all registered maps.
In particular, I want to process only maps from a STRDS that intersect with the current computational region.

The reason is that the maps registered in the STRDS are collections of single scenes of satellite images or collections of smaller mosaics that cover only parts of the total extent of the STRDS.

Currently, that does not seem to be supported by TGIS, and I see two options to address that:
a) patch the scenes together with a given granularity (e.g. daily mosaics), leave GRASS GIS functions untouched and hope that there is some coverage for reasonable region settings. or:
b) add a spatial filter to the “get_registered_maps”[1] function in abstract_space_time_dataset.py, and then subsequently flags to relevant modules that make use modified function…

For b) I would think that the most efficient way to handle it would be to add a where clause like it was done for the semantic labels? In that case, it may make sense to add an index for north, south, east, and west too, no? Maybe also top and bottom…

My main question, however is if my case is just a corner case, or does some sort of spatial filteing possibility make sense in general / more broadly…

It seems a bit of a corner case, but in fact something I could use, of I understand it right.

Any feedback is much appreciated, esp. before I evtl. start working on b).

Kind regards,
Stefan

  1. https://github.com/OSGeo/grass/blob/main/python/grass/temporal/abstract_space_time_dataset.py#L1604

grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Hi Stefan,

Sorry for my late response here… Yes, that sounds like something useful to me, with collections of satellite images such a case/problem might be pretty common. So, having the chance to select/filter only those scenes (fully) covering the current computational region is a good addition in my opinion.

Thanks Stefan!

Cheers,
Vero

El mar, 20 dic 2022 a las 5:53, Paulo van Breugel (<p.vanbreugel@gmail.com>) escribió:

On December 14, 2022 15:24:28 Stefan Blumentrath <Stefan.Blumentrath@gmx.de> wrote:

Hei,

I do have a use case where I would like to filter maps in a STRDS by spatial extent before e.g. t.rast.univar processes all registered maps.
In particular, I want to process only maps from a STRDS that intersect with the current computational region.

The reason is that the maps registered in the STRDS are collections of single scenes of satellite images or collections of smaller mosaics that cover only parts of the total extent of the STRDS.

Currently, that does not seem to be supported by TGIS, and I see two options to address that:
a) patch the scenes together with a given granularity (e.g. daily mosaics), leave GRASS GIS functions untouched and hope that there is some coverage for reasonable region settings. or:
b) add a spatial filter to the “get_registered_maps”[1] function in abstract_space_time_dataset.py, and then subsequently flags to relevant modules that make use modified function…

For b) I would think that the most efficient way to handle it would be to add a where clause like it was done for the semantic labels? In that case, it may make sense to add an index for north, south, east, and west too, no? Maybe also top and bottom…

My main question, however is if my case is just a corner case, or does some sort of spatial filteing possibility make sense in general / more broadly…

It seems a bit of a corner case, but in fact something I could use, of I understand it right.

Any feedback is much appreciated, esp. before I evtl. start working on b).

Kind regards,
Stefan

  1. https://github.com/OSGeo/grass/blob/main/python/grass/temporal/abstract_space_time_dataset.py#L1604

grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev


grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Hi again,

Please see:
https://github.com/OSGeo/grass/pull/2725

It uses east, west, north and south in the where statement to select only maps that overlap with a given spatial extent (e.g. the computatinal region).
I would be happy to get a review of the PR, before proceding to eventual changes of module code...

Cheers
Stefan

Gesendet: Montag, 26. Dezember 2022 um 17:31 Uhr
Von: "Sören Gebbert" <soerengebbert@gmail.com>
An: "Stefan Blumentrath" <Stefan.Blumentrath@gmx.de>
Cc: grass-dev@lists.osgeo.org
Betreff: Re: [GRASS-dev] Filter STDS by spatial index

Hi,
i am not sure if this helps: some t.rast.* commands should support a where statement. Maybe you can use east, west, north and south in the where statement to select only maps that are in a extent that is build in the where statement?

Best regards
Sören

Am Mi., 14. Dez. 2022 um 15:24 Uhr schrieb Stefan Blumentrath <Stefan.Blumentrath@gmx.de[mailto:Stefan.Blumentrath@gmx.de]>:Hei,

I do have a use case where I would like to filter maps in a STRDS by spatial extent before e.g. t.rast.univar processes all registered maps.
In particular, I want to process only maps from a STRDS that intersect with the current computational region.

The reason is that the maps registered in the STRDS are collections of single scenes of satellite images or collections of smaller mosaics that cover only parts of the total extent of the STRDS.

Currently, that does not seem to be supported by TGIS, and I see two options to address that:
a) patch the scenes together with a given granularity (e.g. daily mosaics), leave GRASS GIS functions untouched and hope that there is some coverage for reasonable region settings. or:
b) add a spatial filter to the "get_registered_maps"[1] function in abstract_space_time_dataset.py, and then subsequently flags to relevant modules that make use modified function...

For b) I would think that the most efficient way to handle it would be to add a where clause like it was done for the semantic labels? In that case, it may make sense to add an index for north, south, east, and west too, no? Maybe also top and bottom...

My main question, however is if my case is just a corner case, or does some sort of spatial filteing possibility make sense in general / more broadly...

Any feedback is much appreciated, esp. before I evtl. start working on b).

Kind regards,
Stefan

1) https://github.com/OSGeo/grass/blob/main/python/grass/temporal/abstract_space_time_dataset.py#L1604[https://github.com/OSGeo/grass/blob/main/python/grass/temporal/abstract_space_time_dataset.py\#L1604\]

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org[mailto:grass-dev@lists.osgeo.org]
https://lists.osgeo.org/mailman/listinfo/grass-dev

Hi Stefan

I’ll test this weekend, would you mind providing us with a basic example to test? Thanks a lot!!

Vero

El jue, 5 ene 2023 a las 11:01, Stefan Blumentrath (<Stefan.Blumentrath@gmx.de>) escribió:

Hi again,

Please see:
https://github.com/OSGeo/grass/pull/2725

It uses east, west, north and south in the where statement to select only maps that overlap with a given spatial extent (e.g. the computatinal region).
I would be happy to get a review of the PR, before proceding to eventual changes of module code…

Cheers
Stefan

Gesendet: Montag, 26. Dezember 2022 um 17:31 Uhr
Von: “Sören Gebbert” <soerengebbert@gmail.com>
An: “Stefan Blumentrath” <Stefan.Blumentrath@gmx.de>
Cc: grass-dev@lists.osgeo.org
Betreff: Re: [GRASS-dev] Filter STDS by spatial index

Hi,
i am not sure if this helps: some t.rast.* commands should support a where statement. Maybe you can use east, west, north and south in the where statement to select only maps that are in a extent that is build in the where statement?

Best regards
Sören

Am Mi., 14. Dez. 2022 um 15:24 Uhr schrieb Stefan Blumentrath <Stefan.Blumentrath@gmx.de[mailto:Stefan.Blumentrath@gmx.de]>:Hei,

I do have a use case where I would like to filter maps in a STRDS by spatial extent before e.g. t.rast.univar processes all registered maps.
In particular, I want to process only maps from a STRDS that intersect with the current computational region.

The reason is that the maps registered in the STRDS are collections of single scenes of satellite images or collections of smaller mosaics that cover only parts of the total extent of the STRDS.

Currently, that does not seem to be supported by TGIS, and I see two options to address that:
a) patch the scenes together with a given granularity (e.g. daily mosaics), leave GRASS GIS functions untouched and hope that there is some coverage for reasonable region settings. or:
b) add a spatial filter to the “get_registered_maps”[1] function in abstract_space_time_dataset.py, and then subsequently flags to relevant modules that make use modified function…

For b) I would think that the most efficient way to handle it would be to add a where clause like it was done for the semantic labels? In that case, it may make sense to add an index for north, south, east, and west too, no? Maybe also top and bottom…

My main question, however is if my case is just a corner case, or does some sort of spatial filteing possibility make sense in general / more broadly…

Any feedback is much appreciated, esp. before I evtl. start working on b).

Kind regards,
Stefan

  1. https://github.com/OSGeo/grass/blob/main/python/grass/temporal/abstract_space_time_dataset.py#L1604[https://github.com/OSGeo/grass/blob/main/python/grass/temporal/abstract_space_time_dataset.py#L1604]

grass-dev mailing list
grass-dev@lists.osgeo.org[mailto:grass-dev@lists.osgeo.org]
https://lists.osgeo.org/mailman/listinfo/grass-dev


grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev