使用Python,是否可以遍历栅格并提取每个像素的纬度/经度坐标?

2 投票
1 回答
1284 浏览
提问于 2025-04-18 11:14

我想用Python提取栅格图像中每个像素的经纬度坐标。我希望这个过程是开源的,因为我知道可以使用arcpy模块来实现(先把栅格转换成点,然后用point.POINT_X等方法获取点的信息)。

*为了更清楚:我想获取Landsat栅格数据集的经纬度坐标。

1 个回答

0

免责声明:我是下面这个库的作者。

你可以使用 lidario.Translator 将你的栅格图像转换成点云。它会返回一个 np.array,里面包含你 tif 文件中每个像素的坐标。

将 Geotiff 转换为 np.array:

import lidario as lio
    
# Create a Translator object which will take a tif file and return a np.array
translator = lio.Translator("geotiff", "np")
    
# Translate the tif file and get the np.array
point_cloud = translator.translate("/path/to/file.tif")

撰写回答