Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3626 closed defect (worksforme)

Is there a existing ticket for raster nodata larger than numeric(16,10)?

Reported by: pauldzy Owned by: robe
Priority: low Milestone: PostGIS 2.3.0
Component: raster Version: 2.2.x
Keywords: raster nodata constraint Cc:

Description

I have a variety of EPA grids using Int32 which arrive with a nodata value of -2147483647 or (after Esri processing) 2147483647. Either way this fails in _add_raster_constraint_nodata_values which requires the nodata value to fit into numeric(16,10).

I don't think there is an existing ticket but I do see the relatively recent alterations to move scale from 16,10 to 25,10. Is it possible to alter the nodata constraint creator to also use 25,10?

Thanks, Paul

Change History (3)

comment:1 by robe, 8 years ago

Owner: changed from Bborie Park to robe

I don't see why not. Might be safe enough to back port to 2.2.3, but I'll see. I forget if the raster_view makes some assumptions about it that may require a drop / create, in which case, probably best to stick in 2.3.

comment:2 by robe, 8 years ago

Resolution: worksforme
Status: newclosed

Paul,

Can you tell me which version of PostGIS you are running:

SELECT postgis_full_version();

I tested on PostGIS 2.2.2 as well as upcoming PostGIS 2.3.0rc1 and I'm not seeing an issue.

To test I did this:

CREATE TABLE rt(rid integer, rast raster);

INSERT INTO rt(rid, rast)
SELECT 1, ST_AddBand(ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0, 0), 1, '64BF', -1, -2147483647);

SELECT AddRasterConstraints('rt', 'rast')

Which created a constraint as expected that looks like this:

ALTER TABLE rt
  ADD CONSTRAINT enforce_nodata_values_rast CHECK (_raster_constraint_nodata_values(rast) = '{-2147483647.0000000000}'::numeric[]);

I also tried

CREATE TABLE rt2(rid integer, rast raster);

INSERT INTO rt2(rid, rast)
SELECT 1, ST_AddBand(ST_MakeEmptyRaster(10, 10, 10, 10, 2, 2, 0, 0, 0), 1, '64BF', -1, -2147483647.1234567890);

SELECT AddRasterConstraints('rt2', 'rast');

Which ends up creating a constraint

ALTER TABLE rt2
  ADD CONSTRAINT enforce_nodata_values_rast CHECK (_raster_constraint_nodata_values(rast) = '{-2147483647.1234600000}'::numeric[]);

So though you losse some precision, works too.

And my raster_columns output looks like this:

SELECT r_table_name, nodata_values
 FROM raster_columns;

 r_table_name | nodata_values
--------------+---------------
 rt           | {-2147483647}
 rt2          | {-2147483647.123456}
(1 row)

So both look fine to me. Is it possible that maybe not all your rasters have the same no data value?

If you can give the error/notice you are seeing that would help.

I'm marking this as a worksforme to get it out of the way. Feel free to reopen if you have an example with PostGIS 2.2.2+ that replicates the issue or provide more info.

comment:3 by pauldzy, 8 years ago

Hi robe,

Sorry I should have clearly marked this as 2.1.8 as I noticed it occurring there. I dug around and you all corrected the issue here for 2.2.2. https://github.com/postgis/postgis/commit/426be352b23973e96b00c6a738e3e6ce37d844d9

So the answer was there was an existing ticket! Apologies for the run-around and thanks for checking this over.

Cheers, Paul

Note: See TracTickets for help on using tickets.