解决python gdal投影坐标系转换的问题

yipeiwu_com5年前Python基础

要将xian80地理坐标系转换成投影坐标系:

xian1980 = """
GEOGCS["GCS_Xian_1980",
  DATUM["Xian_1980",
    SPHEROID["Xian_1980",6378140.0,298.257]],
  PRIMEM["Greenwich",0.0],
  UNIT["Degree",0.0174532925199433]]"""
prjreference = 'PROJCS["Xian_1980_3_Degree_GK_Zone_37",GEOGCS["GCS_Xian_1980",DATUM["D_Xian_1980",SPHEROID["Xian_1980",6378140.0,298.257]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Gauss_Kruger"],PARAMETER["False_Easting",37500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",111.0],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]'

转换后会报错:

  latlong = transform.TransformPoint(x,y)
 File "/usr/lib/python3/dist-packages/osgeo/osr.py", line 711, in TransformPoint
  return _osr.CoordinateTransformation_TransformPoint(self, *args)
NotImplementedError: Wrong number or type of arguments for overloaded function 'CoordinateTransformation_TransformPoint'.
 Possible C/C++ prototypes are:
  OSRCoordinateTransformationShadow::TransformPoint(double [3])
  OSRCoordinateTransformationShadow::TransformPoint(double [3],double,double,double)

**想想之前也没发现过这个问题呀,最后发现之前投影坐标系:**
'PROJCS["Xian_1980_3_Degree_GK_Zone_37",GEOGCS["GCS_Xian_1980",DATUM["D_Xian_1980",SPHEROID["Xian_1980",6378140.0,298.257]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",37500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",111.0],PARAMETER["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]'

**不是高斯-克吕格投影而是横轴墨卡托,我想原因可能是gdal库里只能支持高斯-克吕格投影吧。**

以上这篇解决python gdal投影坐标系转换的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

python中urlparse模块介绍与使用示例

简介 urlparse模块主要是用于解析url中的参数  对url按照一定格式进行 拆分或拼接。urlparse库用于把url解析为各个组件,支持file,ftp,http,h...

Python 学习笔记

可以任意转载,但转载时必须标明原作者charlee、原始链接http://tech.idv2.com/2008/11/03/python-memo/以及本声明。 基本概念 Pytho...

Python删除n行后的其他行方法

如下所示: #!/usr/bin/python #-*- coding: utf-8 -*- fin=open('add_1.txt') a=fin.readlines() #...

python画微信表情符的实例代码

python画微信表情符的实例代码

#@project = facepalm #@file = main #@author = Maoliang Ran #@create_time = 2018/8/28 22:...

python完成FizzBuzzWhizz问题(拉勾网面试题)示例

拉勾网面试题1. 你首先说出三个不同的特殊数,要求必须是个位数,比如3、5、7。2. 让所有学生拍成一队,然后按顺序报数。3. 学生报数时,如果所报数字是第一个特殊数(3)的倍数,那么不...