[Gdal-dev] Translationproblem from PostGIS to MapInfo using ogr2ogr

Frank Warmerdam warmerdam at pobox.com
Tue Nov 8 10:11:41 EST 2005


On 11/8/05, Fischer, Andreas <andreas.fischer at kreis-unna.de> wrote:
> Dear list,
> I'm using the ogr2ogr tool to convert PostGIS-data to MapInfo tab or
> MIF-Files. The projection in the Database is EPSG:31463. The output-format
> is supposed to be the same.
> So I did use the following command. (I used -dsco "FORMAT=MIF", because the
> conversion to MapInfo tab did not work well and I could take a look at
> parameters in the files)
> ogr2ogr -f "MapInfo File" test "PG:dbname=geodaten user=user host=host
> port=port" -sql "Select * from test_tabelle" -dsco "FORMAT=MIF" -nln mi_test
> -a_srs "EPSG:31463"
>
> The result is not the one I expected, because MapInfo does not show the
> expected projektion (GK, DHDN Zone3). Instead it shows Longitude/Latitude,
> even thought the Coordinates are o.k..
> So I took a look at the MIF-File and found the following line:
> CoordSys Earth Projection 8, 104, "m", 9, 0, 1, 3500000, 0 Bounds(-30000000,
> -15000000) (30000000, 15000000)
> When I change this line to the following, the import of the MIF-File to
> MapInfo worked fine. It has the right projection und the geometries of the
> features are exact. This line is the same as in mapinfow.prj for this
> projection and without Bounds-Clause the result was very precise
> CoordSys Earth Projection 8, 1000, "m", 9, 0, 1, 3500000, 0
>
> So does anyone know about the right parameters to give with ogr2ogr to get
> the right line in the MIF-File? Or does anyone can help me otherwise to get
> MapInfo-Files from PostGis-tables without manual work.

Andreas,

The original problem is because the expansion of EPSG:31463 is not
easily identified as being datum 1000 for mapinfo format.  The name does
not exactly match (it is called "DHDN_Potsdam_Rauenberg" in the
mitab_spatialref.cpp file), and there is no corresponding TOWGS84 entry
on the EPSG expansion.

I believe the code falls back to using WGS84 (datum 104) when a datum
cannot be identified.

The workaround for you would be to run ogrinfo on a fixed mif file.
Save the Well Known Text coordinate system description to a file,
perhaps called 31463.prj, then issue the future ogr2ogr commands
with the -a_srs 31463.prj commandline switch.

The MITAB code should recognise that 31463.prj corresponds to
datum 1000 and set the CoordSys properly.

I appologise for these problems, but the area of coordinate system
translation between systems is fraught with complexity and uncertainty.

PS. I don't know why "CoordSys Earth Projection 8, 104, "m", 9, 0, 1,
3500000, 0"
shows up in mapinfo as a geographic coordinate system.  It should still
be transverse mercator but with a datum of WGS84.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list