readBandMetaData.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:python_scripting_for_spatial_data_processing 作者: upsdeepak 项目源码 文件源码
def readImageMetaData(inputFile, name):
    # Open the dataset in read only mode
    dataset = gdal.Open(inputFile, gdal.GA_ReadOnly)
    # Check that the image has been opened
    if not dataset is None:
        # Get the meta value specified
        metaData = dataset.GetMetaDataItem(name)
        # Check that it is present
        if metaData == None:
            # If not present, print error.
            print("Could not find \'", name, "\' item.")
        else:
            # Else print out the metaData value.
            print(name, "=\'", metaData, "\'")
    else:
        # Print an error messagge if the file
        # could not be opened.
        print("Could not open the input image file: ", inputFile)

# A function to read a meta-data item
# from a image band
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号