You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "jiayuasu (via GitHub)" <gi...@apache.org> on 2026/09/14 01:32:01 UTC
[I] RS_AsGeoTiff and RS_AsCOG drop NaN nodata values and write the source file's nodata value instead of the raster's [sedona]
jiayuasu opened a new issue, #3367:
URL: https://github.com/apache/sedona/issues/3367
## Expected behavior
`RS_AsGeoTiff` and `RS_AsCOG` should write band 1's nodata value to the `GDAL_NODATA` tag whatever it is, `NaN` included, and write the value the raster currently declares: after `RS_SetBandNoDataValue(raster, 1, -9999, true)` the file should say `-9999`, after `RS_SetBandNoDataValue(raster, 1, null)` it should carry no tag.
## Actual behavior
Both functions go through the GeoTools `GeoTiffWriter`, which
- never writes a NaN nodata value (`GDAL_NODATA=nan` from a float source is lost on the way out, so the file reads back with no nodata value once #3365 makes the reader keep it);
- prefers the `GC_NODATA` image property, copied verbatim from the source file, over the nodata value the raster declares, so a value changed or removed with `RS_SetBandNoDataValue` after reading is ignored and the source file's value is written instead;
- invents a nodata value for integer rasters that declare none (0 for byte bands), which `RasterOutputs.asGeoTiff` currently works around by switching `WRITE_NODATA` off when no band has one.
None of this is adjustable from outside: the guard sits inside `write()`, the helpers it calls are private, and `setMetadataValue` cannot address the `GDAL_NODATA` tag.
## Steps to reproduce the problem
```sql
SELECT RS_BandNoDataValue(RS_FromGeoTiff(RS_AsGeoTiff(RS_SetBandNoDataValue(RS_FromGeoTiff(content), 1, -7))))
FROM binary_files -- a GeoTIFF whose GDAL_NODATA is 0
-- expected -7, got 0
```
## Settings
Sedona version = master (2.0.0-SNAPSHOT)
API type = Scala, Java, Python, SQL
Spark version = 3.5
Scala version = 2.12
JRE version = 11
--
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] RS_AsGeoTiff and RS_AsCOG drop NaN nodata values and write the source file's nodata value instead of the raster's [sedona]
Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu closed issue #3367: RS_AsGeoTiff and RS_AsCOG drop NaN nodata values and write the source file's nodata value instead of the raster's
URL: https://github.com/apache/sedona/issues/3367
--
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