/// <summary>
        /// Converts northing and easting coordinates into Longitude/Latitude coordinates in the WGS84 coordinate system.
        /// </summary>
        /// <param name="northing">northing coordinate</param>
        /// <param name="easting">easting coordinate</param>
        /// <returns>converted coordinates</returns>
        protected PolarGeoCoordinate ConvertToLonLat(double northing, double easting)
        {
            // Use GeoCoordConversion DLL to convert the Eastings & Northings to Lon/Lat
            // coordinates in the WGS84 system. The DLL was pulled from: http://code.google.com/p/geocoordconversion/
            // and is available under the GNU General Public License v3: http://www.gnu.org/licenses/gpl.html
            GridReference      gridRef    = new GridReference((long)easting, (long)northing);
            PolarGeoCoordinate polarCoord = GridReference.ChangeToPolarGeo(gridRef);

            return(PolarGeoCoordinate.ChangeCoordinateSystem(polarCoord, CoordinateSystems.WGS84));
        }
Example #2
0
        public void TestOSGB36ToWGS84()
        {
            StringBuilder sb = new StringBuilder();

            foreach (GeoTestDataSet item in testData)
            {
                PolarGeoCoordinate converted = PolarGeoCoordinate.ChangeCoordinateSystem(item.OSGB36, CoordinateSystems.WGS84);

                if (!item.WGS84.IsTheSameAs(converted, true, true))
                {
                    sb.AppendLine(item.City);
                }
            }

            if (sb.Length > 0)
            {
                sb.AppendLine("failed out of" + testData.Count.ToString());
                Assert.Fail(sb.ToString());
            }
        }
Example #3
0
        public void TestWGS84ToOSGB36TestOSGB36ToWGS84()
        {
            var sb = new StringBuilder();

            foreach (GeoTestDataSet item in TestData)
            {
                PolarGeoCoordinate converted = PolarGeoCoordinate.ChangeCoordinateSystem(
                    item.WGS84, CoordinateSystems.OSGB36);

                if (!item.OSGB36.IsTheSameAs(converted, true, true))
                {
                    sb.AppendLine(item.City);
                }
            }

            if (sb.Length > 0)
            {
                sb.AppendLine("failed out of" + TestData.Count.ToString(CultureInfo.InvariantCulture));
                Assert.Fail(sb.ToString());
            }
        }