Python GDAL / OGR:如何创建MapInfo TAB文件?

时间:2017-01-25 09:38:05

标签: python gdal ogr mapinfo epsg

使用import 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文件的等效文件?

1 个答案:

答案 0 :(得分:3)

找到解决方案:

print proj.ExportToMICoordSys()

它给出了:

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