[postgis-users] st_union(rast) returning null because of non alignment,

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Thu Nov 8 08:44:25 PST 2012


So displaying the two extents it is clear that the two rasters are not aligned on the same grid. You will have to ST_SnapToGrid() one raster to the other before ST_Union()ing them.

Pierre

> -----Original Message-----
> From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-
> bounces at lists.osgeo.org] On Behalf Of Rhys A.D. Stewart
> Sent: Thursday, November 08, 2012 6:50 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] st_union(rast) returning null because of non
> alignment,
> 
> So given that st_union is not the solution, how would I go about merging two
> adjacent raster tiles?
> 
> 
> On Wed, Nov 7, 2012 at 6:12 PM, Rhys A.D. Stewart <rhys.stewart at gmail.com>
> wrote:
> 
> 
> 	ok, well that may be the issue, I was trying to union a rasterised table of
> adjacent polygons. So will the corners may touch I doubt they overlap, but here
> is the output of st_metadata for two of the polygons that are adjacent:
> 
> 	Clarendon 698486.043582936 617384.893096908 153 229 250 250 0 0
> 3448 4
> 	Manchester 683177.872077352 632613.85425893 117 182 250 250 0 0
> 3448 4
> 
> 
> 
> 	On Wed, Nov 7, 2012 at 6:01 PM, Pierre Racine
> <Pierre.Racine at sbf.ulaval.ca> wrote:
> 
> 
> 		By "on the same grid" I mean " at least one of any of the four
> corners of any pixel of one raster falls on any corner of the grid of the other
> raster" as stated in the ST_SameAlignment() doc.
> 
> 		What is (are) the pixel size?
> 
> 
> 		> -----Original Message-----
> 		> From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-
> users-
> 		> bounces at lists.osgeo.org] On Behalf Of Rhys A.D. Stewart
> 
> 		> Sent: Wednesday, November 07, 2012 5:51 PM
> 		> To: PostGIS Users Discussion
> 
> 		> Subject: Re: [postgis-users] st_union(rast) returning null
> because of non
> 		> alignment,
> 		>
> 		> Pierre,
> 		>
> 		> If by on the same grid you mean equal, then no hey are not.
> Here they are.
> 		>
> 		>
> 		> 1: POLYGON((766242.610093044
> 641994.463110607,779742.610093044
> 		> 641994.463110607,779742.610093044
> 648494.463110607,766242.610093044
> 		> 648494.463110607,766242.610093044 641994.463110607))
> 		> 2:POLYGON((698486.043582936
> 617384.893096908,736736.043582936
> 		> 617384.893096908,736736.043582936
> 674634.893096908,698486.043582936
> 		> 674634.893096908,698486.043582936 617384.893096908))
> 		>
> 		> Thanks,
> 		>
> 		> Rhys
> 		>
> 		>
> 		> On Wed, Nov 7, 2012 at 5:40 PM, Pierre Racine
> <Pierre.Racine at sbf.ulaval.ca>
> 		> wrote:
> 		>
> 		>
> 		>       Hi Rhys,
> 		>
> 		>       Both rasters must also have their upperlefx and upperlefty
> on the same
> 		> grid.
> 		>
> 		>       Could you do:
> 		>
> 		>       SELECT ST_AsText(ST_ConvexHull(rast))
> 		>
> 		>       on both rasters and post the result here?
> 		>
> 		>       Thanks,
> 		>
> 		>       Pierre
> 		>
> 		>
> 		>       > -----Original Message-----
> 		>       > From: postgis-users-bounces at lists.osgeo.org
> [mailto:postgis-users-
> 		>       > bounces at lists.osgeo.org] On Behalf Of Rhys A.D.
> Stewart
> 		>       > Sent: Wednesday, November 07, 2012 5:33 PM
> 		>       > To: PostGIS Users Discussion
> 		>       > Subject: [postgis-users] st_union(rast) returning null
> because of non
> 		> alignment,
> 		>       >
> 		>       > Greetings,
> 		>       >
> 		>       > according to the trusty docs online two rasters are
> aligned when they
> 		> share the
> 		>       > same skew, scale and srid. Created a raster using
> st_asraster  and
> 		> according to
> 		>       > st_metadata scale, skew and srid are all equal. Howvere
> st_unon
> 		> complains
> 		>       > saying that 'The two rasters provided do not have the
> same alignment.
> 		>       > Returning NULL'
> 		>       >
> 		>       > I noticed that  ticket #1336 as possibly relating to my
> issue, but I'm not
> 		> entirely
> 		>       > sure. My posgis version is:
> 		>       > POSTGIS="2.0.0 r9605" GEOS="3.3.3-CAPI-1.7.4"
> PROJ="Rel. 4.8.0, 6
> 		> March
> 		>       > 2012" GDAL="GDAL 1.9.0, released 2011/12/29"
> LIBXML="2.7.8"
> 		>       > LIBJSON="UNKNOWN" TOPOLOGY RASTER
> 		>       >
> 		>       >
> 		>       > What am I missing or doing incorrectly?
> 		>       >
> 		>       > Regards,
> 		>       >
> 		>       > Rhys
> 		>
> 		>       _______________________________________________
> 		>       postgis-users mailing list
> 		>       postgis-users at lists.osgeo.org
> 		>       http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-
> users
> 		>
> 		>
> 
> 		_______________________________________________
> 		postgis-users mailing list
> 		postgis-users at lists.osgeo.org
> 		http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> 
> 
> 



More information about the postgis-users mailing list