[postgis-devel] [PostGIS] #1839: [raster] raster2pgsql is unable to handle TIFF subdatasets

PostGIS trac at osgeo.org
Wed May 23 13:45:55 PDT 2012


#1839: [raster] raster2pgsql is unable to handle TIFF subdatasets
-----------------------------------------------------+----------------------
 Reporter:  turbothomas                              |       Owner:  dustymugs    
     Type:  defect                                   |      Status:  assigned     
 Priority:  medium                                   |   Milestone:  PostGIS 2.0.1
Component:  raster                                   |     Version:  2.0.x        
 Keywords:  raster2pgsql, TIFF, subdataset, history  |  
-----------------------------------------------------+----------------------
Changes (by rouault):

 * cc: rouault (added)


Comment:

 If I'm allowed to comment a bit about the code, I don't think that the
 approach taken in isSubDataset() is so great in term of exaustiveness and
 maintainability. I'm not sure you have captured all the GDAL drivers that
 support subdatasets (actually I know some others, and the list can
 potentially grow with newer GDAL version), and it should not be the job of
 PostGIS to know their syntax. I'd recommand using GDALIdentify() and if it
 succeeds, then it's a GDAL dataset or subdataset.

 Another related remark about the code around line 2537 that uses fopen()
 to test if it is a raster, that is based on fopen(). GDAL supports opening
 files on exotic filesystems like /vsizip/ , /vsicurl/ or even things that
 are not files, like a PostgisRaster dataset, or a GeoRaster dataset...
 Same as above, GDALIdentify() would be better.

 So all in all I think you could just drop isSubDataset() and use
 GDALIdentify().

 (Sorry if I'm perhaps misunderstanding the code. My comments are only
 based on code reading.)

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1839#comment:8>
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-devel mailing list