[gdal-dev] Fwd: Multi-layered tiff reading in gdal

Even Rouault even.rouault at spatialys.com
Sun Sep 24 06:55:40 PDT 2017


On dimanche 24 septembre 2017 09:28:52 CEST Isaac Gerg wrote:
> Hi Even, thanks for your reply.  I do not understand your syntax,
> "GTIFF_DIR:your.tiff:XXXX" 

Actually I was wrong, it is "GTIFF_DIR:XXXX:your.tiff"

> I am using GDAL via python.  Is there a way to
> access these layers via that interface.  Attached is a sample file.

Demo:

$ python

>>> from osgeo import gdal
>>> ds = gdal.Open('/tmp/sample.tif')
>>> ds.GetSubDatasets()
[('GTIFF_DIR:1:/tmp/sample.tif', 'Page 1 (80P x 400L x 1B)'), ('GTIFF_DIR:2:/tmp/sample.tif', 
'Page 2 (80P x 400L x 1B)'), ('GTIFF_DIR:3:/tmp/sample.tif', 'Page 3 (80P x 400L x 1B)'), 
('GTIFF_DIR:4:/tmp/sample.tif', 'Page 4 (80P x 400L x 1B)'), ('GTIFF_DIR:5:/tmp/sample.tif', 
'Page 5 (80P x 400L x 1B)'), ('GTIFF_DIR:6:/tmp/sample.tif', 'Page 6 (80P x 400L x 1B)'), 
('GTIFF_DIR:7:/tmp/sample.tif', 'Page 7 (80P x 400L x 1B)'), ('GTIFF_DIR:8:/tmp/sample.tif', 
'Page 8 (80P x 400L x 1B)'), ('GTIFF_DIR:9:/tmp/sample.tif', 'Page 9 (80P x 400L x 1B)'), 
('GTIFF_DIR:10:/tmp/sample.tif', 'Page 10 (80P x 400L x 1B)'), ('GTIFF_DIR:11:/tmp/sample.tif', 
'Page 11 (80P x 400L x 1B)'), ('GTIFF_DIR:12:/tmp/sample.tif', 'Page 12 (80P x 400L x 1B)'), 
('GTIFF_DIR:13:/tmp/sample.tif', 'Page 13 (80P x 400L x 1B)'), ('GTIFF_DIR:14:/tmp/sample.tif', 
'Page 14 (80P x 400L x 1B)'), ('GTIFF_DIR:15:/tmp/sample.tif', 'Page 15 (80P x 400L x 1B)'), 
('GTIFF_DIR:16:/tmp/sample.tif', 'Page 16 (80P x 400L x 1B)'), ('GTIFF_DIR:17:/tmp/sample.tif', 
'Page 17 (80P x 400L x 1B)'), ('GTIFF_DIR:18:/tmp/sample.tif', 'Page 18 (80P x 400L x 1B)'), 
('GTIFF_DIR:19:/tmp/sample.tif', 'Page 19 (80P x 400L x 1B)'), ('GTIFF_DIR:20:/tmp/sample.tif', 
'Page 20 (80P x 400L x 1B)'), ('GTIFF_DIR:21:/tmp/sample.tif', 'Page 21 (80P x 400L x 1B)')]

>>> subds = gdal.Open('GTIFF_DIR:1:/tmp/sample.tif')
>>> gdal.Info(subds, format = 'json')
{u'files': [u'/tmp/sample.tif'], u'cornerCoordinates': {u'upperRight': [-77.6741449, 
41.0051153], u'lowerLeft': [-77.6739868, 41.0049763], u'lowerRight': [-77.6739574, 
41.0050046], u'upperLeft': [-77.6741742, 41.0050871], u'center': [-77.6740658, 41.0050458]}
[...snipped....]

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170924/683630a0/attachment.html>


More information about the gdal-dev mailing list