Hi.  I have a problem that is driving me nuts.  I’ve got an out-of-db raster 
table that contains a time series of images of the same area (one per date), 
and it is tiled. I’m trying to clip a section of it with a polygon.

 

If I union the tiles for a particular date and then clip them, I get the 
correct answer.  I’ll show this in two steps for simplicity:

 

#1. Create a unioned raster for a single date

CREATE TABLE onedate AS (

  SELECT ST_Union(rast) AS rast FROM myrastertable

  WHERE image_date = '2010-01-01'

)

 

#2. Clip the unioned raster (gives the correct answer)

SELECT ST_Clip(rast, geom,true) AS rast FROM onedate, totalconvexhull

  WHERE ST_Intersects(rast, geom)

 

…but if I try the same thing with the tiled version of the table, it fails:

 

#1. Create a tiled raster for the same date

CREATE TABLE onedate_tiled AS (

  SELECT * FROM myrastertable WHERE image_date = '2010-01-01'

)

 

#2. Clip the tiled raster (this fails: it seems to get rid of some of the tiles 
where there is no overlap with the polygon, but stuff hangs over the edges of 
the polygon for tiles that cross the boundary of the polygon)

SELECT ST_Clip(rast, geom, true) AS rast FROM onedate_tiled, totalconvexhull

WHERE ST_Intersects(rast, geom)

 

I’d love to know what I am missing.  Ultimately, I want to clip all of the 
dates to the same polygon.

 

Thanks!

 

John

_______________________________________________
postgis-users mailing list
postgis-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/postgis-users

Reply via email to