Add raster geometric operations (polygon clipping, rotation, seam blending)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by reading the existing crop() and rasterize() functions for clipping and mask behavior, then inspect merge() for current overlap handling. Define tests for polygon masking, affine transformations, and feathered blending; the work is complete when each requested operation has coverage for its stated inputs and expected raster output.
Written by the indexing model from the issue text.
Description
Some basic raster manipulation operations are missing from xarray-spatial.
Scope
Polygon clipping
Clip a raster to an arbitrary polygon geometry, not just a bounding box like crop() does. Pixels outside the polygon get masked to nodata. This should accept shapely geometries or coordinate arrays for the clip mask.
This is probably the highest priority item here. It comes up constantly in analysis workflows where you need to extract data for an irregular study area, watershed boundary, administrative unit, etc.
Raster rotation and affine transformation
Arbitrary rotation and affine transforms beyond what reprojection handles. Useful for aligning imagery, rotating to a local coordinate frame, or correcting sensor geometry.
Mosaic with feathered blending
Distance-weighted blending at seam lines when mosaicking overlapping rasters. The existing merge() handles overlap by picking one value, but doesn't blend. Feathered blending produces much better results where rasters overlap, especially when there are brightness or exposure differences between tiles.
Notes
Polygon clipping involves rasterizing the polygon boundary and masking. The existing rasterize() function could potentially be reused for the polygon-to-mask step.
- Dominant language
- Python
- Stars
- 972
- Forks
- 92
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from xarray-contrib/xarray-spatial
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
xarray-contrib/xarray-spatial#3726 ·
-
api area:surface bug severity:medium sweep-api-consistency
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
xarray-contrib/xarray-spatial#3712 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
xarray-contrib/xarray-spatial#3710 ·
-
bug
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
xarray-contrib/xarray-spatial#3707 ·
-
area:surface documentation user-guide-example
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
xarray-contrib/xarray-spatial#3464 ·
All issues in xarray-contrib/xarray-spatial
Similar issues
-
area/auth bug comp/agent P3 platform/discord type/security
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
NousResearch/hermes-agent#117848 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100