public static void Example()
        {
            Console.WriteLine("-- Easting/ Nothing to Latitude Longitude --");
            // Given an easting and northing in metres (see text)
            const double easting  = 319267;
            const double northing = 175189;

            Console.WriteLine("INPUT");
            Console.WriteLine($"Easting: {easting}");
            Console.WriteLine($"Northing: {northing}");

            // Convert to Cartesian
            Cartesian cartesian = Convert.ToCartesian(new Airy1830(),
                                                      new BritishNationalGrid(),
                                                      new EastingNorthing(easting, northing));

            Cartesian wgsCartesian = Transform.Osgb36ToEtrs89(cartesian); //ETRS89 is effectively WGS84

            LatitudeLongitude wgsLatLong = Convert.ToLatitudeLongitude(new Wgs84(), wgsCartesian);

            Console.WriteLine("OUTPUT");
            Console.WriteLine($"Latitude: {wgsLatLong.Latitude}");
            Console.WriteLine($"Longitude: {wgsLatLong.Longitude}");
            Console.WriteLine();
        }
예제 #2
0
        public static void Example()
        {
            Console.WriteLine("-- Latitude/ Longitude to Easting/ Northing --");
            LatitudeLongitude latLong = new LatitudeLongitude(51.469886, -3.1636964);

            Console.WriteLine("INPUT");
            Console.WriteLine($"Latitude: {latLong.Latitude}");
            Console.WriteLine($"Longitude: {latLong.Longitude}");

            Cartesian       cartesian    = Convert.ToCartesian(new Wgs84(), latLong);
            Cartesian       bngCartesian = Transform.Etrs89ToOsgb36(cartesian);
            EastingNorthing bngEN        = Convert.ToEastingNorthing(new Airy1830(), new BritishNationalGrid(), bngCartesian);

            Console.WriteLine("OUTPUT");
            Console.WriteLine($"Easting: {bngEN.Easting}");
            Console.WriteLine($"Northing: {bngEN.Northing}");
            Console.WriteLine();
        }