2

Using import gdal,ogr, and given an EPSG (e.g. here 2154), what is the code in python to write a (nearly) empty MapInfo TAB file, or just the summary line of the projection (TAB format) :

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

for any EPSG code ?

To juxtapose that with ESRI, the following lines create a .prj file :

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()

that writes, for 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"]]

Is there some equivalent for a TAB file ?

Eric H.
  • 2,152
  • 4
  • 22
  • 34

1 Answers1

3

Found the solution :

print proj.ExportToMICoordSys()

it gives :

Earth Projection 3, 104, "m", 3, 46.5, 49, 44, 700000, 6600000
Eric H.
  • 2,152
  • 4
  • 22
  • 34