Offset when rasterizing data
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 394
- Forks
- 95
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 7
Description
When rasterizing images or labels (basically resampling), there is an offset (see picture) that I think is due to the fact that somewhere in the code for rasterization the coordinates of the pixels are considered to be associated with the top left corner, and in other parts of the code for rasterization the coordinates refer to the center of the pixels.
This half pixel difference is not negligible since when we align together images of different resolutions, one pixel for one image can be many pixels for another.
The screenshot is from this example: https://github.com/scverse/spatialdata/blob/eb99aebbdb4f7b7ee69d9663c5c996f5fa8f0440/examples/dev-examples/spatial_query_and_rasterization.py#L15

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.
Research direction
Start with examples/dev-examples/spatial_query_and_rasterization.py at the linked example and trace the rasterization and resampling entry points it uses. Compare how pixel coordinates are interpreted for images and labels at different resolutions; done means aligned rasters no longer show the reported half-pixel offset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100