Created
December 18, 2018 09:15
-
-
Save bertt/ee763a2d031819342d5a2b376455f2ec to your computer and use it in GitHub Desktop.
Conversion WGS84 (4326) <-> RD (28992)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using DotSpatial.Projections; | |
using System; | |
namespace ConsoleApp1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var longitude = 5.11995; | |
var latitude = 52.092203; | |
Console.WriteLine("Test program conversion RD (28992) -> 4326"); | |
Console.WriteLine($"Input 4326: {longitude},{latitude}"); | |
var src = ProjectionInfo.FromEpsgCode(4326); | |
var target = ProjectionInfo.FromEpsgCode(28992); | |
var points = new double[] { longitude, latitude}; | |
var z = new double[] { 0 }; | |
// 4326 -> 28992 | |
Reproject.ReprojectPoints(points, z, src, target, 0, 1); | |
Console.WriteLine($"Output 28992: {points[0]},{points[1]}"); | |
// 28992 -> 4326 | |
Reproject.ReprojectPoints(points, z, target, src, 0, 1); | |
Console.WriteLine($"Output 4326: {points[0]},{points[1]}"); | |
Console.WriteLine("Press any key to continue..."); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment