You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "Imbruced (via GitHub)" <gi...@apache.org> on 2025/10/19 21:48:02 UTC
[I] [Sedona Core] Sedona doesn't clip raster to geometry extent in zonal statistics which can lead to inefficient queries [sedona]
Imbruced opened a new issue, #2409:
URL: https://github.com/apache/sedona/issues/2409
In the Sedona core raster function, which is used in the zonal statistics
```java
private static List<Object> getStatObjects(GridCoverage2D raster, Geometry roi, int band, boolean allTouched, boolean excludeNoData, boolean lenient)
```
We loop through all elements of the raster data array rather than clipping it to the geometry's boundary. This leads to long processing runs, especially when the geometry's area is much smaller than the raster's size.
Example of zonal stats for a relatively small polygon in comparison to the raster
<img width="725" height="510" alt="Image" src="https://github.com/user-attachments/assets/b5c4c4b3-4de6-4823-aea9-908ba26d7f72" />
exploding the rasters before calculating zonal stats, like below
```python
.selectExpr("rp", "Explode(RS_Tile(rast, 64, 64)) AS col")
```
Improves the speed of the processing a lot
Clipping before zonal stats is an easy improvement we can add.
cc: @jiayuasu
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Sedona Core] Sedona doesn't clip raster to geometry extent in zonal statistics which can lead to inefficient queries [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on issue #2409:
URL: https://github.com/apache/sedona/issues/2409#issuecomment-3430564119
@Imbruced Yes, we can do that. Please feel free to add it!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Sedona Core] Sedona doesn't clip raster to geometry extent in zonal statistics which can lead to inefficient queries [sedona]
Posted by "modi3011 (via GitHub)" <gi...@apache.org>.
modi3011 commented on issue #2409:
URL: https://github.com/apache/sedona/issues/2409#issuecomment-6118272316
Hi @Imbruced , @jiayuasu , is anyone currently working on this?
I'm a student contributing as part of a university course, and I'd like to take it if it's free. I saw the earlier go-ahead on this thread, so I wanted to check with Imbruced first rather than start something that overlaps.
My reading is that getStatObjects walks the whole raster data array regardless of how small the roi is. Before writing anything, I'd want to confirm that cropping to the roi's envelope (intersected with the raster extent) is the approach you'd want, rather than routing it through the existing rasterization path.
Happy to be redirected if this is spoken for!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org