Exemplo n.º 1
0
        public void CanCalculateDegreesCorrespondingToToleranceInFeet()
        {
            var geometry = DbSpatialHelper.MakeDbGeometryFromCoordinates(120, 45, LtInfoGeometryConfiguration.DefaultCoordinateSystemId);
            var feetPerAverageLatLonDegree = ((MetersPerLatDegreeAt45DegreesNorth + MetersPerLonDegreeAt45DegreesNorth) / 2) * FeetPerMeter;
            var a = DbSpatialHelper.FeetToAverageLatLonDegree(geometry, feetPerAverageLatLonDegree);

            //Check that our calcs match the NWS expected value of 1 degree
            Assert.That(a, Is.InRange(0.9999, 1.0001));

            //Check at 20 degrees North
            geometry = DbSpatialHelper.MakeDbGeometryFromCoordinates(120, 20, LtInfoGeometryConfiguration.DefaultCoordinateSystemId);
            var MetersPerLatDegreeAt20DegreesNorth = 110704.27818646189;
            var MetersPerLonDegreeAt20DegreesNorth = 104647.05311831612;

            feetPerAverageLatLonDegree = ((MetersPerLatDegreeAt20DegreesNorth + MetersPerLonDegreeAt20DegreesNorth) / 2) * FeetPerMeter;
            a = DbSpatialHelper.FeetToAverageLatLonDegree(geometry, feetPerAverageLatLonDegree);
            //Check that our calcs match the NWS expected value of 1 degree
            Assert.That(a, Is.InRange(0.9999, 1.0001));

            //Check at 60 degrees North
            geometry = DbSpatialHelper.MakeDbGeometryFromCoordinates(120, 60, LtInfoGeometryConfiguration.DefaultCoordinateSystemId);
            var MetersPerLatDegreeAt60DegreesNorth = 111412.24020000001;
            var MetersPerLonDegreeAt60DegreesNorth = 55799.979000000014;

            feetPerAverageLatLonDegree = ((MetersPerLatDegreeAt60DegreesNorth + MetersPerLonDegreeAt60DegreesNorth) / 2) * FeetPerMeter;
            a = DbSpatialHelper.FeetToAverageLatLonDegree(geometry, feetPerAverageLatLonDegree);
            //Check that our calcs match the NWS expected value of 1 degree
            Assert.That(a, Is.InRange(0.9999, 1.0001));
        }
Exemplo n.º 2
0
        public void CanCalculateFeetPerDegreeLongitude()
        {
            var geometry         = DbSpatialHelper.MakeDbGeometryFromCoordinates(120, 45, LtInfoGeometryConfiguration.DefaultCoordinateSystemId);
            var feetPerLonDegree = MetersPerLonDegreeAt45DegreesNorth * FeetPerMeter;
            var a = DbSpatialHelper.FeetToLonDegree(geometry, feetPerLonDegree);

            //Check that our calcs match the NWS expected value of 1 degree
            Assert.That(a, Is.InRange(0.9999, 1.0001));
        }
        public void CanCalculateFeetPerDegreeLatitude()
        {
            var geometry         = DbSpatialHelper.MakeDbGeometryFromCoordinates(120, 45, 4326);
            var feetPerLatDegree = MetersPerLatDegreeAt45DegreesNorth * FeetPerMeter;
            var a = DbSpatialHelper.FeetToLatDegree(geometry, feetPerLatDegree);

            //Check that our calcs match the NWS expected value of 1 degree
            Assert.That(a, Is.InRange(0.9999, 1.0001));
        }