Exemplo n.º 1
0
        public void OnGet(int catchmentId)
        {
            ViewData["Copyright"]       = "Jeremy Fox";
            ViewData["Acknowledgement"] = "Acknowledgement: Data from the UK National River Flow Archive";
            Catchment = db.FehappGaugedcatchment
                        .Where(c => c.Catchment == catchmentId)
                        .Include(c => c.FehappAmaxdata)
                        .SingleOrDefault();
            jsonAmax = JsonData(Catchment);
            CoordinateConvert convertor = new CoordinateConvert();

            //multiplying by 100 to add trailing zeros and make into 6 figure grid refs
            CatchmentLat = convertor.GeoUKConvert(Convert.ToDouble(Catchment.NomNgre * 100), Convert.ToDouble(Catchment.NomNgrn * 100)).latitude;
            CatchmentLon = convertor.GeoUKConvert(Convert.ToDouble(Catchment.NomNgre * 100), Convert.ToDouble(Catchment.NomNgrn * 100)).longitude;
            MapsKey      = Configuration["BingMapsKey"];
        }
Exemplo n.º 2
0
        public void ConvertGBNGRToLatLonTest()
        {
            var convert = new CoordinateConvert();
            var latLon  = convert.GeoUKConvert(338595, 652173);
            //converted and rounded due to only having these OS NGR to lat lon 6 decimal places
            //the method returns lat lon to much higher precision
            decimal lat = decimal.Round((decimal)latLon.latitude, 6);
            decimal lon = decimal.Round((decimal)latLon.longitude, 6);

            Assert.AreEqual(lat, 55.758998M);
            Assert.AreEqual(lon, -2.980038M);
        }