如何在python中获取受支持的gdal格式列表


Answers:


13

gdal.GetDriverCount()将提供具有的驱动程序数量gdal。结合简单的循环,可以列出所有驱动程序。

import gdal
driver_list = []
for i in range(gdal.GetDriverCount()):
    driver = gdal.GetDriver(i)
    driver_list.append(driver.GetDescription())

# list comprehension
driver_list = [gdal.GetDriver(i).GetDescription() for i in range(gdal.GetDriverCount())]

# to get name as string
gdal.GetDriver(i).ShortName
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.