AW: [Gdal-dev] Translationproblem from PostGIS to MapInfo using o gr2ogr

Fischer, Andreas andreas.fischer at kreis-unna.de
Wed Nov 9 06:42:14 EST 2005


Hallo Frank,
thank you very much for your response. I tryed out your workaround and the
CordSys line is now set "almost" properly. 
-> CoordSys Earth Projection 8, 1000, "m", 9, 0, 1, 3500000, 0 Bounds
(-30000000, -15000000) (30000000, 15000000)
Unfortunately there is still that setting of the Bounds, that causes an not
exact presentation of the geodata get out of PostGIS with ogr2ogr. (For
controll purposes I loaded up original MapInfo data in PostGIS, get them out
again with org2ogr and get them overlayed in MapInfo.) 
When I just drop this Bounds-Setting or replace it with the real Bounds of
my layer erything is fine. The real bounds are given by ogrinfo with
"Extent: (3389947.432059, 5695439.163816) - (3420229.640720,
5734664.510295)". This bounds cover all of my region I'm only working with.
So, is there a way to tell the ogr2ogr not to set the Bounds at all or set
the Bounds corresponding to the layer? Maybe within my 31463.prj-file that I
created? Here is the listing of that file:

PROJCS["unnamed",
    GEOGCS["unnamed",
        DATUM["MIF 1000",
            SPHEROID["Bessel 1841",6377397.155,299.1528128],
            TOWGS84[582,105,414,1.04,0.35,-3.08,8.3]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",9],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",3500000],
    PARAMETER["false_northing",0],
    UNIT["Meter",1.0]]

Frank, thank you for your help so far
Greetings from Germany
Andreas


-----Ursprüngliche Nachricht-----
Von: Frank Warmerdam [mailto:warmerdam at pobox.com]
Gesendet: Dienstag, 8. November 2005 16:12
An: Fischer, Andreas
Cc: gdal-dev at lists.maptools.org; mitab at yahoogroups.com
Betreff: Re: [Gdal-dev] Translationproblem from PostGIS to MapInfo using
ogr2ogr


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