GDAL之重投影(详细篇)

一、空间坐标系对应EPSG编号

二、通用横向墨卡托(UTM)投影坐标系和WGS84地理坐标系转换

一、目标地区的编号查看(中国东部地区属于UTM Zone 50N)

GDAL之重投影(详细篇)_第1张图片
从180“W开始,有60个纵向投影区,编号为1到60。除了挪威和斯瓦尔巴群岛附近的一些例外,每个区域都是6度宽。在南纬80度到北纬84度之间有20个纬向带,用字母C到X表示,省略了字母L和O,除了南纬12度的X区之外,每个纬向带都是南纬8度。
在每一个经度区域内,横向墨卡托投影被用来给出以米为单位的坐标(东方和北方)。

二、查找UTM 50N 的 EPSG 执行标准

Projected Coordinate Systems(投影坐标系)
Geographic Coordinate Systems(地理坐标系)

三、UTM坐标转WGS84案例

>>> from pyproj import Proj,transform
>>> WGS84 = Proj(init='EPSG:4326')
>>> p = Proj(init="EPSG:32650")
>>> x,y = 526434.351935, 3522210.609046
>>> transform(p, WGS84, x, y)
(117.27936202563953, 31.835267862875163)

四、WGS84转UTM坐标案例

>>> from pyproj import Proj,transform
>>> WGS84 = Proj(init='EPSG:4326')
>>> p = Proj(init="EPSG:32650")
>>> x,y = 526434.351935, 3522210.609046
>>> transform(WGS84,p, x, y)

五、无法在 GDAL 中使用转换,出现错误 ERROR 1: latitude or longitude exceeded limits

Officially EPSG:4326 is using latitude-longitude order

GDAL之重投影(详细篇)_第2张图片

from osgeo import ogr
from osgeo import osr

source = osr.SpatialReference()
source.ImportFromEPSG(4326)
source.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)


target = osr.SpatialReference()
target.ImportFromEPSG(3857)

transform = osr.CoordinateTransformation(source, target)
poly = ogr.CreateGeometryFromJson(str("{'type': 'Polygon', 'coordinates': [[[-117.10825, 47.603493], [-117.10825, 47.887733], [-116.619302, 47.887733], [-116.619302, 47.603493], [-117.10825, 47.603493]]]}"))
poly.Transform(transform)
from osgeo import ogr,osr
source = osr.SpatialReference()
source.ImportFromEPSG(26913)
target = osr.SpatialReference()
target.ImportFromEPSG(4326)

#The line below sets the TRADITIONAL_GIS_ORDER that I was expecting.
target.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)

transform = osr.CoordinateTransformation(source, target)
point = ogr.CreateGeometryFromWkt("POINT (351415.75 3885929.09)")
point.Transform(transform)
print(point.ExportToWkt())
#New Output: POINT (-106.630305974043 35.1052340446701)

六、Python地学分析 — GDAL对遥感影像重投影

你可能感兴趣的:(GDAL遥感影像处理,arcgis)