python - 将 Sentinel-1 SAR 图像的像素位置转换为地理坐标(纬度、经度)

标签 python geolocation sentinel1 snap-python sentinel2

如何从 Sentinel-1 合成孔径雷达 (SAR) 卫星图像中的 x,y 位置获取地理坐标

例如,我可以访问下载的图像信息 sg 作为

from snappy import ProductIO
from snappy import PixelPos 
path='path_name'
product = ProductIO.readProduct(path)
sg = product.getSceneGeoCoding()

但是如何使用 ESA's snap engine within Python 获取 sg 中所需点 (x, y) 的纬度经度

最佳答案

使用下面的自定义函数,我们可以轻松地将图像sg内的任何点转换为其坐标(纬度,经度):

def LatLon_from_XY(ProductSceneGeoCoding, x, y):
    #From x,y position in satellite image (SAR), get the Latitude and Longitude
    geopos = ProductSceneGeoCoding.getGeoPos(PixelPos(x, y), None)
    latitude = geopos.getLat()
    longitude = geopos.getLon()
    return latitude, longitude

更新: 由于各种snap版本更新,上述功能可能无法正常使用。下面的功能应该在大多数情况下都可以工作。

def LatLon_from_XY(product, x, y):
    geoPosType = jpy.get_type('org.esa.snap.core.datamodel.GeoPos')
    geocoding = product.getSceneGeoCoding()
    geo_pos = geocoding.getGeoPos(snappy.PixelPos(x, y), geoPosType())
    if str(geo_pos.lat)=='nan':
        raise ValueError('x, y pixel coordinates not in this product')
    else:
        return geo_pos.lat, geo_pos.lon

例如对于给定的sg产品,我们可以获得像素坐标(x=12000,y=2000)为

latitude, longitude = LatLon_from_XY(sg, 12000, 2000)

关于python - 将 Sentinel-1 SAR 图像的像素位置转换为地理坐标(纬度、经度),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51046217/

相关文章:

python - 如何从元组列表中获取值并创建一个新列表

python - 如何在Python中将一个项目的存储桶中的数据加载到另一个项目的表中?

html - Web浏览器中的位置检测

android - 如何获取位置或只是一个 id 以提供基于位置的内容?

java - 如何使用经纬度信息从集合中计算地理空间距离?

python - 将 Sentinel-1 SAR 图像的地理坐标(经度、纬度)转换为像素位置(x、y)

python - 基本神经网络,权重过高

python - python中数组的导数?