<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7601.17537"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial>Andreas,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial>How much memory do you have on your 64-bit desktop? I
wonder if it would have made a difference using 32-bit
python.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial>I think the way 64-bit works, its actually worse if you don't
have as much memory because the address space of each is larger. Then
again I might not know what I am talking about, but that is what I've
heard. So I generally try to avoid 64-bit unless I have more than 4GB ram
since there doesn't seem to be much point in it and there are so many stupid
drivers I have that I'm forced to use that don't work on
64-bit.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial>Since we don't have a 64-bit build of PostGIS yet for windows,
there is even less of a reason if you are running Windows for
PostGIS.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial>As a side note: Be careful when running PostGIS 2.0 raster
bits in PostGIS 1.5. If you are just using the loader, you might need to
rebuild the index (I think the default when nodata value is not present might
have changed to from 0 to NULL and PostGIS 1.5 raster can't handle that). I
don't think the load structure has changed aside from those, but Jorge and
Pierre can confirm.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial>I'm not quite sure at which point the index operator changed
from using ST_Envelop to ST_ConvexHull whether it was before or after
PostGIS 2.0 merge, but you may find the indexes built with the loader
ineffective, if you are running a version before.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial>Good way to confirm is do an explain of your query and
verify its still using the spatial index.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial>Hope that helps,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial>Regina</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011><FONT color=#0000ff
size=2 face=Arial><A
href="http://www.postgis.us">http://www.postgis.us</A></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=865184511-03032011> </SPAN></DIV><BR>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>Andreas Forĝ Tollefsen<BR><B>Sent:</B> Thursday, March 03, 2011 4:26
AM<BR><B>To:</B> Jorge Arévalo<BR><B>Cc:</B> PostGIS Users
Discussion<BR><B>Subject:</B> Re: [postgis-users] Raster2pgsql.py Possible No
Data Problem<BR></FONT><BR></DIV>
<DIV></DIV>Very strange. The out of memory error i posted in my last post i got
on my 64 bit desktop. I tried the excact same thing on my 32 bit laptop, and
there i did not get a out of memory when importing to the postgis1.5 database.
<DIV><BR></DIV>
<DIV>Andreas<BR><BR>
<DIV class=gmail_quote>2011/3/3 Andreas Forĝ Tollefsen <SPAN dir=ltr><<A
href="mailto:andreasft@gmail.com">andreasft@gmail.com</A>></SPAN><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>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/"
target=_blank>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"
target=_blank>andreasft@gmail.com</A>></SPAN>
<DIV>
<DIV></DIV>
<DIV class=h5><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>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>
<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><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote>
<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></DIV></DIV><BR></DIV></BLOCKQUOTE></DIV><BR></DIV></BODY></HTML>