TransWikia.com

Unable to read TIFF file with raster2pgsql

Geographic Information Systems Asked by CarlaBirdy on April 18, 2021

I am having some trouble with the raster2pgsql function (on a Windows 7 in the OSGeo4W shell). I am receiving the error "Unable to read raster file". I can import shapefiles, ok using org2org so I know that the connection works, it just does not work for the raster2pgsql function.

To retrace my steps, I first changed the directory from m:/> to the folder containing my raster:

cd M:UsersuserIDDocumentsRKoala_Projkoala_datakoala_information_basehabitat_suitability

I then check the files within the directory using >dir to see what the raster is called. From this, I receive a list of the one raster in this folder and the affiliated files, such as:
koala_raster.tif

I then try to use the raster2pgsql to import this raster to the above directory in postgresql:

raster2pgsql -s 4283 -I -C -t 100x100 koala_raster.tif public.khsm │
psql -h localhost -p 1234 -d koala -U postgres

I have also tried:

raster2pgsql -s 4283 -I -C -t 100x100 *.tif public.khsm │
psql -h localhost -p 1234 -d koala -U postgres

From these queries, I receive the error "Unable to read raster file".

However, rather than the file that this error refers bring named "koala_raster.tif" it prints "._koala_raster.tif". I am not sure what the "._" at the beginning of my raster refers to, or how to fix this problem I am having.

I have looked for fixes in

However, I still have not found a solution that fixes my problem.

One Answer

UPDATE: I found a solution. I set the directory to my raster location:

cd M:UsersuserIDDocumentsRKoala_Projkoala_datakoala_information_basehabitat_suitability

What I ended up doing wrong was I set the -p as the password, not the port. Once I changed this, the import worked successfully:

M:PostgreSQL10binraster2pgsql -s 4283 -I -C -t 100x100 koala_raster.tif | psql -h localhost -d krprivate19 -p 5432 -U postgres 

Answered by CarlaBirdy on April 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP