#1567 closed defect (invalid)
[raster] The SRID of the empty raster returned by ST_MapAlgebraExpr(rast, rast, 'intersection') should be 0
Reported by: | pracine | Owned by: | pracine |
---|---|---|---|
Priority: | low | Milestone: | PostGIS 2.0.0 |
Component: | raster | Version: | master |
Keywords: | Cc: |
Description
CREATE OR REPLACE FUNCTION ST_TestRaster(ulx float8, uly float8, val float8) RETURNS raster AS $$ DECLARE BEGIN RETURN ST_AddBand(ST_MakeEmptyRaster(3, 3, ulx, uly, 1, 1, 0, 0, -1), '32BF', val, -1); END; $$ LANGUAGE 'plpgsql'; SELECT ST_Metadata(ST_MapAlgebraExpr(ST_TestRaster(0, 0, 1), ST_TestRaster(4, 4, 1), '[rast1.val] + [rast2.val]', '32BF', 'INTERSECTION'));
Change History (6)
comment:1 by , 13 years ago
follow-ups: 3 6 comment:2 by , 13 years ago
Hum. It might make sense.
Does it make sense to give a SRID to en empty raster?
Do empty geometries have a SRID?
Is it normal to be able to create and empty raster with SRID equal to -1? Should not SRID be clamped to 0?
comment:3 by , 13 years ago
Replying to pracine:
Hum. It might make sense.
Does it make sense to give a SRID to en empty raster?
In this situation, I'd say yes since the output is based upon the input rasters.
Do empty geometries have a SRID?
No. The following returns NULL
SELECT ST_SRID(NULL::geometry(POINT, 4326))
Is it normal to be able to create and empty raster with SRID equal to -1? Should not SRID be clamped to 0?
SRID < 0 is clamped to 0.
So, change the empty raster's SRID to zero?
comment:4 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
As a last test I would check the SRID of the empty geometry resulting from an intersection. If it's the same as the input geometry then no. If it's 0 then yes.
SELECT ST_SRID(ST_Intersection(ST_Buffer(ST_SetSRID(ST_MakePoint(1.5, -1.5), 4269), 0.2), ST_Buffer(ST_SetSRID(ST_MakePoint(4.5, -1.5), 4269), 0.2)));
Gives 4269… so it should be the same as the input raster…
I set it to invalid.
However:
SELECT ST_SRID(ST_MakeEmptyRaster(4, 4, 0, 0, 1, -1, 0, 0, -10))
should return 0 no? Since:
SELECT ST_SRID(ST_SetSRID(ST_MakePoint(4.5, -1.5), -4269));
Does…
comment:5 by , 13 years ago
The return of -10 for the following is invalid and should be ticketed as a bug.
SELECT ST_SRID(ST_MakeEmptyRaster(4, 4, 0, 0, 1, -1, 0, 0, -10))
comment:6 by , 13 years ago
Replying to pracine:
Do empty geometries have a SRID?
Yes !
SELECT ST_Srid('SRID=4326;POINT EMPTY');
Shouldn't the SRID of the empty raster be the SRID of the input rasters (assuming the input rasters have the same SRID)? I'm assuming that is the current behavior.