0

I am trying to do a lo_export of a raster record in PostGIS table:

SET postgis.gdal_enabled_drivers = 'ENABLE_ALL';

SELECT oid, lowrite(lo_open(oid, 131072), tiff) As num_bytes
FROM
( VALUES (lo_create(0),
ST_Astiff( (SELECT rast FROM raster_table) )
) ) As v(oid,tiff);

Finally I did SELECT lo_export(oid,'filesystempath');

But when I check the file system path there is nothing there... Anybody know why?

And how can I do to generate the TIFF file?

1 Answer 1

1

the function lo_export() you use is a server side function.

Maybe your file was written into a system directory such as /usr/.../postgresql/... on the server-side (which may be a remote machine) or had issues with access privileges.

I think you can use \lo_export in the psql client if you intend to generate the output image in the file system of your client machine:

\lo_export loid filename

Reads the large object with OID loid from the database and writes it to filename. Note that this is subtly different from the server function lo_export, which acts with the permissions of the user that the database server runs as and on the server's file system.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.