using ProjNet.CoordinateSystems;
using ProjNet.CoordinateSystems.Transformations;
public class GeoCoordinateConverter
private readonly CoordinateSystemFactory _coordinateSystemFactory;
private readonly CoordinateTransformationFactory _coordinateTransformationFactory;
public GeoCoordinateConverter()
_coordinateSystemFactory = new CoordinateSystemFactory();
_coordinateTransformationFactory = new CoordinateTransformationFactory();
public double[] ConvertLatLonToPlaneRectangular(double lat, double lon)
var wgs84 = _coordinateSystemFactory.CreateFromWkt(
"GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\"," +
"SPHEROID[\"WGS_1984\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0]," +
"UNIT[\"Degree\",0.0174532925199433]]");
var prcs7 = _coordinateSystemFactory.CreateFromWkt(
"PROJCS[\"JGD2000 / Japan Plane Rectangular CS VII\"," +
"GEOGCS[\"JGD2000\",DATUM[\"Japanese_Geodetic_Datum_2000\"," +
"SPHEROID[\"GRS 1980\",6378137,298.257222101],TOWGS84[0,0,0,0,0,0,0]]," +
"PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]]," +
"PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",22]," +
"PARAMETER[\"central_meridian\",136],PARAMETER[\"scale_factor\",0.9999]," +
"PARAMETER[\"false_easting\",0],PARAMETER[\"false_northing\",0]," +
"UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]]]");
var transform = _coordinateTransformationFactory.CreateFromCoordinateSystems(
var converted = transform.MathTransform.Transform(new[] { lon, lat });
public static void Main(string[] args)
GeoCoordinateConverter converter = new GeoCoordinateConverter();
double lat = 35.696543562047744;
double lon = 139.78738890030908;
double[] converted = converter.ConvertLatLonToPlaneRectangular(lat, lon);
Console.WriteLine("Converted coordinates: X={0}, Y={1}", converted[0], converted[1]);