[PostGIS] #6010: ST_SetBandNoDataValue can't handle infinite no data

PostGIS trac at osgeo.org
Wed May 6 10:20:04 PDT 2026


#6010: ST_SetBandNoDataValue can't handle infinite no data
-------------------------+-------------------------------------------------
  Reporter:              |      Owner:  robe
  GISuser5432            |
      Type:  defect      |     Status:  new
  Priority:  low         |  Milestone:  PostGIS 3.2.10
 Component:  raster      |    Version:  3.6.x
Resolution:              |   Keywords:  ST_Polygon (raster) ; Raster;
                         |  PostGIS_Raster;
-------------------------+-------------------------------------------------
Comment (by GISuser5432):

 The problem is not only **Infinity** in that example (which I think
 originally was 64BF maximum and not Infinity).

 The ST_Polygon(rast) returns the NoData areas (by mistake) when the NoData
 is 3.4028234663852886e which is the maximum of **32BF** pixel type.
 However, on an old server with PostGIS 2.4.3, ST_Polygon(rast) works well
 even with 32BF max.


 I attached test_st_polygonit_dump.sql that is the export of a raster in
 which the NoData is the maximum of 32BF pixel type.

 Previously, in older version PostGIS, I have in my old server,
 ST_Polygon(raster) was working well to find the part of the raster that
 has values.

 However, the new PostGIS that I have in docker is not able to extract the
 currect polygon when NoData is the max of 32BF.

 When I convert the NoData to smaller values, then, it works well!!



 the new version is:

 {{{
 POSTGIS="3.6.0 4c1967d" [EXTENSION] PGSQL="180" GEOS="3.13.1-CAPI-1.19.2"
 PROJ="9.6.0 NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org
 USER_WRITABLE_DIRECTORY=/var/lib/postgresql/.local/share/proj
 DATABASE_PATH=/usr/share/proj/proj.db" (compiled against PROJ 9.6.0)
 GDAL="GDAL 3.10.3, released 2025/04/01" LIBXML="2.9.14" LIBJSON="0.18"
 LIBPROTOBUF="1.5.1" WAGYU="0.5.0 (Internal)" RASTER
 }}}


 and also using the new version of PostGIS, the query you gave me returns
 only 3.4028234663852886e+38 not Infinity and pixel type is 32BF:


 {{{

 SELECT (gv).val val1, ST_Area((gv).geom) AS nodata,
 ST_Area(rast::Geometry)
         FROM test_st_polygon, ST_DumpAsPolygons(rast) AS gv
 WHERE gv.val > 0;
 }}}


 [[Image(result_of_query.png​)]]


 Finally, I want to say that even in 32BF raster with a valid NoData value
 equal to the maximum of 32BF, the ST_Polygon is not working in newer
 versions while in very old versions it was working without any problem for
 years. The old version on which ST_Polygon is working well is:


 {{{
 POSTGIS="2.4.3 r16312" PGSQL="100" GEOS="3.6.2-CAPI-1.10.2 4d2925d6"
 PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.2.3, released 2017/11/20"
 LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.2.1" RASTER
 }}}
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/6010#comment:5>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list