[postgis-users] PostGIS Raster Decimal?

Jorge Arévalo jorge.arevalo at deimos-space.com
Mon Mar 14 08:00:47 PDT 2011

On Mon, Mar 14, 2011 at 3:53 PM, Andreas Forø Tollefsen
<andreasft at gmail.com> wrote:
> 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 -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
> http://postgis.refractions.net/mailman/listinfo/postgis-users

Hi Andreas,

This is a known bug (http://trac.osgeo.org/postgis/ticket/650). A
polygonize algorithm provided by GDAL library is used in intersection
function, and this algorithm truncates float values to signed 32 bits
integers. We should solve this, but we don't know when. I'm really

Best regards,

Jorge Arévalo
Internet & Mobilty Division, DEIMOS
jorge.arevalo at deimos-space.com

More information about the postgis-users mailing list