[postgis-users] Permute raster's dimensions (flip raster's coordinates)

Regina Obe lr at pcorp.us
Fri Nov 17 14:45:51 PST 2017


You can use ST_SetUpperLeft to reset the  cords.  There isn't any information in the pixels itself, it is all in the metadata of the raster.

 

http://postgis.net/docs/manual-2.4/RT_ST_SetUpperLeft.html

 

 

So something like

 

UPDATE your_table SET rast = ST_SetUpperLeft(rast, ST_UpperLeftY(rast), ST_UpperLeftX(rast) );

 

Depending on how messed up your lat/lon / order you assumed direction of pixels, you may need to use Georeference instead as your scalex/y may be wrong too.

Changing the GeoReference will allow you to change upper left in addition to scale x/ y with a single update.

 

http://postgis.net/docs/manual-2.4/RT_ST_SetGeoReference.html

 

Note you may need to drop whatever scale constraints you have on raster first before you can use this.

 

Hope that helps,

Regina

 

 

 

 

From: postgis-users [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of ????? ??????
Sent: Friday, November 17, 2017 11:22 AM
To: postgis-users at lists.osgeo.org
Subject: [postgis-users] Permute raster's dimensions (flip raster's coordinates)

 

Greetings,

 

Is there any way to permute lat/lon (x/y) coordinates in a raster, i.e. how to achieve something similar to st_flipcoordinates behaviour for rasters?

 

Thank you.

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


More information about the postgis-users mailing list