OGR2OGR custom coordinate conversion


Hi All,
I’m trying to convert coordinates using OGR2OGR function. As a bstrOptions, I use following string:

“-s_srs “”+proj=krovak +lat_0=49.5 +lon_0=24.83333333333333 +alpha=30.28813972222222 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel +towgs84=559.0,68.7,451.5,7.920,4.073,4.251,5.71"” -t_srs ““EPSG:4326"” -f CSV -lco ““GEOMETRY=AS_WKT”””

My input file (points.csv.vrt) is following:


This file is followed by standard CSV file - for instance:

Such setup works when using GDAL utility but unfortunately, it does not work in MapWinGIS. My output file contains only the following string:

Do you have any suggestion of what I’m doing wrong?

Thank you very much in advance,


I see that some part of my text is missing…
My input file (points.csv.vrt):

        <OGRVRTLayer name="points">
            <GeometryField encoding="PointFromColumns" x="X" y="Y"/>



Hi Jiri,

Can you show the MapWinGIS code you’re using?
And show the ogr2ogr command parameters so we can try to reproduce.


Hi Paul,
my code snippet:

Dim sOpt As String = "-s_srs ""+proj=krovak +lat_0=49.5 +lon_0=24.83333333333333 +alpha=30.28813972222222 +k=0.9999 +x_0=0 +y_0=0 +ellps=bessel " _
                 & "+towgs84=559.0,68.7,451.5,7.920,4.073,4.251,5.71"" -t_srs ""EPSG:4326"" -f CSV -lco ""GEOMETRY=AS_WKT"""
Dim o As New Utils
myStatusLabel.Text = o.OGR2OGR(sInFile, sOutFile, sOpt, Nothing)

Thank you,


The documentation of Utils.OGR2OGR() show this is a deprecated function and it is better to use GdalUtils.GdalVectorTranslate()
The difference between the functions is that ogr2ogr is a custom implementation within MapWinGIS of this GDAL function and the new method is just sending the commands to GDAL and let GDAL handle this.

Could you rewrite your method to use GdalVectorTranslate()?


I use version (GdalUtils class is not involved in this version). I’m not sure whether I can upgrade as I already distributed my app among number of colleges.


Since Utils.OGR2OGR() is only a partial implementation I doubt you will get the coordinate conversion working with it.
That is one of the reasons we implemented GdalVectorTranslate().

A workaround might be to create an in-memory point shapefile assign the correct projection and add the coordinate as a point and reproject the shapefile to the new projection and read the coordinates back.
Useful documentation:

Let us know if this is working for you. If needed I can provide some sample code.


Can I parametrize such re-projection? I need to apply my own transformation.


The GeoProjection class has several Import methods like ImportFromWKT() and ImportFromProj4()

I see now the GeoProjection class also has a Transform() method, which transforms a single point. Internally it is using OGRCoordinateTransformation.
I think that is what you are looking for, right?


Yes, it’s exactly what I was looking for. This way is even better than OGR2OGR solution.
Thank you very much,


You’re welcome.

I’m closing this issue.

closed #12