gpt4 book ai didi

Python GDAL/OGR : how to create a MapInfo TAB file?

转载 作者:太空宇宙 更新时间:2023-11-04 00:41:14 24 4
gpt4 key购买 nike

使用导入 gdal,ogr,并给定一个 EPSG(例如此处为 2154),用 python 编写(几乎)空的 MapInfo TAB 文件的代码是什么,或者只是投影的摘要行(TAB 格式):

CoordSys Earth Projection 3,999,0,0,0,0,7,3,46.5,44.0,49.0,700000,6600000

对于任何 EPSG 代码?

为了将其与 ESRI 并列,以下行创建一个 .prj 文件:

from osgeo import osr

def make_prj(epsg, path_out):
proj=osr.SpatialReference()
proj.ImportFromEPSG(int(epsg))
with open(path_out, "w") as out:
print >>out, proj.ExportToWkt()

写,对于 epsg=2154 :

PROJCS["RGF93 / Lambert-93",GEOGCS["RGF93",DATUM["Reseau_Geodesique_Francais_1993",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6171"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4171"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["standard_parallel_1",49],PARAMETER["standard_parallel_2",44],PARAMETER["latitude_of_origin",46.5],PARAMETER["central_meridian",3],PARAMETER["false_easting",700000],PARAMETER["false_northing",6600000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],AUTHORITY["EPSG","2154"]]

是否有 TAB 文件的等效项?

最佳答案

找到解决方案:

print proj.ExportToMICoordSys()

它给出:

Earth Projection 3, 104, "m", 3, 46.5, 49, 44, 700000, 6600000

关于Python GDAL/OGR : how to create a MapInfo TAB file?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41848065/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com