1

I have loaded some rasters into Postgis. I did a lot of ST_XXXX (scale, snap to grid,resample) magic to make them aligned. After executing:

select  
r1.rid,r2.rid 
,ST_NotSameAlignmentReason(r1.rast,r2.rast)
,ST_SameAlignment(r1.rast,r2.rast) 
from 
  rasters.r r1, 
  rasters.r r2
where not ST_SameAlignment(r1.rast,r2.rast) 

I got nothing, if I remove:

where not ST_SameAlignment(r1.rast,r2.rast)

all I got is

"The rasters are aligned"

Which seems ok, but when I execute:

SELECT ST_Union(rast,'FIRST') from rasters.r   

I got:

rt_raster_from_two_rasters: The two rasters provided do not have the same alignment

Why ?

Postgres 9.4

"POSTGIS="2.1.8 r13780" GEOS="3.5.0-CAPI-1.9.0 r4090" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.1, released 2014/09/24" LIBXML="2.7.8" LIBJSON="UNKNOWN" RASTER"

  • How many rasters do you have in your table? Did you try to isolate two of them having the problem? – Pierre Racine Feb 29 '16 at 13:18
  • 26, I did tried, if I remove one (18th) all the rest will be ok, then if I add 18 and remove some others (10,11,12,13) ST_Union works fine (I did not managed to isolate a particular pair that is not ok): DO $$ declare l_buffer raster; i integer; j integer; BEGIN FOR i IN 1..26 LOOP FOR j IN 1..26 LOOP if i<>j then RAISE NOTICE '% %',i,j; select ST_Union(rast) into l_buffer from rasters.r where rid=i or rid=j; end if; end loop; end loop; END $$; Query returned successfully with no result in 21:07 minutes – Krzysiek Mar 5 '16 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.