[gdal-dev] ogr2ogr mapinfo reporjection

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] ogr2ogr mapinfo reporjection

Jonathan Beliën-2

Hello everyone, 

 

I struggle to reproject GeoJSON file to TAB (or MIF) file.

The source projection is EPSG:4326 and the destination projection is EPSG:31370 (Belge 1972 / Belgian Lambert 72 Belgium : http://epsg.io/31370)

 

I searched forums and mailing lists and saw that there was some issues with reprojection using Mitab but that it is supposed to be fixed.

 

When I try the following command, the coordinates seems to be transformed but the « coordsys » header in the TAB (or MIF) file is wrong (WGS84 Non Earth)

 

ogr2ogr test.mif test.json -f "MapInfo File" -dsco FORMAT=MIF -s_srs EPSG:4326 -t_srs EPSG:31370

 

If I understood correctly what I read on the Internet, thats because Mitab does not recognise « EPSG:31370 » ;

I tried to replace « -t_srs EPSG:31370 » by « -t_srs "31370.txt" » where « 31370.txt » contained the WKT definition of EPSG:31370 ;

I saw in the ogr2ogr documentation that there is a « MITAB_BOUNDS_FILE » parameter but did not find out how to use it (http://www.gdal.org/drv_mitab.html) ;

 

I also searched in « /ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp » to see if « Belgian Lambert 1972 » existed and it does :

 

{ 0,    1019,"Belgian 1972 7 Parameter",   4, -99.059, 53.322, -112.486, -0.419, 0.83, -1.885, 0.999999, 0},

 

So I suppose it should be possible to create a MapInfo file projected in « Belgiam Lambert 1972 » but I do not understand how ?!

 

Any help or idea is welcome !
Thanks a lot !

 

Jonathan Beliën

GEO-6

 


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr mapinfo reporjection

rgreenwood
When you say that the coordsys header is wrong, are you looking at it in MapInfo or in a text editor? If you look at the MIF file coordinates in a text editor do they look like they have been correctly transformed, and it is just the header that is wrong?

On Mon, May 8, 2017 at 7:39 AM, Jonathan Beliën <[hidden email]> wrote:

Hello everyone, 

 

I struggle to reproject GeoJSON file to TAB (or MIF) file.

The source projection is EPSG:4326 and the destination projection is EPSG:31370 (Belge 1972 / Belgian Lambert 72 Belgium : http://epsg.io/31370)

 

I searched forums and mailing lists and saw that there was some issues with reprojection using Mitab but that it is supposed to be fixed.

 

When I try the following command, the coordinates seems to be transformed but the « coordsys » header in the TAB (or MIF) file is wrong (WGS84 Non Earth)

 

ogr2ogr test.mif test.json -f "MapInfo File" -dsco FORMAT=MIF -s_srs EPSG:4326 -t_srs EPSG:31370

 

If I understood correctly what I read on the Internet, thats because Mitab does not recognise « EPSG:31370 » ;

I tried to replace « -t_srs EPSG:31370 » by « -t_srs "31370.txt" » where « 31370.txt » contained the WKT definition of EPSG:31370 ;

I saw in the ogr2ogr documentation that there is a « MITAB_BOUNDS_FILE » parameter but did not find out how to use it (http://www.gdal.org/drv_mitab.html) ;

 

I also searched in « /ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp » to see if « Belgian Lambert 1972 » existed and it does :

 

{ 0,    1019,"Belgian 1972 7 Parameter",   4, -99.059, 53.322, -112.486, -0.419, 0.83, -1.885, 0.999999, 0},

 

So I suppose it should be possible to create a MapInfo file projected in « Belgiam Lambert 1972 » but I do not understand how ?!

 

Any help or idea is welcome !
Thanks a lot !

 

Jonathan Beliën

GEO-6

 


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev



--
Richard W. Greenwood, PLS
www.greenwoodmap.com

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr mapinfo reporjection

Jonathan Beliën-2

Hello Richard,

 

When I look at the resulting MIF file in a text editor, the coordinates are indeed correctly transformed but the header is

 

CoordSys Earth Projection 3, 104, "m", 4.36748666666667, 90, 51.1666672333333, 49.8333339, 150000.013, 5400088.438

 

instead of

 

CoordSys Earth Projection 3, 1019, "m", 4.3674866667, 90, 49.8333339, 51.1666672333, 150000.01300000001, 5400088.4380000001 Bounds (0, 0) (300000, 300000)

 

Thanks for your help !

 

Jonathan Beliën

GEO-6

 

De : Richard Greenwood [mailto:[hidden email]]
Envoyé : mardi 9 mai 2017 01:32
À : Jonathan Beliën <[hidden email]>
Cc : [hidden email]; GDAL List <[hidden email]>; Hellemans, Philippe <[hidden email]>
Objet : Re: [gdal-dev] ogr2ogr mapinfo reporjection

 

When you say that the coordsys header is wrong, are you looking at it in MapInfo or in a text editor? If you look at the MIF file coordinates in a text editor do they look like they have been correctly transformed, and it is just the header that is wrong?

 

On Mon, May 8, 2017 at 7:39 AM, Jonathan Beliën <[hidden email]> wrote:

Hello everyone, 

 

I struggle to reproject GeoJSON file to TAB (or MIF) file.

The source projection is EPSG:4326 and the destination projection is EPSG:31370 (Belge 1972 / Belgian Lambert 72 Belgium : http://epsg.io/31370)

 

I searched forums and mailing lists and saw that there was some issues with reprojection using Mitab but that it is supposed to be fixed.

 

When I try the following command, the coordinates seems to be transformed but the « coordsys » header in the TAB (or MIF) file is wrong (WGS84 Non Earth)

 

ogr2ogr test.mif test.json -f "MapInfo File" -dsco FORMAT=MIF -s_srs EPSG:4326 -t_srs EPSG:31370

 

If I understood correctly what I read on the Internet, thats because Mitab does not recognise « EPSG:31370 » ;

I tried to replace « -t_srs EPSG:31370 » by « -t_srs "31370.txt" » where « 31370.txt » contained the WKT definition of EPSG:31370 ;

I saw in the ogr2ogr documentation that there is a « MITAB_BOUNDS_FILE » parameter but did not find out how to use it (http://www.gdal.org/drv_mitab.html) ;

 

I also searched in « /ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp » to see if « Belgian Lambert 1972 » existed and it does :

 

{ 0,    1019,"Belgian 1972 7 Parameter",   4, -99.059, 53.322, -112.486, -0.419, 0.83, -1.885, 0.999999, 0},

 

So I suppose it should be possible to create a MapInfo file projected in « Belgiam Lambert 1972 » but I do not understand how ?!

 

Any help or idea is welcome !
Thanks a lot !

 

Jonathan Beliën

GEO-6

 


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev



 

--

Richard W. Greenwood, PLS
www.greenwoodmap.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr mapinfo reporjection

Jonathan Beliën-2

Any idea about this topic ?

 

Thanks ! :)

 

Jonathan Beliën

GEO-6

 

De : gdal-dev [mailto:[hidden email]] De la part de Jonathan Beliën
Envoyé : mardi 9 mai 2017 10:21
À : 'GDAL List' <[hidden email]>
Cc : [hidden email]; 'Hellemans, Philippe' <[hidden email]>
Objet : Re: [gdal-dev] ogr2ogr mapinfo reporjection

 

Hello Richard,

 

When I look at the resulting MIF file in a text editor, the coordinates are indeed correctly transformed but the header is

 

CoordSys Earth Projection 3, 104, "m", 4.36748666666667, 90, 51.1666672333333, 49.8333339, 150000.013, 5400088.438

 

instead of

 

CoordSys Earth Projection 3, 1019, "m", 4.3674866667, 90, 49.8333339, 51.1666672333, 150000.01300000001, 5400088.4380000001 Bounds (0, 0) (300000, 300000)

 

Thanks for your help !

 

Jonathan Beliën

GEO-6

 

De : Richard Greenwood [[hidden email]]
Envoyé : mardi 9 mai 2017 01:32
À : Jonathan Beliën <[hidden email]>
Cc : [hidden email]; GDAL List <[hidden email]>; Hellemans, Philippe <[hidden email]>
Objet : Re: [gdal-dev] ogr2ogr mapinfo reporjection

 

When you say that the coordsys header is wrong, are you looking at it in MapInfo or in a text editor? If you look at the MIF file coordinates in a text editor do they look like they have been correctly transformed, and it is just the header that is wrong?

 

On Mon, May 8, 2017 at 7:39 AM, Jonathan Beliën <[hidden email]> wrote:

Hello everyone, 

 

I struggle to reproject GeoJSON file to TAB (or MIF) file.

The source projection is EPSG:4326 and the destination projection is EPSG:31370 (Belge 1972 / Belgian Lambert 72 Belgium : http://epsg.io/31370)

 

I searched forums and mailing lists and saw that there was some issues with reprojection using Mitab but that it is supposed to be fixed.

 

When I try the following command, the coordinates seems to be transformed but the « coordsys » header in the TAB (or MIF) file is wrong (WGS84 Non Earth)

 

ogr2ogr test.mif test.json -f "MapInfo File" -dsco FORMAT=MIF -s_srs EPSG:4326 -t_srs EPSG:31370

 

If I understood correctly what I read on the Internet, thats because Mitab does not recognise « EPSG:31370 » ;

I tried to replace « -t_srs EPSG:31370 » by « -t_srs "31370.txt" » where « 31370.txt » contained the WKT definition of EPSG:31370 ;

I saw in the ogr2ogr documentation that there is a « MITAB_BOUNDS_FILE » parameter but did not find out how to use it (http://www.gdal.org/drv_mitab.html) ;

 

I also searched in « /ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp » to see if « Belgian Lambert 1972 » existed and it does :

 

{ 0,    1019,"Belgian 1972 7 Parameter",   4, -99.059, 53.322, -112.486, -0.419, 0.83, -1.885, 0.999999, 0},

 

So I suppose it should be possible to create a MapInfo file projected in « Belgiam Lambert 1972 » but I do not understand how ?!

 

Any help or idea is welcome !
Thanks a lot !

 

Jonathan Beliën

GEO-6

 


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev



 

--

Richard W. Greenwood, PLS
www.greenwoodmap.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr mapinfo reporjection

rgreenwood
So ogr2ogr is doing the reprojection correctly, but writing the wrong coordinate system string to the resulting MapInfo file. Is that correct? I'm not a developer and I have not looked at the source code, so I am guessing, but there might be a look up table defining the MapInfo coordinate system string for a matching proj4text string. You might look in the source code for that, or you might want to file a ticket.

Best regards,
Rich


On Mon, May 29, 2017 at 2:35 AM, Jonathan Beliën <[hidden email]> wrote:

Any idea about this topic ?

 

Thanks ! :)

 

Jonathan Beliën

GEO-6

 

De : gdal-dev [mailto:[hidden email]] De la part de Jonathan Beliën
Envoyé : mardi 9 mai 2017 10:21
À : 'GDAL List' <[hidden email]>
Cc : [hidden email]; 'Hellemans, Philippe' <[hidden email]>


Objet : Re: [gdal-dev] ogr2ogr mapinfo reporjection

 

Hello Richard,

 

When I look at the resulting MIF file in a text editor, the coordinates are indeed correctly transformed but the header is

 

CoordSys Earth Projection 3, 104, "m", 4.36748666666667, 90, 51.1666672333333, 49.8333339, 150000.013, 5400088.438

 

instead of

 

CoordSys Earth Projection 3, 1019, "m", 4.3674866667, 90, 49.8333339, 51.1666672333, 150000.01300000001, 5400088.4380000001 Bounds (0, 0) (300000, 300000)

 

Thanks for your help !

 

Jonathan Beliën

GEO-6

 

De : Richard Greenwood [[hidden email]]
Envoyé : mardi 9 mai 2017 01:32
À : Jonathan Beliën <[hidden email]>
Cc : [hidden email]; GDAL List <[hidden email]>; Hellemans, Philippe <[hidden email]>
Objet : Re: [gdal-dev] ogr2ogr mapinfo reporjection

 

When you say that the coordsys header is wrong, are you looking at it in MapInfo or in a text editor? If you look at the MIF file coordinates in a text editor do they look like they have been correctly transformed, and it is just the header that is wrong?

 

On Mon, May 8, 2017 at 7:39 AM, Jonathan Beliën <[hidden email]> wrote:

Hello everyone, 

 

I struggle to reproject GeoJSON file to TAB (or MIF) file.

The source projection is EPSG:4326 and the destination projection is EPSG:31370 (Belge 1972 / Belgian Lambert 72 Belgium : http://epsg.io/31370)

 

I searched forums and mailing lists and saw that there was some issues with reprojection using Mitab but that it is supposed to be fixed.

 

When I try the following command, the coordinates seems to be transformed but the « coordsys » header in the TAB (or MIF) file is wrong (WGS84 Non Earth)

 

ogr2ogr test.mif test.json -f "MapInfo File" -dsco FORMAT=MIF -s_srs EPSG:4326 -t_srs EPSG:31370

 

If I understood correctly what I read on the Internet, thats because Mitab does not recognise « EPSG:31370 » ;

I tried to replace « -t_srs EPSG:31370 » by « -t_srs "31370.txt" » where « 31370.txt » contained the WKT definition of EPSG:31370 ;

I saw in the ogr2ogr documentation that there is a « MITAB_BOUNDS_FILE » parameter but did not find out how to use it (http://www.gdal.org/drv_mitab.html) ;

 

I also searched in « /ogr/ogrsf_frmts/mitab/mitab_spatialref.cpp » to see if « Belgian Lambert 1972 » existed and it does :

 

{ 0,    1019,"Belgian 1972 7 Parameter",   4, -99.059, 53.322, -112.486, -0.419, 0.83, -1.885, 0.999999, 0},

 

So I suppose it should be possible to create a MapInfo file projected in « Belgiam Lambert 1972 » but I do not understand how ?!

 

Any help or idea is welcome !
Thanks a lot !

 

Jonathan Beliën

GEO-6

 


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev



 

--

Richard W. Greenwood, PLS
www.greenwoodmap.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev



--
Richard W. Greenwood, PLS
www.greenwoodmap.com

_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: ogr2ogr mapinfo reporjection

Even Rouault-2
In reply to this post by Jonathan Beliën-2

On lundi 29 mai 2017 10:35:36 CEST Jonathan Beliën wrote:

> Any idea about this topic ?

>

 

I've just fixed the issue per

https://trac.osgeo.org/gdal/ticket/6903

where -t_srs EPSG:31370 will now work.

 

You can workaround the issue by using -t_srs belgian72.txt

 

with belgian72.txt content being:

 

PROJCS["Belge 1972 / Belgian Lambert 72",

GEOGCS["Belge 1972",

DATUM["Belgian 1972 7 Parameter",

SPHEROID["International 1924",6378388,297,

AUTHORITY["EPSG","7022"]],

TOWGS84[-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747],

AUTHORITY["EPSG","6313"]],

PRIMEM["Greenwich",0,

AUTHORITY["EPSG","8901"]],

UNIT["degree",0.0174532925199433,

AUTHORITY["EPSG","9122"]],

AUTHORITY["EPSG","4313"]],

PROJECTION["Lambert_Conformal_Conic_2SP"],

PARAMETER["standard_parallel_1",51.16666723333333],

PARAMETER["standard_parallel_2",49.8333339],

PARAMETER["latitude_of_origin",90],

PARAMETER["central_meridian",4.367486666666666],

PARAMETER["false_easting",150000.013],

PARAMETER["false_northing",5400088.438],

UNIT["metre",1,

AUTHORITY["EPSG","9001"]],

AXIS["X",EAST],

AXIS["Y",NORTH],

AUTHORITY["EPSG","31370"]]

 

Which is the output of gdalsrsinfo EPSG:31370 where the DATUM name has been replaced with "Belgian 1972 7 Parameter" instead of the original "Reseau_National_Belge_1972" in EPSG.

Note that MapInfo (or at least MITAB) apparently uses slightly different TOWGS84 coefficients that the ones picked up by GDAL in the EPSG database.

 

Even

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev