x

Re: C# Control zur Kartendarstellung


Geschrieben von ngt (Gast) am 10. Juni 2015 17:35:55: [flux]

Als Antwort auf: C# Control zur Kartendarstellung geschrieben von ngt (Gast) am 09. Juni 2015 08:32:

So,
und für alle, die auch Probleme damit haben, hier die Lösung:

var␣ctFac␣=␣new␣ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory();
var␣csSrc␣=␣ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84;
var␣csTgt␣=␣ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator;
var␣ct␣=␣ctFac.Create(csSrc,␣csTgt);
var␣ptWebMercator␣=␣ct.MathTransform.Transform(new␣double[]␣{␣8.98079,␣48.55783␣});

für die letzte Zeile kann man auch schreiben:

var␣ptWebMercator␣=␣ct.MathTransform.Transform(new␣GeoAPI.Geometries.Coordinate(8.9831,␣48.5568));

So wandelt man dann GPS-Coordinaten um in eine Projektion, die SharpMap versteht