How to convert coordinates from Gauss-Krueger to Longitude/Latitude?

I'm a newbie in the GIS world so please advise me :)

In my .NET/C# project I need to show some shapes/points on the Bing Map. The problem is I have the Gauss-Krueger coordinates and need to convert them to Longitude/Latitude.

Can anyone point me to the right direction please? Is there maybe a free managed library for this purpose? A link with a good explanation of conversion algorithm would be helpful too.

Thanks!

Anil

-

I see you are from Sarajevo so you are probably need to convert GK coordinates from B&H coordinate system. First you will need to get transformation parameters for your area. I don't think there are any good one in EPSG database. Maybe you can use this one. I sometimes use them for area of Croatia. Regarding the C# lib, there is one which I used Proj4Net. Here is one my old example.

``````        CoordinateSystemFactory cFac = new CoordinateSystemFactory();
Wgs84ConversionInfo par = new Wgs84ConversionInfo(514.0188, 155.448, 507.0461, 5.6136, 3.676, -11.4667, 2.091);
IEllipsoid ellipsoid = cFac.CreateEllipsoid("Bessel 1840", 6377397.155, 6356078.963, LinearUnit.Metre);
IHorizontalDatum Bessel1840 = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Classic, ellipsoid, par);
IGeographicCoordinateSystem gcsBessel = cFac.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, Bessel1840, PrimeMeridian.Greenwich,
new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));

System.Collections.Generic.List<ProjectionParameter> parameters6 = new System.Collections.Generic.List<ProjectionParameter>(5);

IProjection projection6 = cFac.CreateProjection("Transverse Mercator", "Transverse_Mercator", parameters6);

IProjectedCoordinateSystem zona6Bessel = cFac.CreateProjectedCoordinateSystem("6 zona Bessel", gcsBessel, projection6, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));
IGeographicCoordinateSystem wgs84 = GeographicCoordinateSystem.WGS84;

CoordinateTransformationFactory ctFac = new CoordinateTransformationFactory();
ICoordinateTransformation zona6ToWGS84 = ctFac.CreateFromCoordinateSystems(zona6Bessel, wgs84);

toPoint = zona6ToWGS84.MathTransform.Transform(fromPoint);
``````

I hope this helps a little. This code was written a long time ago but i think it works. You just have to insert your parameters.

-
Hi Mario! I couldn't find the binaries for Proj4Net, so I downloaded the source code, but I couldn't build it because GeoAPI project (which is supposed to be the part of the solution) is missing. However your code helped me to understand the important parameters related to this conversion and I'll keep it for the reference. Thanks! – Anil Aug 15 '10 at 2:09
There are no binaries for Proj4Net, but you can easily build them from source. GeoAPI is one other project, you can find it here: geoapi.codeplex.com . No problem :) .. I'm glad it helps. – Mario Miler Aug 15 '10 at 8:30

Look into GDAL. For a shapefile, the conversion command will be something like:

ogr2ogr -f "ESRI Shapefile" output.shp -t_srs EPSG:4326 -s_srs EPSG:31468 input.shp

Bindings for GDAL in C#: http://trac.osgeo.org/gdal/wiki/GdalOgrInCsharp

-

If you can perform the transformation client-side, you can take advantage of Proj4JS (user guide) which is a Javascript port of the underlying Proj.4 library.

If you're doing this Server-side there's a C# wrapper for Proj.4 which could also be used. If this is a conversion that doesn't need to be done dynamically, then using GDAL as glennon mentioned is the easiest approach.

If you need to look up an EPSG code, try spatialreference.org.

-

Browsing through all the links you provided finally led me to http://dotspatial.codeplex.com

IMHO I found this one to be the easiest to use (add reference to single assembly DotSpatial.Projections.dll and start using it).

-

this is code example in c# using dotspatial.codeplex.com library

``````using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DotSpatial.Projections;

namespace GKtoWGS84
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
double[] xy = new double[2];
double[] z = new double[1];
ProjectionInfo pStart = new ProjectionInfo("+proj=tmerc +lat_0=0 +lon_0=18 +k=0.9999 +x_0=6500000 +y_0=0 +ellps=bessel +towgs84=550.499,164.116,475.142,5.80967,2.07902,-11.62386,0.99999445824 +units=m");
ProjectionInfo pEnd = KnownCoordinateSystems.Geographic.World.WGS1984;

xy[0] = 6448000;
xy[1] = 4880000;
z[0] = 1;
Reproject.ReprojectPoints(xy, z, pStart, pEnd, 0, 1);
}

}
}
``````

description of gausskruger and MGI Balkans (Bosnian language) http://free-ri.htnet.hr/geocaching/_private/gausskruger.htm

-