Skip to content

feat: add keep_native_crs option to RasterioSource - #2331

Open
Pranava-Kumar wants to merge 1 commit into
azavea:masterfrom
Pranava-Kumar:feat/keep-native-crs
Open

feat: add keep_native_crs option to RasterioSource#2331
Pranava-Kumar wants to merge 1 commit into
azavea:masterfrom
Pranava-Kumar:feat/keep-native-crs

Conversation

@Pranava-Kumar

Copy link
Copy Markdown

Summary

Fixes #2323 — adds keep_native_crs parameter to RasterioSource and RasterioSourceConfig that preserves the input raster's native CRS for both image_crs and map_crs, instead of defaulting map_crs to EPSG:4326.

Motivation

When RasterioSource reads a raster with a projected CRS (e.g. EPSG:3857), the RasterioCRSTransformer defaults map_crs to EPSG:4326 even when the image_crs is already a projected coordinate system. This causes:

  • Precision loss from unnecessary reprojection between two projected CRS
  • Edge artifacts at tile boundaries from repeated reprojection
  • Performance cost of redundant CRS transformations

Changes

  • RasterioSource.__init__: Added keep_native_crs: bool = False parameter.
  • RasterioSourceConfig: Added keep_native_crs: bool = Field(False).
  • Tests: 3 tests — default behavior, EPSG:3857 input, EPSG:4326 input.

Backward Compatibility

Fully backward compatible. keep_native_crs=False (default) preserves existing behavior.

Closes #2323.

Adds a keep_native_crs parameter to RasterioSource and
RasterioSourceConfig that preserves the input raster's native CRS
for both image_crs and map_crs instead of defaulting map_crs to
EPSG:4326. This eliminates precision loss from unnecessary CRS
transformations and avoids edge artifacts at tile boundaries.

Closes azavea#2323.
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.

Add keep_native_crs parameter to RasterioSource to preserve input raster CRS

1 participant