[postgis-users] Error in raster import with WKTRaster

Jorge Arévalo jorge.arevalo at deimos-space.com
Fri Feb 11 06:02:39 PST 2011


Hi Mathieu

2011/2/11 Mathieu Basille <basille at ase-research.org>:
> Hi Jorge,
>
> Thx for the answer! Seems I did a nice mess with the install, because I did
> install it with the --with-raster configure option! I'll try to fix it as
> soon as possible (I'm not on the same computer right now, so that it'll have
> to wait a bit). Do you think it would be safer to reinstall everything, in
> order to have a fresh install?
>

I think you should recompile PostGIS with PostGIS Raster again (first
svn update) and then create a new and clean database and follow the
instructions to postgis-raster-enable it

./configure --with-raster
make
make install
createdb <your_database>
createlang plpgsql <your_database>
psql -f postgis/postgis.sql -d <your_database>
psql -f spatial_ref_sys.sql -d <your_database>
psql -f raster/rt_pg/rtpostgis.sql -d <your_database>

> I will also check the NAs of the map (that's weird, too: there are no NAs on
> this map, but I guess they are internally set anyway). What puzzled me is
> that it worked for other maps with the same procedure...
>
> I'll let you know, thx again!
> Mathieu.
>

Check the NODATA with gdalinfo, just in case.

Best regards,

-- 
Jorge Arévalo
Internet & Mobilty Division, DEIMOS
jorge.arevalo at deimos-space.com
http://es.linkedin.com/in/jorgearevalo80
http://mobility.grupodeimos.com/
http://gis4free.wordpress.com
http://geohash.org/ezjqgrgzz0g



>
> Le 11/02/2011 05:15, Jorge Arévalo a écrit :
>>
>> Hi Mathieu,
>>
>> On Fri, Feb 11, 2011 at 1:20 AM, Mathieu Basille
>> <basille at ase-research.org>  wrote:
>>>
>>> Dear users,
>>>
>>> I have a problem while trying to import a raster into PostGIS
>>> (2.0.0SVN), using WKTRaster (0.1.6d), on a Debian system.
>>>
>>> This is a raster exported from GRASS as GeoTiff, using a float32 format
>>> (this is a density map). I then used:
>>>
>>> mathieu at Caribou$ /usr/lib/postgresql/8.4/bin/gdal2raster.py -r
>>> RoadDensity_2002_2006_CV_UTM19_25m.tif -t
>>> roaddensity_2002_2006_cv_utm19_25m -s 26919 -k 50x50 -I>
>>> RoadDensity_2002_2006_CV_UTM19_25m.sql
>>>
>>> and finally to import into PostGIS, as the postgres user:
>>> postgres at Caribou:/home/mathieu$ psql -f
>>> RoadDensity_2002_2006_CV_UTM19_25m.sql geodb
>>> BEGIN
>>> psql:RoadDensity_2002_2006_CV_UTM19_25m.sql:2: NOTICE:  CREATE TABLE
>>> créera des séquences implicites «
>>> roaddensity_2002_2006_cv_utm19_25m_rid_seq » pour la colonne serial «
>>> roaddensity_2002_2006_cv_utm19_25m.rid »
>>> psql:RoadDensity_2002_2006_CV_UTM19_25m.sql:2: NOTICE:  CREATE TABLE /
>>> PRIMARY KEY créera un index implicite «
>>> roaddensity_2002_2006_cv_utm19_25m_pkey » pour la table «
>>> roaddensity_2002_2006_cv_utm19_25m »
>>> CREATE TABLE
>>> psql:RoadDensity_2002_2006_CV_UTM19_25m.sql:3: ERREUR:  la colonne « nan
>>> » n'existe pas
>>> LIGNE 1 : ...','rast',26919, ARRAY['32BF'], false, true, ARRAY[nan],
>>> 25.0...
>>>                                                               ^
>>> psql:RoadDensity_2002_2006_CV_UTM19_25m.sql:4: ERREUR:  la transaction
>>> est annulée, les commandes sont ignorées jusqu'à la fin du bloc
>>> de la transaction
>>> psql:RoadDensity_2002_2006_CV_UTM19_25m.sql:5: ERREUR:  la transaction
>>> est annulée, les commandes sont ignorées jusqu'à la fin du bloc
>>> de la transaction
>>> psql:RoadDensity_2002_2006_CV_UTM19_25m.sql:6: ERREUR:  la transaction
>>> est annulée, les commandes sont ignorées jusqu'à la fin du bloc
>>> de la transaction
>>> ...
>>>
>>> And it continues for every line (or until I stop it). In the end, the
>>> table is not imported at all. (sorry if parts of the ouputs are in
>>> French: the first error message is simply: "the column "nan" does not
>>> exist", and the next ones says "the transaction is cancelled, all
>>> commands will be ignored until the end of the bloc of the transaction")
>>>
>>> Note that this is the exact same approach that I am generally using,
>>> without any problem for other maps (including density maps as float32).
>>>
>>> I am new to PostGIS and the SQL world, so it might be an easy one...
>>> Yet, I still have no idea what's wrong here. I welcome any pointer!
>>>
>>> All the best,
>>> Mathieu.
>>>
>>>
>>> --
>>>
>>> ~$ whoami
>>> Mathieu Basille, Post-Doc
>>>
>>> ~$ locate
>>> Laboratoire d'Écologie Comportementale et de Conservation de la Faune
>>> + Centre d'Étude de la Forêt
>>> Département de Biologie
>>> Université Laval, Québec
>>>
>>> ~$ info
>>> http://ase-research.org/basille
>>>
>>> ~$ fortune
>>> ``If you can't win by reason, go for volume.''
>>> Calvin, by Bill Watterson.
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>
>> The error is caused because the NODATA value for the band is not a
>> number. Probably, the GetNodata function for this band returns NULL,
>> and this situation is not managed in the loader code. Let me check it
>> and open a new ticket if needed.
>>
>> Anyway, you're using PostGIS 2.0SVN. With this version you don't need
>> WKTRaster 0.1.6d separately. Actually, WKTRaster 0.1.6d is not longer
>> mantained, and it probably will cause errors (like this) if you use it
>> with PostGIS from trunk.
>>
>> The raster extension (now "PostGIS Raster" instead of WKTRaster) is
>> included as official part of PostGIS. You can enable it by compiling
>> PostGIS in this way:
>>
>> ./configure --with-raster
>> make
>> make install
>> createdb<your_database>
>> createlang plpgsql<your_database>
>> psql -f postgis/postgis.sql -d<your_database>
>> psql -f spatial_ref_sys.sql -d<your_database>
>> psql -f raster/rt_pg/rtpostgis.sql -d<your_database>
>>
>> Now, you can load raster data in<your_database>  with the new version
>> of the loader script: raster2pgsql.py (in
>> <postgis_src_root>/raster/scripts/python). Same syntax than the older
>> gdal2wktraster.py script.
>>
>> Further information at
>> http://gis4free.wordpress.com/2010/10/01/wkt-raster-is-now-postgis-raster/
>>
>> Best regards,
>>
>
> --
>
> ~$ whoami
> Mathieu Basille, Post-Doc
>
> ~$ locate
> Laboratoire d'Écologie Comportementale et de Conservation de la Faune
> + Centre d'Étude de la Forêt
> Département de Biologie
> Université Laval, Québec
>
> ~$ info
> http://ase-research.org/basille
>
> ~$ fortune
> ``If you can't win by reason, go for volume.''
> Calvin, by Bill Watterson.
>



More information about the postgis-users mailing list