[postgis-users] Adding raster to PostGIS database

José Pedro Santos zpsantos1 at hotmail.com
Tue Nov 27 00:13:49 PST 2012


Hi, 

Try to see if you have Postgis correct installed. In the PGSQL console type: SELECT * FROM Postgis_lib_version(); 

If not is correct install try to do this in the terminal as postgresql SU: 

1 - Find /usr -name 'rtpostgis.sql' (copy the path of this file)

2 - pgsql -d yourDBname -f thepreviouspath

3 - Try again to import the file 

Best Regards
José Santos
From: smaran.harihar at gmail.com
Date: Mon, 26 Nov 2012 21:40:25 -0700
To: postgis-users at lists.osgeo.org
Subject: Re: [postgis-users] Adding raster to PostGIS database

Oh it seems the error was due to ownership being in the name of another user.
Now I am able to get the gdalinfo,
Driver: GTiff/GeoTIFFFiles: Quercus_acutifolia_raw.tif

Size is 3864, 1583Coordinate System is:GEOGCS["WGS 84",    DATUM["unknown",        SPHEROID["WGS84",6378137,298.257223563]],    PRIMEM["Greenwich",0],

    UNIT["degree",0.0174532925199433]]Origin = (-179.960724061474451,86.577964063072983)Pixel Size = (0.093000000000000,-0.090400000000000)Metadata:  AREA_OR_POINT=Area

Image Structure Metadata:  COMPRESSION=LZW  INTERLEAVE=BANDCorner Coordinates:Upper Left  (-179.9607241,  86.5779641) (179d57'38.61"W, 86d34'40.67"N)

Lower Left  (-179.9607241, -56.5252359) (179d57'38.61"W, 56d31'30.85"S)Upper Right ( 179.3912759,  86.5779641) (179d23'28.59"E, 86d34'40.67"N)Lower Right ( 179.3912759, -56.5252359) (179d23'28.59"E, 56d31'30.85"S)

Center      (  -0.2847241,  15.0263641) (  0d17' 5.01"W, 15d 1'34.91"N)Band 1 Block=3864x1 Type=Float32, ColorInterp=Gray  Min=0.000 Max=0.923   Minimum=0.000, Maximum=0.923, Mean=0.000, StdDev=0.000

  NoData Value=-3.39999999999999996e+38  Metadata:    STATISTICS_MAXIMUM=0.92262234256096    STATISTICS_MEAN=0    STATISTICS_MINIMUM=5.6834812171638e-19    STATISTICS_STDDEV=0


But when I execute,
raster2pgsql -c -s 4326 -I Quercus_acutifolia_raw.tif public.Quercus_acutifolia_raw | psql -h localhost -d dbname -U usr
I am still not able to create a Table? This is the output,


Processing 1/1: Quercus_acutifolia_raw.tifPassword for user postgres: BEGINNOTICE:  CREATE TABLE will create implicit sequence "quercus_acutifolia_raw_rid_seq" for serial column "quercus_acutifolia_raw.rid"

ERROR:  type "raster" does not existLINE 1: ...us_acutifolia_raw" ("rid" serial PRIMARY KEY,"rast" raster);                                                               ^

ERROR:  current transaction is aborted, commands ignored until end of transaction blockERROR:  current transaction is aborted, commands ignored until end of transaction blockERROR:  current transaction is aborted, commands ignored until end of transaction block

ROLLBACK
Thanks,Smaran
On Mon, Nov 26, 2012 at 3:07 PM, Bborie Park <bkpark at ucdavis.edu> wrote:


Run the following...



gdalinfo Quercus_acutifolia_raw.tif



If that returns an error, something may be wrong with the tif file.



-bborie



On 11/26/2012 02:03 PM, Smaran Harihar wrote:

> But I am executing the command in the directory where it is located

>

> I can list that raster using `ls`

>

> On Mon, Nov 26, 2012 at 2:46 PM, Bborie Park <bkpark at ucdavis.edu> wrote:

>

>> That error would only happen if raster2pgsql can't find the file in your

>> current working directory. raster2pgsql supports relative paths for

>> input rasters.

>>

>> -bborie

>>

>> On 11/26/2012 01:37 PM, Smaran Harihar wrote:

>>> Thanks for the reply bborie,

>>>

>>> I ran this command,

>>>

>>> raster2pgsql -c -s 4326 -I Quercus_acutifolia_raw.tif

>>> public.Quercus_acutifolia_raw | psql -h localhost -d rasterdb -U postgres

>>>

>>> But this is the new error,

>>>

>>> ERROR: Unable to read raster file: Quercus_acutifolia_raw.tif

>>>

>>> Thanks,

>>> Smaran

>>>

>>> On Mon, Nov 26, 2012 at 2:27 PM, Bborie Park <bkpark at ucdavis.edu> wrote:

>>>

>>>> -D is not a valid flag recognized by raster2pgsql.  Remove the flag as

>>>> raster2pgsql is assuming that -D is a file.

>>>>

>>>> -bborie

>>>>

>>>> On 11/26/2012 01:23 PM, Smaran Harihar wrote:

>>>>> Hi Guys,

>>>>>

>>>>> I am trying to add a raster to PostGIS database using,

>>>>>

>>>>> raster2pgsql -c -D -s 4326 -I Quercus_acutifolia_raw.tif

>>>>> public.Quercus_acutifolia_raw | psql -h localhost -d dbnm -U usr

>>>>>

>>>>> But I am getting this error,

>>>>>

>>>>> ERROR: Unable to read raster file: -D

>>>>>

>>>>> Any idea what is wrong? The database already has numerous point and

>>>> polygon

>>>>> shapefiles. Is that a problem that I cannot add rasters to the same

>>>>> database having shapefiles?

>>>>>

>>>>>

>>>>>

>>>>> _______________________________________________

>>>>> postgis-users mailing list

>>>>> postgis-users at lists.osgeo.org

>>>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

>>>>>

>>>>

>>>> --

>>>> Bborie Park

>>>> Programmer

>>>> Center for Vectorborne Diseases

>>>> UC Davis

>>>> 530-752-8380

>>>> bkpark at ucdavis.edu

>>>> _______________________________________________

>>>> postgis-users mailing list

>>>> postgis-users at lists.osgeo.org

>>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

>>>>

>>>

>>>

>>>

>>>

>>>

>>> _______________________________________________

>>> postgis-users mailing list

>>> postgis-users at lists.osgeo.org

>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

>>>

>>

>> --

>> Bborie Park

>> Programmer

>> Center for Vectorborne Diseases

>> UC Davis

>> 530-752-8380

>> bkpark at ucdavis.edu

>> _______________________________________________

>> postgis-users mailing list

>> postgis-users at lists.osgeo.org

>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

>>

>

>

>

>

>

> _______________________________________________

> postgis-users mailing list

> postgis-users at lists.osgeo.org

> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

>



--

Bborie Park

Programmer

Center for Vectorborne Diseases

UC Davis

530-752-8380

bkpark at ucdavis.edu

_______________________________________________

postgis-users mailing list

postgis-users at lists.osgeo.org

http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users



-- 
Thanks & RegardsSmaran Harihar



_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121127/f4d390e0/attachment.html>


More information about the postgis-users mailing list