【问题标题】:Converting pixel position to geographical coordinates (lat, long) for a Sentinel-1 SAR image将 Sentinel-1 SAR 图像的像素位置转换为地理坐标(纬度、经度)
【发布时间】:2018-06-26 15:11:38
【问题描述】:

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

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

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)的latitudelongitude

【问题讨论】:

    标签: python geolocation sentinel1 snap-python sentinel2


    【解决方案1】:

    使用下面的自定义函数,我们可以轻松地将图像内的任意点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
    

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

    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)
    

    【讨论】:

    猜你喜欢
    • 2018-12-14
    • 1970-01-01
    • 2013-09-21
    • 1970-01-01
    • 2016-12-09
    • 2011-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多