[gdal-dev] [SOLVED] How to create TIFF with overview from a TMS server ?

Jean-Claude Repetto jrepetto at free.fr
Fri Jan 21 04:52:50 EST 2011


Le 20/01/2011 14:48, Jean-Claude Repetto a écrit :
> Le 20/01/2011 14:33, C.Strobl at dlr.de a écrit :
>>
>> so you can use gdal_merge or gdalwarp. i thought your problem was the
>> pyramid building
>
> I know that I can assemble the 4 tiles with gdalwarp or gdal_merge. But
> how do I assemble the resulting 512x512 image (level 17) with the
> 256x256 image (level 16) to form a pyramid ?


Finally, I have found a work-around. Here is an example that shows how 
to create a pyramidal TIFF containing the level 0, 1 and 2 of OSM :

$ gdal_translate -outsize 256 256 frmt_wms_openstreetmap_tms.xml level0.tif
Input file size is 134217728, 134217728
0...10...20...30...40...50...60...70...80...90...100 - done.

$ gdal_translate -outsize 512 512 frmt_wms_openstreetmap_tms.xml level1.tif
Input file size is 134217728, 134217728
0...10...20...30...40...50...60...70...80...90...100 - done.

$ gdal_translate -outsize 1024 1024 frmt_wms_openstreetmap_tms.xml 
level2.tif
Input file size is 134217728, 134217728
0...10...20...30...40...50...60...70...80...90...100 - done.

$ mv level1.tif level2.tif.ovr

$ mv level0.tif level2.tif.ovr.ovr

$ gdal_translate -co COPY_SRC_OVERVIEWS=YES level2.tif pyramid.tif
Input file size is 1024, 1024
0...10...20...30...40...50...60...70...80...90...100 - done.

$ gdalinfo pyramid.tif
Driver: GTiff/GeoTIFF
Files: pyramid.tif
Size is 1024, 1024
Coordinate System is:
PROJCS["Google Maps Global Mercator",
     GEOGCS["WGS 84",
         DATUM["WGS_1984",
             SPHEROID["WGS 84",6378137,298.257223563,
                 AUTHORITY["EPSG","7030"]],
             AUTHORITY["EPSG","6326"]],
         PRIMEM["Greenwich",0],
         UNIT["degree",0.0174532925199433],
         AUTHORITY["EPSG","4326"]],
     PROJECTION["Mercator_1SP"],
     PARAMETER["central_meridian",0],
     PARAMETER["scale_factor",1],
     PARAMETER["false_easting",0],
     PARAMETER["false_northing",0],
     UNIT["metre",1,
         AUTHORITY["EPSG","9001"]]]
Origin = (-20037508.339999999850988,20037508.339999999850988)
Pixel Size = (39135.758476562499709,-39135.758476562499709)
Metadata:
   AREA_OR_POINT=Area
Image Structure Metadata:
   INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (-20037508.340,20037508.340) (180d 0' 0.00"W, 85d 5' 2.61"N)
Lower Left  (-20037508.340,-20037508.340) (180d 0' 0.00"W, 85d 5' 2.61"S)
Upper Right (20037508.340,20037508.340) (180d 0' 0.00"E, 85d 5' 2.61"N)
Lower Right (20037508.340,-20037508.340) (180d 0' 0.00"E, 85d 5' 2.61"S)
Center      (   0.0000000,   0.0000000) (  0d 0' 0.01"E,  0d 0' 0.01"N)
Band 1 Block=1024x2 Type=Byte, ColorInterp=Red
   Overviews: 512x512, 256x256
Band 2 Block=1024x2 Type=Byte, ColorInterp=Green
   Overviews: 512x512, 256x256
Band 3 Block=1024x2 Type=Byte, ColorInterp=Blue
   Overviews: 512x512, 256x256



More information about the gdal-dev mailing list