diff --git a/GeoUK/Coordinates/EastingNorthing.cs b/GeoUK/Coordinates/EastingNorthing.cs index e229b7c..4eefbef 100644 --- a/GeoUK/Coordinates/EastingNorthing.cs +++ b/GeoUK/Coordinates/EastingNorthing.cs @@ -1,3 +1,6 @@ +using GeoUK.Ellipsoids; +using GeoUK.Projections; + namespace GeoUK.Coordinates { /// @@ -62,5 +65,19 @@ public double DistanceTo(EastingNorthing toEastingNorthing) double deltaHeight = toEastingNorthing.Height - Height; return System.Math.Sqrt(horizontal * horizontal + deltaHeight * deltaHeight); } + + /// + /// Creates a object from latitude and longitude coordinates. + /// + /// + /// + /// + public static EastingNorthing FromLatitudeLongitude(double latitude, double longitude) + { + Cartesian cartesian = Convert.ToCartesian(new Wgs84(), new LatitudeLongitude(latitude, longitude)); + Cartesian bngCartesian = Transform.Etrs89ToOsgb36(cartesian); + + return Convert.ToEastingNorthing(new Airy1830(), new BritishNationalGrid(), bngCartesian); + } } } \ No newline at end of file