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
rt_raster_from_two_rasters: The two rasters provided do not have the same alignment
"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"