Skip to content

add support for predefinedtilegrid in split_area #883#886

Open
VincentVerelst wants to merge 15 commits intomasterfrom
883-predefined-tilegrid-splitter
Open

add support for predefinedtilegrid in split_area #883#886
VincentVerelst wants to merge 15 commits intomasterfrom
883-predefined-tilegrid-splitter

Conversation

@VincentVerelst
Copy link
Copy Markdown
Collaborator

@VincentVerelst VincentVerelst commented Apr 2, 2026

The idea is to expose the split_area function to users. Users can provide an AOI, which can be split in different ways:

  • By providing a projection and tile_size: splits the AOI up in square tiles
  • By providing a PredefinedTileGrid (can also be a geopandas.GeoDataFrame), which splits the AOI according to that grid
  • By providing a custom subclass of TileGridInterface: splits the AOI according to their custom class

The function returns the split AOI as a geopandas.GeoDataFrame

@VincentVerelst VincentVerelst requested a review from HansVRP April 2, 2026 15:11
Copy link
Copy Markdown
Contributor

@HansVRP HansVRP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial comments and questions

"deprecated>=1.2.12",
'oschmod>=0.3.12; sys_platform == "win32"',
"importlib_resources; python_version<'3.9'",
# TODO #717 Simplify geopandas constraints when Python 3.8 support is dropped
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to rely on python 3.8 compatibility?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#717

It's needed for as long as the backend supports it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am probably overlooking something; but this runs only client side?

or is the limitation due to the geometry we send into the back-end

@@ -1,168 +1,265 @@
import geopandas as gpd
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have test coverage on the behavior if the AOI is a line or a single point?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the TileGrid tests covered this case. Also added a test for split_area. Current behaviour: only dict, Polygon or MultiPolygon is allowed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect

Copy link
Copy Markdown
Contributor

@HansVRP HansVRP Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the dict contains for instance a line or point

the error will come when openEO tries to run it I assume?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No the job splitter will fail, because the bbox is validated to must have east>west and north>south

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There still might be some niche cases we will encounter:

  • e.g. inputs in a geographic CRS with coordinates that extend past ±180° longitude, this breaks the assumption that west < east
  • Predefined tiles in a geographic CRS that wrap past the antimeridian

Couple of things we could do as follow up:

if west>east --> spliting two polygons and further split those seperatly. This seems low effort to me.

input polygons with lon past +-180 will be harder; I believe @soxofaan was also looking into this for the python client.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(made a small commit which I believe handles this: 1e0c178)

@VincentVerelst VincentVerelst requested a review from HansVRP April 8, 2026 14:27
@VincentVerelst
Copy link
Copy Markdown
Collaborator Author

@HansVRP , except for addressing your comments, one big change: there is now a standardized reprojecting happening to the CRS of the tile grid that is being used for splitting.

To re-iterate what will be exposes to the public API: the split_area function now takes as input an AOI, which can be split in either of two ways:

  • By providing a tile-grid as geopandas.GeoDataFrame or a list of (Multi)Polygon. In the background _PredefinedTileGrid will be used for splitting
  • By providing a projection and tile_size. In the background _SizeBasedTileGrid will be used for splitting. The origin will be taken to be the bottom-left of the AOI provided by the user.

Advanced users can always define their own splitting method by defining a subclass of _TileGridInterface, which is still experimental and prone to change

@HansVRP
Copy link
Copy Markdown
Contributor

HansVRP commented Apr 9, 2026

will look into the update; thanks.

can you also include a usecase example in: https://github.com/Open-EO/openeo-python-client/blob/master/docs/cookbook/job_manager.rst ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants