2

I have the following geojson that I would like to convert to MapInfo tab with ogr2ogr: ogr2ogr -f "MapInfo Tab" output.tab input.geojson

geojson:

{
   "type":"FeatureCollection",  
   "crs":{
      "type":"name",
      "properties":{
         "name":"urn:ogc:def:crs:EPSG:3857"
      }
   },
   "features":[
      {
         "type":"Feature",
         "geometry":{
            "type":"LineString",
            "coordinates":[[-7551132, 6293816],[-7560916, 6260489]],
         },
         "properties":{
            "id":36
         }
      }
   ]
}

However, the output MapInfo Tab does not include the projection defined in the geojson.

Using ogrinfo on output.tab: ogrinfo -ro -al output.tab

Layer name: output
Geometry: Line String
Feature Count: 1
Extent: (-7560915.990000, 6260488.995000) - (-7551132.000000, 6293815.995000)
Layer SRS WKT:
PROJCS["unnamed",
    GEOGCS["unnamed",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563],
            TOWGS84[0,0,0,0,0,0,0]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["Meter",1.0]]
id: Integer (0.0)
OGRFeature(output2):1
  id (Integer) = 36
  Style = PEN(w:1px,c:#000000,id:"mapinfo-pen-2,ogr-pen-0")
  LINESTRING (-7551132.0 6293815.995,-7560915.99 6260488.995)
3

It appears its a known issue with the MapInfo Tab (mitab) format as we can see in this old osgeo ticket here: https://trac.osgeo.org/gdal/ticket/481

MapInfo Tab format may have problem to recognize projection by name.

EDIT: Using linked crs instead of named crs in the geojson is not working neither.

EDIT 2: This issue was corrected in the trunk version of gdal since 2015-09-18. This patch will be present in the next official release after this date.

1

I would write mail about this to gdal-dev mailing list because this may be a bug in the MapInfo driver. Compare with the OGC WKT output from gdalsrsinfo:

gdalsrsinfo epsg:3857

PROJ.4 : '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=
0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs'

OGC WKT :
PROJCS["WGS 84 / Pseudo-Mercator",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["X",EAST],
    AXIS["Y",NORTH],
    EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +
x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs"],
    AUTHORITY["EPSG","3857"]]
  • I have found that its an old bug in mitab format: trac.osgeo.org/gdal/ticket/481 – Below the Radar Feb 25 '16 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.