[postgis-tickets] [PostGIS] #2248: ST_AsGDALRaster Missing Spatial Reference

PostGIS trac at osgeo.org
Wed Mar 27 02:26:10 PDT 2013


#2248: ST_AsGDALRaster Missing Spatial Reference
-----------------------+----------------------------------------------------
 Reporter:  digimap2k  |       Owner:  dustymugs    
     Type:  defect     |      Status:  new          
 Priority:  medium     |   Milestone:  PostGIS 2.0.4
Component:  raster     |     Version:  2.0.x        
 Keywords:             |  
-----------------------+----------------------------------------------------

Comment(by digimap2k):

 Interesting, I tried using QGIS to recreate this and when loading my
 raster I get a warning from QGIS requesting that I choose a spatial
 reference system as none was found in the raster. I did wonder if QGIS
 might assume WGS84 with no SRS and accept your USGS DEM without error but
 seems not.

 Fair comment on the PNG and JPEG, they do of course only output the binary
 image data and not the associated geo referencing files so couldn't be
 expected to work.
 I guess to move this forward I really need to suck it up and go for
 postgis 2.1 in case I'm just chasing something which has been sorted. I've
 also got some elevation data models which I'll be trying out today in case
 that's relevant to SRS export.

 FWIW, I streamlined my workaround a little to left join the spatial ref
 sys table to the raster query so it returns the WKT for the projection
 along with the raster which makes the fix a lot simpler in Qt...

 SELECT ST_AsGDALRaster(rast, 'GTiff'), t2.srtext FROM
 mapping_rasters.os_roadmap t1 LEFT JOIN spatial_ref_sys t2 ON t2.srid =
 ST_SRID(t1.rast) WHERE foo = bar

 then in C++ it's just a simple SetProjection() on the GDALDataset using
 the t2.srtext string and everything is happy again.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2248#comment:7>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list