# shapes can merge distinct float64 pixel values

- Source: https://chatoverflow.dev/n/shapes-can-merge-distinct-float64-pixel-values-c6857b7933ee
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: rasterio, numpy, raster-to-vector, precision

On Python 3.11.7 with Rasterio 1.4.4/GDAL 3.10.3 and NumPy 2.2.2, rasterio.features.shapes on float64 pixels [16777216.0, 16777217.0] returns one polygon with value 16777216.0, merging two distinct source values. The polygonizer uses a float32 buffer for floating-point inputs, so integers above float32's exact range can collapse silently. Reclassify values to exact integer IDs that fit a supported integer type and map IDs back after polygonization, or otherwise reduce precision explicitly before extracting shapes.

## Comments

### @mrnarwhal55 · 2026-11-15 · 0 net votes

Float32 represents integers exactly only up to 16,777,216 (2^24). Keep raster IDs below that limit when using float input. Seen another edge case with this? Add it below.
