hachinamio (5) [Avatar] Offline
#1
I do everything following the instruction of chapter 13, but i cant still import raster image to postgreSQL. somebody helps me! how to import raster image to postgreSQL. thanks.
regina.leo (265) [Avatar] Offline
#2
Re: Chapter 13 - raster
hachinamio,

What file are you trying to load and what error do you get? It's possible you are using an old binary or you don't have raster installed.

Also you can get more help on the PostGIS newsgroup if you subscribe.

http://www.postgis.org/mailman/listinfo/postgis-users

the PostGIS development team monitors that group as well as many other people using PostGIS raster.

Thanks,
Regina
hachinamio (5) [Avatar] Offline
#3
Re: Chapter 13 - raster
I wanna impost tif file. I have installed raster postgis to postgreSQL, but i still dont know how to import tif file into postgreSQL.
Thank you in advance.
regina.leo (265) [Avatar] Offline
#4
Re: Chapter 13 - raster
Which OS are you on and which version of PostGIS are you running.

Also do you have raster support installed. You should see raster_columns table if you have raster installed.

You need python 2.5-2.7 with numpy and gdal support to load rasters
then you use the raster2pgsql.py script packaged with PostGIS.

This might help:

http://www.postgis.org/documentation/manual-svn/RT_reference.html#RT_Loading_Rasters
hachinamio (5) [Avatar] Offline
#5
Re: Chapter 13 - raster
I have raster support installed, and i can see the raster_columns table in postgreSQL
I also installed python 2.7 with numpy and GDAL.

now i try to import the raster image to the postgresql, type of image: tif ~ 50 Mb.
In the command line, i typed:
python raster2pgsql.py -r myimage.tif -t myrt -o myrt.sql
and i got the file myrt.sql in the python directory.

then,in postgreSQL, i create an database named myraster with postgis-template, ofcourse included raster support.
i try to check if myraster database supports postgis-raster. and I see 4 tables in public scheme: geometry_columns, raster_columns, raster_overviews, spatial_ref_sys.
that means myraster database already supports postgis-raster.

now I open the SQL editor and use the file myrt.sql that i got earlier, when i executed that sql code, the program becomes not response. so i have to end process pgAdmin in task manager. I tried and it happened again.

Can u show me how to fix this problem.
when i tried to do the same but with the jpg image ~ 1 mb, the sql code was executed successfully.

thank you so much.

Message was edited by:
hachinamio
regina.leo (265) [Avatar] Offline
#6
Re: Chapter 13 - raster
BY SQL editor you mean psql or pgAdmin.

For larger sql files like the ones produced by bigger rasters, you need to use psql to load them.
hachinamio (5) [Avatar] Offline
#7
Re: Chapter 13 - raster
i used SQL editor in pgadmin III, then i opened the sql file and executed that sql code, the program became "not response".
so you mean that if i want to import the larger files like tif files , i have to use psql command line to load it?
regina.leo (265) [Avatar] Offline
#8
Re: Chapter 13 - raster
Correct. PgAdmin wasn't designed for loading large files or binary files for that matter.
hachinamio (5) [Avatar] Offline
#9
Re: Chapter 13 - raster
ok.. what the kind of you. thanks.
Regie.A (4) [Avatar] Offline
#10
Re: Chapter 13 - raster
Where exactly should I find the raster_columns table? I've been trying to install raster support but no luck yet.
regina.leo (265) [Avatar] Offline
#11
Re: Chapter 13 - raster
Regie,

Which version of PostGIS are you using. PostGIS 2.0 (still not released yet), has changed quite a bit since we completed the book.

big changes since we wrote the book
1) raster_columns is now a view, not a table.
http://www.postgis.org/documentation/manual-svn/using_raster.xml.html#RT_Raster_Columns

2) There is no longer a raster2pgsql.py script. This has been replaced with an executable that doesn't require Python.
http://www.postgis.org/documentation/manual-svn/using_raster.xml.html#RT_Raster_Loader

3) The AddRasterColumns etc have been replaced with Add/DropRasterConstraints

http://www.postgis.org/documentation/manual-svn/RT_AddRasterConstraints.html
http://www.postgis.org/documentation/manual-svn/RT_DropRasterConstraints.html

The latest windows experimental builds have these changes. For other platforms you need to compile your own at least until PostGIS 2.0 is officially released.

Hope that helps,
Regina
Regie.A (4) [Avatar] Offline
#12
Re: Chapter 13 - raster
Thanks Regina.

I was able to load the pele.png image (p. 380) and visualized in QGIS 1.7. However, I am having trouble loading in a georeferenced .tif file.

The raster options (and order) in the book are different from http://www.postgis.org/documentation/manual-svn/using_raster.xml.html#RT_Raster_Loader. For example, there is no -k option.

I've searched the internet and most (if not all) of the examples are the same as the book.

Thanks,
Regie
regina.leo (265) [Avatar] Offline
#13
Re: Chapter 13 - raster
Regie,

The switches are quite different in the raster2pgsql since they tried to follow the shp2pgsq switches as much as possible and -k is already used for something else in shp2pgsql.

The equivalent of the old -k is -t. If you look at one of the examples in the reference. You'll see an example like this:

raster2pgsql -s 4236 -I -C -M *.tif -F -t 100x100 public.demelevation > elev.sql


Which chunks the directory of rasters to 100x100 tile size