[postgis-users] Problem to visualize raster data from PostGIS inQGIS

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Tue Mar 31 07:12:19 PDT 2015


Just

SELECT (ST_DumpAsPolygons(rast)).*
FROM deforested_areas
-–WHERE rid = 1

> -----Original Message-----
> From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-
> bounces at lists.osgeo.org] On Behalf Of Hugues François
> Sent: Tuesday, March 31, 2015 10:05 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Problem to visualize raster data from PostGIS
> inQGIS
> 
> Hello,
> 
> 
> 
> To display raster data, you can try ST_DumpAsPolygons into Arcgis or
> OpenJump (if it is just a test, you could add a where clause on tile id).
> 
> 
> 
> WITH a AS (select ST_DumpAsPolygons(rast) AS mydump from
> deforested_areas –where rid = 1)
> 
> 
> 
> SELECT (mydump).val, (mydump).geom FROM a
> 
> 
> 
> This website is a bit outdated, but you can find some useful insights :
> http://trac.osgeo.org/postgis/wiki/WKTRaster
> 
> 
> 
> Hug
> 
> 
> 
> 
> 
> De : postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-
> bounces at lists.osgeo.org] De la part de Roberto Lazarte Kaqui
> Envoyé : mardi 31 mars 2015 15:11
> À : postgis-users at lists.osgeo.org
> Objet : [postgis-users] Problem to visualize raster data from PostGIS inQGIS
> 
> 
> 
> I have two multiband raster files and i'm trying to load these data into
> PostGIS using “raster2pgsql”.
> 
> Here is the syntax that i used:
> 
> 
> 
> raster2pgsql -c -s 4326 -I -t 100x100 *.tif  public.deforested_rasters | psql -
> d r342471958
> 
> 
> 
> It works without error, but i don't know if the command loads correctly
> both raster files. The database in PostGIS has two columns, one with the
> spatial index and the other one with raster information. I'm trying to
> visualize the resultant database in QGIS, but for some reason it doesn't
> open the raster layer.
> 
> I've tried to solve this problem using this idea:
> https://duncanjg.wordpress.com/2012/11/20/the-basics-of-postgis-raster/
> <https://duncanjg.wordpress.com/2012/11/20/the-basics-of-postgis-
> raster/> , transforming the raster data to geometry data through DB
> manager using this command:
> 
> 
> 
> select rid,rast::geometry from deforested_rasters
> 
> 
> 
> but when visualized in QGIS, only returns a rectangular area without the
> original characteristics.
> 
> Any ideas of how can i confirm that the “raster2pgsql” command loads
> correctly the raster files? Or a different way to load these data into
> PostGIS?
> 
> The raster files are available
> in:https://www.dropbox.com/sh/nu8nl6cigv8viz1/AADTrr_w8SCstDHOu6A
> iGeJta?dl=0
> <https://www.dropbox.com/sh/nu8nl6cigv8viz1/AADTrr_w8SCstDHOu6Ai
> GeJta?dl=0>
> 
> 
> 
> Thanks,
> 
> Roberto
> 
> 



More information about the postgis-users mailing list