[postgis-users] PostGIS Raster Decimal?

Andreas Forø Tollefsen andreasft at gmail.com
Tue Mar 22 03:18:00 PDT 2011


Just double checked that my raster pixel values are indeed stored as decimal
values.
select ST_Value(rast,560,100) FROM gpw95;
returns:
11678.7138671875


2011/3/16 Jorge Arévalo <jorge.arevalo at deimos-space.com>

> On Wed, Mar 16, 2011 at 2:53 PM, Pierre Racine
> <Pierre.Racine at sbf.ulaval.ca> wrote:
> > Yes, this is ticket 837
> >
> > http://trac.osgeo.org/postgis/ticket/837
> >
> > Jorge, are those numerous warning normal?
>
> The warnings are normal if debug option is enabled. But what strikes
> me is printf shows real and truncated value as same value. I think
> this is caused because both values are compared in this way:
>
> if (doubleValue1 != doubleValue2) printf(....)
>
> instead of
>
> if (fabs(doubleValue1 - doubleValue2) > FLT_EPSILON) printf(....)
>
> So, this warning message is probably generated in setBits function.
> Anyway, I don't think that's the reason of the memory error.
>
> --
> 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
>
>
> > ________________________________________
> > From: postgis-users-bounces at postgis.refractions.net [
> postgis-users-bounces at postgis.refractions.net] On Behalf Of Andreas Forø
> Tollefsen [andreasft at gmail.com]
> > Sent: Wednesday, March 16, 2011 9:24 AM
> > To: PostGIS Users Discussion
> > Subject: Re: [postgis-users] PostGIS Raster Decimal?
> >
> > Is the above memory issue known for the ST_MapAlgebra function?
> > Did you experience this Regina?
> >
> > I will try with some other rasters.
> > The WARNING lines are just a sample. I think it went through a couple of
> thousands before it ran out of memory.
> > Is it not strange that the truncated values are the same as the original
> values?
> >
> > Andreas
> >
> > 2011/3/15 Andreas Forø Tollefsen <andreasft at gmail.com<mailto:
> andreasft at gmail.com>>
> > Hi Pierre,
> > I got memory issues as well.
> > I tried with this query:
> > SELECT ST_MapAlgebra(rast, 'rast*10') INTO algtest FROM gpw90;
> >
> >
> > WARNING:  Pixel value for 32BF band got truncated from 47519.1 to 47519.1
> > WARNING:  Pixel value for 32BF band got truncated from 185494 to 185494
> > WARNING:  Pixel value for 32BF band got truncated from 28485.1 to 28485.1
> > WARNING:  Pixel value for 32BF band got truncated from 10927.1 to 10927.1
> >
> >
> > ERROR:  out of memory
> > DETAIL:  Failed on request of size 19.
> >
> > ********** Error **********
> >
> > ERROR: out of memory
> > SQL state: 53200
> > Detail: Failed on request of size 19.
> >
> > 2011/3/14 Paragon Corporation <lr at pcorp.us<mailto:lr at pcorp.us>>
> > Pierre,
> >
> > Actually the single raster version is documented.  Though I did run into
> memory issues -- so still think we need some work on that.
> >
> > http://www.postgis.org/documentation/manual-svn/RT_ST_MapAlgebra.html
> >
> > Regina
> > http://www.postgis.us
> >
> >
> >
> > ________________________________
> > From: postgis-users-bounces at postgis.refractions.net<mailto:
> postgis-users-bounces at postgis.refractions.net> [mailto:
> postgis-users-bounces at postgis.refractions.net<mailto:
> postgis-users-bounces at postgis.refractions.net>] On Behalf Of Andreas Forø
> Tollefsen
> > Sent: Monday, March 14, 2011 2:03 PM
> > To: PostGIS Users Discussion
> > Cc: Pierre Racine
> >
> > Subject: Re: [postgis-users] PostGIS Raster Decimal?
> >
> > Hi Pierre,
> >
> > I will check it out tomorrow and give some feedback.
> >
> > Cheers,
> > Andreas
> >
> > 2011/3/14 Pierre Racine <Pierre.Racine at sbf.ulaval.ca<mailto:
> Pierre.Racine at sbf.ulaval.ca>>
> > I’m very aware of the problem. Will try to fix it the best we can.
> >
> > Why not testing ST_MapAlgebra and give us your feedback? It is still to
> document but the specifications are in this page:
> >
> > http://trac.osgeo.org/postgis/wiki/WKTRaster/SpecificationWorking02
> >
> > Pierre
> >
> > From: postgis-users-bounces at postgis.refractions.net<mailto:
> postgis-users-bounces at postgis.refractions.net> [mailto:
> postgis-users-bounces at postgis.refractions.net<mailto:
> postgis-users-bounces at postgis.refractions.net>] On Behalf Of Andreas Forø
> Tollefsen
> > Sent: 14 mars 2011 11:24
> > To: PostGIS Users Discussion
> > Subject: Re: [postgis-users] PostGIS Raster Decimal?
> >
> > Hi Pierre.
> >
> > Yes. I think that would be an appropriate temporary fix.
> > 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 :)
> >
> > Good luck.
> >
> > Best,
> > Andreas
> >
> > 2011/3/14 Pierre Racine <Pierre.Racine at sbf.ulaval.ca<mailto:
> Pierre.Racine at sbf.ulaval.ca>>
> > Andreas,
> >
> > This is a well known problem. See ticket
> http://trac.osgeo.org/postgis/ticket/650
> >
> > I will discuss this problem with Frank this week at the code sprint in
> Montreal.
> >
> > 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).
> >
> > Pierre
> >
> >>-----Original Message-----
> >>From: Pierre Racine
> >>Sent: 14 mars 2011 10:55
> >>To: Pierre Racine
> >>Subject: FW: [postgis-users] PostGIS Raster Decimal?
> >>
> >>
> >>
> >>From: postgis-users-bounces at postgis.refractions.net<mailto:
> postgis-users-bounces at postgis.refractions.net> [mailto:postgis-users-
> <mailto:postgis-users->
> >>bounces at postgis.refractions.net<mailto:bounces at postgis.refractions.net>]
> On Behalf Of Andreas Forø Tollefsen
> >>Sent: 14 mars 2011 10:53
> >>To: PostGIS Users Discussion
> >>Subject: [postgis-users] PostGIS Raster Decimal?
> >>
> >>Hi. Again.
> >>
> >>I have been working on some raster data in PostGIS lately.
> >>However, i have some issues with the raster values become integer after
> importing the sql to postgis.
> >>For instance this procedure:
> >>
> >>C:\prio_grid\source\gpw>c:\python26\python
> c:\prio_grid\script\raster2pgsql.py -
> >>r c:\prio_grid\source\gpw\lrc30p90\glp90ag30\w001001.adf -t gpw90 -s 4326
> -o gpw
> >>90.sql -I -M
> >>
> >>Then to database:
> >>C:\prio_grid\source\gpw>psql -h 192.168.1.55 -d priogrid -f gpw90.sql
> >>
> >>Querying this data:
> >>SELECT gpw90.gid, ((gpw90.gpw90val).val) AS gpw90
> >>INTO popgrid
> >>FROM (SELECT priogrid_land.gid, ST_Intersection(gpw90.rast,
> priogrid_land.centroid) AS gpw90val FROM
> >>gpw90, priogrid_land WHERE ST_Intersects(priogrid_land.centroid,
> gpw90.rast)) AS gpw90
> >>WHERE gpw90.gid = 139303
> >>GROUP BY gid,((gpw90.gpw90val))
> >>;
> >>
> >>Gives:
> >>gid; gpw90
> >>139303;39849
> >>
> >>The value in the original raster is:
> >>39849.2
> >>
> >>Question is then. How can i ensure that raster remain decimal and not
> integer after this import and
> >>query process?
> >>
> >>Thanks.
> >>Andreas
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net<mailto:
> postgis-users at postgis.refractions.net>
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net<mailto:
> postgis-users at postgis.refractions.net>
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net<mailto:
> postgis-users at postgis.refractions.net>
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110322/509d8729/attachment.html>


More information about the postgis-users mailing list