OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.8k stars 2.51k forks source link

gdal2tiles type error generating kmz file from tif raster #8208

Closed LoneStarMac closed 1 year ago

LoneStarMac commented 1 year ago

I was using gdal2tiles.py to create a KMZ tileset from a .tif raster. I was using this file: https://rice.box.com/s/h6c0vuy9k0p65nv7fhh5irn3yfv9yq4b

instead of running for a while and then dropping a .kmz file in my user directory, it errors out after several minutes: TypeError: sequence item 0: expected str instance, tuple found

Here is a sample of the output right before the type error:

    ReadRaster Extent: (30035, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (30292, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (30548, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (30804, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (31061, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (31317, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (31573, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (31830, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (32086, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (32342, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (32599, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (32855, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (33111, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (33368, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (33624, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (33880, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (34137, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (34393, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (34650, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (34906, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (35162, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (35419, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (35675, 28465, 256, 35), (0, 0, 1024, 140)
    ReadRaster Extent: (35931, 28465, 149, 35), (0, 0, 596, 140)

I installed gdal via homebrew for my M2 Mac. Then I edited my tif in photoshop, manually aligned it in QGIS, then exported the render as a geotiff. (resulting file is linked above)

From there I ran gdal2tiles.py -k -v --s_srs EPSG:3857 /Users/xxxxxxxxx/Downloads/473_Main_georeferenced_transp.tif /Users/xxxxxxxxx/437_transp_geo.kmz

macOS Ventura 13.5 (22G74)

the 3.7.1_1 version from homebrew (https://formulae.brew.sh/formula/gdal)

rouault commented 1 year ago

KMZ output is not supported. You need to specify an output directory, and possibly zip the content as a .kmz