public void GetByDistanceTest()
        {
            var distance = 75.0;
            var marker   = new Models.LatLng(55.708916, 12.483776);

            List <BandLogic> bands = bandController.Get("", distance, marker.Latitude, marker.Longitude);

            #region Assert
            Assert.AreEqual(1, bands.Count);
            Assert.AreEqual("LaLaLa", bands[0].Name);
            #endregion
        }
Example #2
0
        public override void FromWgs84(Models.LatLng wgs84Position)
        {
            var latitude  = wgs84Position.Latitude * Math.PI / 180.0;
            var longitude = wgs84Position.Longitude * Math.PI / 180.0;

            double a = 6377563.396, b = 6356256.910; // Airy 1830 major & minor semi-axes
            double F0 = 0.9996012717;                // NatGrid scale factor on central meridian
            double lat0 = 49.0 * Math.PI / 180.0;
            double lon0 = -2.0 * Math.PI / 180.0;    // NatGrid true origin
            double N0 = -100000.0, E0 = 400000.0;    // northing & easting of true origin, metres
            double e2 = 1 - (b * b) / (a * a);       // eccentricity squared
            double n = (a - b) / (a + b), n2 = n * n, n3 = n * n * n;

            double cosLat = Math.Cos(latitude), sinLat = Math.Sin(latitude);
            double nu  = a * F0 / Math.Sqrt(1.0 - e2 * sinLat * sinLat);                  // transverse radius of curvature
            double rho = a * F0 * (1.0 - e2) / Math.Pow(1.0 - e2 * sinLat * sinLat, 1.5); // meridional radius of curvature

            double eta2 = nu / rho - 1.0;

            double Ma = (1.0 + n + (5.0 / 4.0) * n2 + (5.0 / 4.0) * n3) * (latitude - lat0);
            double Mb = (3.0 * n + 3.0 * n * n + (21.0 / 8.0) * n3) * Math.Sin(latitude - lat0) * Math.Cos(latitude + lat0);
            double Mc = ((15.0 / 8.0) * n2 + (15.0 / 8.0) * n3) * Math.Sin(2.0 * (latitude - lat0)) * Math.Cos(2.0 * (latitude + lat0));
            double Md = (35.0 / 24.0) * n3 * Math.Sin(3.0 * (latitude - lat0)) * Math.Cos(3.0 * (latitude + lat0));
            double M  = b * F0 * (Ma - Mb + Mc - Md); // meridional arc

            double cos3lat = cosLat * cosLat * cosLat;
            double cos5lat = cos3lat * cosLat * cosLat;
            double tan2lat = Math.Tan(latitude) * Math.Tan(latitude);
            double tan4lat = tan2lat * tan2lat;

            double I    = M + N0;
            double II   = (nu / 2.0) * sinLat * cosLat;
            double III  = (nu / 24.0) * sinLat * cos3lat * (5.0 - tan2lat + 9.0 * eta2);
            double IIIA = (nu / 720.0) * sinLat * cos5lat * (61.0 - 58.0 * tan2lat + tan4lat);
            double IV   = nu * cosLat;
            double V    = (nu / 6.0) * cos3lat * (nu / rho - tan2lat);
            double VI   = (nu / 120.0) * cos5lat * (5.0 - 18.0 * tan2lat + tan4lat + 14.0 * eta2 - 58.0 * tan2lat * eta2);

            double dLon = longitude - lon0;
            double dLon2 = dLon * dLon, dLon3 = dLon2 * dLon, dLon4 = dLon3 * dLon, dLon5 = dLon4 * dLon, dLon6 = dLon5 * dLon;

            double N = Math.Round(I + II * dLon2 + III * dLon4 + IIIA * dLon6, 0);
            double E = Math.Round(E0 + IV * dLon + V * dLon3 + VI * dLon5, 0);

            Datum = new Grid
            {
                Northing = (int)N,
                Easting  = (int)E
            };
        }
Example #3
0
        public override void FromWgs84(Models.LatLng wgs84Position)
        {
            if (outOfChina(wgs84Position.Latitude, wgs84Position.Longitude))
            {
                _inheritedDatum = Math.Round(wgs84Position.Latitude, Precision).ToString(CultureInfo.InvariantCulture) + "," +
                                  Math.Round(wgs84Position.Longitude, Precision).ToString(CultureInfo.InvariantCulture);
                return;
            }

            var d = delta(wgs84Position.Latitude, wgs84Position.Longitude);

            _inheritedDatum = Math.Round(wgs84Position.Latitude + d.Latitude, Precision).ToString(CultureInfo.InvariantCulture) + "," +
                              Math.Round(wgs84Position.Longitude + d.Longitude, Precision).ToString(CultureInfo.InvariantCulture);
        }
Example #4
0
 public override void FromWgs84(Models.LatLng wgs84Position)
 {
     throw new NotImplementedException();
 }
Example #5
0
 public Wgs84(Models.LatLng wgs84Position)
 {
     FromWgs84(wgs84Position);
 }
Example #6
0
 public override void FromWgs84(Models.LatLng wgs84Position)
 {
     _inheritedDatum = Math.Round(wgs84Position.Latitude, Precision).ToString(CultureInfo.InvariantCulture) + "," +
                       Math.Round(wgs84Position.Longitude, Precision).ToString(CultureInfo.InvariantCulture);
 }
Example #7
0
 public S2Geometry(Models.LatLng wgs84Position)
 {
     FromWgs84(wgs84Position);
 }
Example #8
0
 public Osgb36(Models.LatLng wgs84Position)
 {
     FromWgs84(wgs84Position);
 }
Example #9
0
 public override void FromWgs84(Models.LatLng wgs84Position)
 {
     Datum = wgs84Position;
 }