Just double checked that my raster pixel values are indeed stored as decimal values.<div>select ST_Value(rast,560,100) FROM gpw95;</div><div>returns:</div><div>11678.7138671875</div><div><br><br><div class="gmail_quote">2011/3/16 Jorge Arévalo <span dir="ltr"><<a href="mailto:jorge.arevalo@deimos-space.com">jorge.arevalo@deimos-space.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Wed, Mar 16, 2011 at 2:53 PM, Pierre Racine<br>
<<a href="mailto:Pierre.Racine@sbf.ulaval.ca">Pierre.Racine@sbf.ulaval.ca</a>> wrote:<br>
> Yes, this is ticket 837<br>
><br>
> <a href="http://trac.osgeo.org/postgis/ticket/837" target="_blank">http://trac.osgeo.org/postgis/ticket/837</a><br>
><br>
> Jorge, are those numerous warning normal?<br>
<br>
</div>The warnings are normal if debug option is enabled. But what strikes<br>
me is printf shows real and truncated value as same value. I think<br>
this is caused because both values are compared in this way:<br>
<br>
if (doubleValue1 != doubleValue2) printf(....)<br>
<br>
instead of<br>
<br>
if (fabs(doubleValue1 - doubleValue2) > FLT_EPSILON) printf(....)<br>
<br>
So, this warning message is probably generated in setBits function.<br>
Anyway, I don't think that's the reason of the memory error.<br>
<font color="#888888"><br>
--<br>
</font><div class="im">Jorge Arévalo<br>
Internet & Mobilty Division, DEIMOS<br>
<a href="mailto:jorge.arevalo@deimos-space.com">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>
<br>
<br>
</div><div><div></div><div class="h5">> ________________________________________<br>
> From: <a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a> [<a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a>] On Behalf Of Andreas Forø Tollefsen [<a href="mailto:andreasft@gmail.com">andreasft@gmail.com</a>]<br>

> Sent: Wednesday, March 16, 2011 9:24 AM<br>
> To: PostGIS Users Discussion<br>
> Subject: Re: [postgis-users] PostGIS Raster Decimal?<br>
><br>
> Is the above memory issue known for the ST_MapAlgebra function?<br>
> Did you experience this Regina?<br>
><br>
> I will try with some other rasters.<br>
> The WARNING lines are just a sample. I think it went through a couple of thousands before it ran out of memory.<br>
> Is it not strange that the truncated values are the same as the original values?<br>
><br>
> Andreas<br>
><br>
> 2011/3/15 Andreas Forø Tollefsen <<a href="mailto:andreasft@gmail.com">andreasft@gmail.com</a><mailto:<a href="mailto:andreasft@gmail.com">andreasft@gmail.com</a>>><br>
> Hi Pierre,<br>
> I got memory issues as well.<br>
> I tried with this query:<br>
> SELECT ST_MapAlgebra(rast, 'rast*10') INTO algtest FROM gpw90;<br>
><br>
><br>
> WARNING:  Pixel value for 32BF band got truncated from 47519.1 to 47519.1<br>
> WARNING:  Pixel value for 32BF band got truncated from 185494 to 185494<br>
> WARNING:  Pixel value for 32BF band got truncated from 28485.1 to 28485.1<br>
> WARNING:  Pixel value for 32BF band got truncated from 10927.1 to 10927.1<br>
><br>
><br>
> ERROR:  out of memory<br>
> DETAIL:  Failed on request of size 19.<br>
><br>
> ********** Error **********<br>
><br>
> ERROR: out of memory<br>
> SQL state: 53200<br>
> Detail: Failed on request of size 19.<br>
><br>
> 2011/3/14 Paragon Corporation <<a href="mailto:lr@pcorp.us">lr@pcorp.us</a><mailto:<a href="mailto:lr@pcorp.us">lr@pcorp.us</a>>><br>
> Pierre,<br>
><br>
> Actually the single raster version is documented.  Though I did run into memory issues -- so still think we need some work on that.<br>
><br>
> <a href="http://www.postgis.org/documentation/manual-svn/RT_ST_MapAlgebra.html" target="_blank">http://www.postgis.org/documentation/manual-svn/RT_ST_MapAlgebra.html</a><br>
><br>
> Regina<br>
> <a href="http://www.postgis.us" target="_blank">http://www.postgis.us</a><br>
><br>
><br>
><br>
> ________________________________<br>
> From: <a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a><mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a>> [mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a><mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a>>] On Behalf Of Andreas Forø Tollefsen<br>

> Sent: Monday, March 14, 2011 2:03 PM<br>
> To: PostGIS Users Discussion<br>
> Cc: Pierre Racine<br>
><br>
> Subject: Re: [postgis-users] PostGIS Raster Decimal?<br>
><br>
> Hi Pierre,<br>
><br>
> I will check it out tomorrow and give some feedback.<br>
><br>
> Cheers,<br>
> Andreas<br>
><br>
> 2011/3/14 Pierre Racine <<a href="mailto:Pierre.Racine@sbf.ulaval.ca">Pierre.Racine@sbf.ulaval.ca</a><mailto:<a href="mailto:Pierre.Racine@sbf.ulaval.ca">Pierre.Racine@sbf.ulaval.ca</a>>><br>
> I’m very aware of the problem. Will try to fix it the best we can.<br>
><br>
> Why not testing ST_MapAlgebra and give us your feedback? It is still to document but the specifications are in this page:<br>
><br>
> <a href="http://trac.osgeo.org/postgis/wiki/WKTRaster/SpecificationWorking02" target="_blank">http://trac.osgeo.org/postgis/wiki/WKTRaster/SpecificationWorking02</a><br>
><br>
> Pierre<br>
><br>
> From: <a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a><mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a>> [mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a><mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a>>] On Behalf Of Andreas Forø Tollefsen<br>

> Sent: 14 mars 2011 11:24<br>
> To: PostGIS Users Discussion<br>
> Subject: Re: [postgis-users] PostGIS Raster Decimal?<br>
><br>
> Hi Pierre.<br>
><br>
> Yes. I think that would be an appropriate temporary fix.<br>
> Still, a bit problematic when working with climate data which very often include decimal digits and often have weekly and monthly rasters for 100's of years :)<br>
><br>
> Good luck.<br>
><br>
> Best,<br>
> Andreas<br>
><br>
> 2011/3/14 Pierre Racine <<a href="mailto:Pierre.Racine@sbf.ulaval.ca">Pierre.Racine@sbf.ulaval.ca</a><mailto:<a href="mailto:Pierre.Racine@sbf.ulaval.ca">Pierre.Racine@sbf.ulaval.ca</a>>><br>
> Andreas,<br>
><br>
> This is a well known problem. See ticket <a href="http://trac.osgeo.org/postgis/ticket/650" target="_blank">http://trac.osgeo.org/postgis/ticket/650</a><br>
><br>
> I will discuss this problem with Frank this week at the code sprint in Montreal.<br>
><br>
> For now you can use some GIS with map algebra capability to multiply your raster by 10 before importing or test our brand new ST_MapAlgebra function (still to debug).<br>
><br>
> Pierre<br>
><br>
>>-----Original Message-----<br>
>>From: Pierre Racine<br>
>>Sent: 14 mars 2011 10:55<br>
>>To: Pierre Racine<br>
>>Subject: FW: [postgis-users] PostGIS Raster Decimal?<br>
>><br>
>><br>
>><br>
>>From: <a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a><mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a>> [mailto:<a href="mailto:postgis-users-">postgis-users-</a><mailto:<a href="mailto:postgis-users-">postgis-users-</a>><br>

>><a href="mailto:bounces@postgis.refractions.net">bounces@postgis.refractions.net</a><mailto:<a href="mailto:bounces@postgis.refractions.net">bounces@postgis.refractions.net</a>>] On Behalf Of Andreas Forø Tollefsen<br>

>>Sent: 14 mars 2011 10:53<br>
>>To: PostGIS Users Discussion<br>
>>Subject: [postgis-users] PostGIS Raster Decimal?<br>
>><br>
>>Hi. Again.<br>
>><br>
>>I have been working on some raster data in PostGIS lately.<br>
>>However, i have some issues with the raster values become integer after importing the sql to postgis.<br>
>>For instance this procedure:<br>
>><br>
>>C:\prio_grid\source\gpw>c:\python26\python c:\prio_grid\script\raster2pgsql.py -<br>
>>r c:\prio_grid\source\gpw\lrc30p90\glp90ag30\w001001.adf -t gpw90 -s 4326 -o gpw<br>
>>90.sql -I -M<br>
>><br>
>>Then to database:<br>
>>C:\prio_grid\source\gpw>psql -h 192.168.1.55 -d priogrid -f gpw90.sql<br>
>><br>
>>Querying this data:<br>
>>SELECT gpw90.gid, ((gpw90.gpw90val).val) AS gpw90<br>
>>INTO popgrid<br>
>>FROM (SELECT priogrid_land.gid, ST_Intersection(gpw90.rast, priogrid_land.centroid) AS gpw90val FROM<br>
>>gpw90, priogrid_land WHERE ST_Intersects(priogrid_land.centroid, gpw90.rast)) AS gpw90<br>
>>WHERE gpw90.gid = 139303<br>
>>GROUP BY gid,((gpw90.gpw90val))<br>
>>;<br>
>><br>
>>Gives:<br>
>>gid; gpw90<br>
>>139303;39849<br>
>><br>
>>The value in the original raster is:<br>
>>39849.2<br>
>><br>
>>Question is then. How can i ensure that raster remain decimal and not integer after this import and<br>
>>query process?<br>
>><br>
>>Thanks.<br>
>>Andreas<br>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><mailto:<a href="mailto:postgis-users@postgis.refractions.net">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>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><mailto:<a href="mailto:postgis-users@postgis.refractions.net">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>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><mailto:<a href="mailto:postgis-users@postgis.refractions.net">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>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@postgis.refractions.net">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>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">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>
</div></div></blockquote></div><br></div>