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:35:15 UTC

[PR] [GH-3367] Write the band nodata value, NaN included, to GeoTIFF and COG output [sedona]

jiayuasu opened a new pull request, #3368:
URL: https://github.com/apache/sedona/pull/3368

   > **Stacked on #3366.** The first commit here is that PR; review the second commit only (`[GH-3367] ...`). This branch will be rebased onto master once #3366 merges.
   
   ## Did you read the Contributor Guide?
   
   - Yes, I have read the [Contributor Rules](https://sedona.apache.org/latest/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest/community/develop/)
   
   ## Is this PR related to a ticket?
   
   - Yes, and the PR name follows the format `[GH-XXX] my subject`. Closes #3367
   
   ## What changes were proposed in this PR?
   
   `RS_AsGeoTiff` and `RS_AsCOG` encoded through the GeoTools `GeoTiffWriter`, which never writes a NaN nodata value, prefers the `GC_NODATA` image property copied from the source file over the nodata value the raster declares (so a value changed or removed with `RS_SetBandNoDataValue` was not what got written), and invents a nodata value for integer rasters that declare none (worked around so far by switching `WRITE_NODATA` off). None of that is adjustable from outside the writer.
   
   - `GeoTiffWriters` encodes a coverage through the public GeoTools and ImageIO-Ext APIs only: CRS keys from `CRS2GeoTiffMetadataAdapter`, the corner-based grid-to-CRS transform written as a `ModelTransformation` (swapped to longitude-first for latitude-first CRSs), `RasterPixelIsArea`, `GDAL_NODATA` from band 1's NODATA category written exactly when one is declared, and the ImageIO-Ext `TIFFImageWriter` for encoding. Whole coverages only; a source region, subsampling or band selection on the write parameters is refused rather than silently misgeoreferenced.
   - `RasterOutputs.asGeoTiff` and `CogWriter` use it; the `WRITE_NODATA` workaround goes away.
   - Docs on `RS_AsGeoTiff`.
   
   This is the same file that replaced the equivalent writer in the Wherobots build, so the two code bases share one write path. Follows #3366, which it depends on for `RasterUtils.hasNoDataValue`.
   
   ## How was this patch tested?
   
   - `RasterOutputTest`: NaN nodata round trip from the fixture and from an in-memory raster, float raster without nodata stays without one, changed nodata wins over the file's value; georeference round trip for projected (EPSG:3857), geographic (EPSG:4326) and rotated grids; a coverage built on latitude-first `EPSG:4326` reads back with the lon/lat georeference; engineering CRS rejected; partial writes rejected
   - `CogWriterTest`: NaN nodata survives `RS_AsCOG`
   - `rasteralgebraTest`: `RS_FromGeoTiff(RS_AsGeoTiff(raster))` and `RS_FromGeoTiff(RS_AsCOG(raster))` keep the NaN nodata value and the valid-pixel count
   - `gdalinfo` on the output: `NoData Value=nan` for plain and COG writes, `-9999` after `RS_SetBandNoDataValue(..., replace)`, no tag after removal or for a byte raster without nodata, and the full geotransform for the rotated case
   - full `common` suite and `rasteralgebraTest` pass locally
   
   ## Did this PR include necessary documentation updates?
   
   - Yes, I have updated the documentation.
   


-- 
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: [PR] [GH-3367] Write the band nodata value, NaN included, to GeoTIFF and COG output [sedona]

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu merged PR #3368:
URL: https://github.com/apache/sedona/pull/3368


-- 
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