It seems I had some problems with my gdal python bindings. I downloaded the 64 bit Python 2.6 GDAL 1.7 bindings from here <a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/">http://www.lfd.uci.edu/~gohlke/pythonlibs/</a>.<div>
Now i can create the sql file. However. I have some new problems when importing.</div><div>It works when i try to write the sql file to my PostGIS 2.0 database, but not to my PostGIS 1.5 database.</div><div>See errors below (first is 1.5, second is 2.0 and working):</div>
<div><br></div><div><div>C:\prio_grid\source\mountain>psql -h localhost -U postgres -d newpg -f mountain.</div><div>sql</div><div>BEGIN</div><div>psql:mountain.sql:2: NOTICE:  CREATE TABLE will create implicit sequence "mounta</div>
<div>in_rid_seq" for serial column "mountain.rid"</div><div>psql:mountain.sql:2: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit in</div><div>dex "mountain_pkey" for table "mountain"</div>
<div>CREATE TABLE</div><div><br></div><div>                       addrastercolumn</div><div><br></div><div>--------------------------------------------------------------------------------</div><div>--------------------------------------------------------------------------------</div>
<div>--------------------------------------------------------------</div><div> public.mountain.rast srid:4326 pixel_types:{32BF} out_db:false regular_blocking</div><div>:false nodata_values:'{-3.40282346639e+038}' pixelsize_x:'0.08333334' pixelsize_</div>
<div>y:'-0.08333334' blocksize_x:NULL blocksize_y:NULL extent:NULL</div><div>(1 row)</div><div><br></div><div><br></div><div>psql:mountain.sql:4: ERROR:  out of memory</div><div>DETAIL:  Failed on request of size 134217728.</div>
<div>psql:mountain.sql:5: ERROR:  current transaction is aborted, commands ignored un</div><div>til end of transaction block</div><div>ROLLBACK</div><div><br></div><div>C:\prio_grid\source\mountain>psql -h localhost -U postgres -d template_postgis20</div>
<div> -f mountain.sql</div><div>BEGIN</div><div>psql:mountain.sql:2: NOTICE:  CREATE TABLE will create implicit sequence "mounta</div><div>in_rid_seq" for serial column "mountain.rid"</div><div>psql:mountain.sql:2: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit in</div>
<div>dex "mountain_pkey" for table "mountain"</div><div>CREATE TABLE</div><div><br></div><div>                   addrastercolumn</div><div><br></div><div>--------------------------------------------------------------------------------</div>
<div>--------------------------------------------------------------------------------</div><div>------------------------------------------------------</div><div> public.mountain.rast srid:4326 pixel_types:{32BF} out_db:false regular_blocking</div>
<div>:false nodata_values:'{-3.40282346639e+038}' scale_x:'0.08333334' scale_y:'-0.08</div><div>333334' blocksize_x:NULL blocksize_y:NULL extent:NULL</div><div>(1 row)</div><div><br></div><div><br>
</div><div>INSERT 0 1</div><div>CREATE INDEX</div><div>COMMIT</div><div><br></div><div>C:\prio_grid\source\mountain></div><br><div class="gmail_quote">2011/3/2 Andreas Forø Tollefsen <span dir="ltr"><<a href="mailto:andreasft@gmail.com">andreasft@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi. Sorry. I was confused and used the Python 2.5.<div><br>Now i get some other errors when using python 2.6. Could it be my setup which is not correct?</div>
<div><br></div><div><div>C:\Python26>python raster2pgsql.py -r c:\prio_grid\source\mountain\mean_mnt_bin.</div>
<div>tif -t mountain -s 4326 -I -o mountain.sql</div><div class="im"><div>Traceback (most recent call last):</div><div>  File "raster2pgsql.py", line 1036, in <module></div><div>    main()</div><div>  File "raster2pgsql.py", line 999, in main</div>

<div>    gt = wkblify_raster(opts, filename.replace( '\\', '/') , i, gt)</div><div>  File "raster2pgsql.py", line 941, in wkblify_raster</div><div>    summary = wkblify_raster_level(options, ds, options.overview_level, band_ran</div>

<div>ge, infile, i)</div></div><div>  File "raster2pgsql.py", line 901, in wkblify_raster_level</div><div>    hexwkb += wkblify_band(options, band, level, xoff, yoff, read_block_size, bl</div><div>ock_size, infile, b)</div>

<div>  File "raster2pgsql.py", line 790, in wkblify_band</div><div>    target_block_size[0], target_block_size[1])</div><div>  File "C:\Python26\Lib\site-packages\osgeo\gdal.py", line 978, in ReadAsArray</div>

<div>    import gdalnumeric</div><div>  File "C:\Python26\Lib\site-packages\osgeo\gdalnumeric.py", line 1, in <module></div><div><br></div><div>    from gdal_array import *</div><div>  File "C:\Python26\Lib\site-packages\osgeo\gdal_array.py", line 24, in <module></div>

<div><br></div><div>    _gdal_array = swig_import_helper()</div><div>  File "C:\Python26\Lib\site-packages\osgeo\gdal_array.py", line 23, in swig_imp</div><div>ort_helper</div><div>    return _mod</div><div>UnboundLocalError: local variable '_mod' referenced before assignment</div>

<div><br></div><div>C:\Python26></div><br><div class="gmail_quote">2011/3/2 Jorge Arévalo <span dir="ltr"><<a href="mailto:jorge.arevalo@deimos-space.com" target="_blank">jorge.arevalo@deimos-space.com</a>></span><div>
<div></div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div></div><div>On Wed, Mar 2, 2011 at 5:40 PM, Andreas Forø Tollefsen<br>
<<a href="mailto:andreasft@gmail.com" target="_blank">andreasft@gmail.com</a>> wrote:<br>
> Hi,<br>
> Postgresql 8.4.7<br>
> postgis-pg84-binaries-2.0.0svn.zip<br>
> Tested with latest raster2pgsql.py rev 6860<br>
> I have a raster which is giving me problems when creating the raster table.<br>
> The raster does not have any digits for no data but 'no data'.<br>
> Could this be the cause of the below problem? I tried a different raster<br>
> which normally have been working with the old gdal2wktraster.py script.<br>
> Any suggestions?<br>
> The error:<br>
> C:\Python25>python raster2pgsql.py -r<br>
> c:\prio_grid\source\mountain\mean_mnt_bin.<br>
> tif -t mountain -o mountain.sql<br>
> Traceback (most recent call last):<br>
>   File "raster2pgsql.py", line 1036, in <module><br>
>     main()<br>
>   File "raster2pgsql.py", line 999, in main<br>
>     gt = wkblify_raster(opts, filename.replace( '\\', '/') , i, gt)<br>
>   File "raster2pgsql.py", line 941, in wkblify_raster<br>
>     summary = wkblify_raster_level(options, ds, options.overview_level,<br>
> band_ran<br>
> ge, infile, i)<br>
>   File "raster2pgsql.py", line 853, in wkblify_raster_level<br>
>     nodata_values = collect_nodata_values(ds, band_from, band_to)<br>
>   File "raster2pgsql.py", line 532, in collect_nodata_values<br>
>     if nodata is not None and not math.isnan(nodata):<br>
> AttributeError: 'module' object has no attribute 'isnan'<br>
> C:\Python25><br>
><br>
</div></div>> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
><br>
><br>
<br>
Hi,<br>
<br>
The problem is with the 'isnan' function. I see it was included in<br>
Python 2.6. We need a replacement in case of lower Python versions.<br>
I'll fix it asap (hopefully, when I arrive home).<br>
<br>
Best regards, and thanks for the feedback<br>
<font color="#888888"><br>
--<br>
Jorge Arévalo<br>
Internet & Mobilty Division, DEIMOS<br>
<a href="mailto:jorge.arevalo@deimos-space.com" target="_blank">jorge.arevalo@deimos-space.com</a><br>
<a href="http://es.linkedin.com/in/jorgearevalo80" target="_blank">http://es.linkedin.com/in/jorgearevalo80</a><br>
<a href="http://mobility.grupodeimos.com/" target="_blank">http://mobility.grupodeimos.com/</a><br>
<a href="http://gis4free.wordpress.com" target="_blank">http://gis4free.wordpress.com</a><br>
<a href="http://geohash.org/ezjqgrgzz0g" target="_blank">http://geohash.org/ezjqgrgzz0g</a><br>
</font></blockquote></div></div></div><br></div>
</blockquote></div><br></div>