[postgis-devel] Exporting a PostGIS raster using psql ?
Sandro Santilli
strk at keybit.net
Wed Feb 1 06:39:13 PST 2012
Answering to myself: the output of COPY with BINARY is good,
but you have to drop more tha the PGCOPY string.
In my case it was 25 bytes:
50 47 43 4F 50 59 0A FF 0D 0A 00 00 00 00 00 00 00 00 00 00 01 00 32 8D EC
P G C O P Y . . . . . . . . . . . . . . . . . . .
There's probably a row count or something else in there.
A tiff starts with: 49 49 2A, which is how I found out how much to drop.
--strk;
On Wed, Feb 01, 2012 at 01:50:48PM +0100, Sandro Santilli wrote:
> Has anyone tried exporting a postgis raster as an image
> using psql only ? I'm having an hard time getting anything
> like a binary file.
>
> Tried both with COPY WITH BINARY and a binary cursor.
>
> COPY WITH BINARY is the closest (contains something) but
> it isn't recognized as a tiff or png (as I requested).
>
> Here's what I did:
>
> alter table chenyx06a add tif bytea;
> update chenyx06a set tif = ST_AsTiff(rast);
> COPY chenyx06a(tif) TO '/tmp/out.tif' WITH binary;
>
> I also trimmed the initial PGCOPY string from output, but
> still isn't a tif. Ideas ?
>
> --strk;
>
> ,------o-.
> | __/ | Thank you for PostGIS-2.0 Topology !
> | / 2.0 | http://www.pledgebank.com/postgistopology
> `-o------'
>
--
,------o-.
| __/ | Thank you for PostGIS-2.0 Topology !
| / 2.0 | http://www.pledgebank.com/postgistopology
`-o------'
More information about the postgis-devel
mailing list