[postgis-users] Problem with union of rasters (postgis 2.4 rds)

Regina Obe lr at pcorp.us
Tue Jun 2 09:27:47 PDT 2020


ST_AsRaster has a ton of overloaded formats unfortunately.  I suspect your 

 

SELECT ST_ASRaster(ST_SetSRID(ST_EXTENT( myQuads), 4326), 0.1, 0.1 ,'8BUI')

 

Is falling into the overload

 

raster ST_AsRaster(geometry geom, integer width, integer height, text pixeltype, double precision value=1, double precision nodataval=0, double precision upperleftx=NULL, double precision upperlefty=NULL, double precision skewx=0, double precision skewy=0, boolean touched=false);

 

Instead of raster ST_AsRaster(geometry geom, double precision scalex, double precision scaley, text pixeltype, double precision value=1, double precision nodataval=0, double precision upperleftx=NULL, double precision upperlefty=NULL, double precision skewx=0, double precision skewy=0, boolean touched=false);

 

Try explicitly specifying the args

 

SELECT ST_ASRaster(ST_SetSRID(ST_EXTENT( myQuads), 4326), scalex => 0.1, scaley => 0.1 , pixeltype => '8BUI')

 

 

For older versions of PostgreSQL, you might need to replace the =>  with :=

 

Hope that helps,

Regina

 

 

From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Lionel Cayla
Sent: Tuesday, June 2, 2020 9:17 AM
To: postgis-users at lists.osgeo.org
Subject: [postgis-users] Problem with union of rasters (postgis 2.4 rds)

 

Hi, 

 

I am having an issue, when rasterizing a union of rasters. Each of the geometries from my initial table are quads or polygons, and the following SQL command 

(that should work according the documentation right?) gives me a raster 2x2 .

 

CREATE TABLE raster_test AS

(WITH

rast AS (SELECT ST_ASRaster(ST_SetSRID(ST_EXTENT( myQuads), 4326), 0.1, 0.1 ,'8BUI')

FROM myDB, 

WHERE ST_IsValid(myQuads)),

  raster_ AS (SELECT ST_Union(ST_ASRaster(ST_SetSRID(ST_Force2D( myQuads), 4326), rast.ST_ASRaster), 'SUM')

FROM myDB, rast

WHERE myQuads  IS NOT NULL)

 SELECT  raster_.ST_Union as rast_chunks

  FROM raster_, rast );

 

The command produces the desired raster if I replace my resolution (0.1, 0.1) by the raster size if it's equal to 150. Over that (200 say) I get an alignment error message.

I tried to cast 0.1 to double precision I still get an issue. 

 

I am wondering if I am doing something wrong here or if there's a known issue. 

 

Thanks, 

 

-Lio

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20200602/c69bd428/attachment.html>


More information about the postgis-users mailing list