public void TestWeatherAlongARouteWithSingapore() { var request = new WeatherData <PointToPointRouteData>(); var route = new PointToPointRouteData(2); route.Waypoints[0].Position = new ServiceCartographic { Altitude = 100, Latitude = 1.353811, Longitude = 103.659532 }; route.Waypoints[0].Time = new DateTimeOffset(2019, 4, 16, 6, 30, 0, 0, new TimeSpan(0)); route.Waypoints[1].Position = new ServiceCartographic { Altitude = 100, Latitude = 1.291218, Longitude = 103.887249 }; route.Waypoints[1].Time = new DateTimeOffset(2019, 4, 16, 8, 0, 0, 0, new TimeSpan(0)); route.OutputSettings.Step = 900; request.Path = route; request.Provider = WeatherProviderType.AviationDotGov; var weather = WeatherServices.GetWeatherAlongARoute(request).Result; Assert.That(weather != null); Assert.That(weather.Count == 4); }
public void TestTerrainAlongPointToPointRoute() { var request = new PointToPointRouteData(2); request.Waypoints[0].Position = new ServiceCartographic { Altitude = 1910, Latitude = 39.0, Longitude = -104.77 }; request.Waypoints[0].Time = new DateTime(2018, 10, 30, 0, 0, 0); request.Waypoints[1].Position = new ServiceCartographic { Altitude = 1910, Latitude = 38.794, Longitude = -105.217755 }; request.Waypoints[1].Time = new DateTime(2018, 10, 30, 1, 0, 0); request.OutputSettings.Step = 20; var result = TerrainServices.GetTerrainHeightsAlongARoute <PointToPointRouteData>(request).Result; Assert.That(result != null); Assert.That(result.Count == 181); Assert.AreEqual(2091.64136f, result[0].TerrainHeightFromMeanSeaLevel); }
public void TestWeatherAlongARouteWithAviationDotGov() { var request = new WeatherData <PointToPointRouteData>(); var route = new PointToPointRouteData(2); route.Waypoints[0].Position = new ServiceCartographic { Altitude = 2000, Latitude = 39.07096, Longitude = -104.78509 }; route.Waypoints[0].Time = new DateTimeOffset(2019, 4, 16, 14, 30, 0, 0, new TimeSpan(0)); route.Waypoints[1].Position = new ServiceCartographic { Altitude = 1800, Latitude = 39.743635, Longitude = -104.607925 }; route.Waypoints[1].Time = new DateTimeOffset(2019, 4, 16, 16, 30, 0, 0, new TimeSpan(0)); route.OutputSettings.Step = 900; request.Path = route; request.Provider = WeatherProviderType.AviationDotGov; var weather = WeatherServices.GetWeatherAlongARoute(request).Result; Assert.That(weather != null); Assert.That(weather.Count == 5); }
public void SolarLightingAlongARoute() { var route = new PointToPointRouteData(); route.Waypoints.Add(new ServiceCartographicWithTime { Position = new ServiceCartographic(39.07096, -75.78509, 600.0), Time = new DateTimeOffset(2014, 03, 25, 18, 30, 0, new TimeSpan(0, 0, 0)) }); route.Waypoints.Add(new ServiceCartographicWithTime { Position = new ServiceCartographic(42.06308, -75.7850, 620.0), Time = new DateTimeOffset(2014, 03, 25, 23, 30, 20, new TimeSpan(0, 0, 0)) }); var solarData = new SolarLightingData <PointToPointRouteData> { Path = route, OutputTimeOffset = -4.0f }; var result = LightingServices.GetLightingAlongARoute(solarData).Result; // setup expected dates, then test var sunset = new DateTimeOffset(2014, 3, 25, 19, 20, 03, 664, new TimeSpan(-4, 0, 0)); Assert.AreEqual(sunset.ToUnixTimeMilliseconds(), result.FlightLightingInfo.Sunset.ToUnixTimeMilliseconds()); Assert.IsFalse(result.SunriseBetweenStartAndEnd); Assert.IsTrue(result.SunsetBetweenStartAndEnd); Assert.AreEqual("Daylight", result.BeginningOfFlightLightingCondition); Assert.AreEqual("CivilTwilight", result.EndOfFlightLightingCondition); }
public void TestPointToPointRouteCartesian() { var request = new PointToPointRouteData(2); request.Waypoints[0].Position = new ServiceCartographic { Altitude = 1910, Latitude = 39.0, Longitude = -104.77 }; request.Waypoints[0].Time = new DateTime(2018, 10, 30, 0, 0, 0); request.Waypoints[1].Position = new ServiceCartographic { Altitude = 1910, Latitude = 38.794, Longitude = -105.217755 }; request.Waypoints[1].Time = new DateTime(2018, 10, 30, 1, 0, 0); request.OutputSettings.Step = 45; request.OutputSettings.CoordinateFormat.Coord = CoordinateRepresentation.XYZ; var result = RouteServices.GetRoute <PointToPointRouteData, ServiceCartesianWithTime>(request).Result; // Tests are here to verify the results are returned and formatted correctly Assert.That(result != null); Assert.That(result.Count == 81); Assert.AreEqual(45, result[1].Time.Second); Assert.AreEqual(-1266242.1907423697, result[1].Position.X); Assert.AreEqual(-4800807.2322983844, result[1].Position.Y); Assert.AreEqual(3993296.4801795725, result[1].Position.Z); }
public void TestPointToPointRouteCartographic() { var request = new PointToPointRouteData(2); request.Waypoints[0].Position = new ServiceCartographic { Altitude = 1910, Latitude = 39.0, Longitude = -104.77 }; request.Waypoints[0].Time = new DateTime(2018, 10, 30, 0, 0, 0); request.Waypoints[1].Position = new ServiceCartographic { Altitude = 1910, Latitude = 38.794, Longitude = -105.217755 }; request.Waypoints[1].Time = new DateTime(2018, 10, 30, 1, 0, 0); request.OutputSettings.Step = 20; var result = RouteServices.GetRoute <PointToPointRouteData, ServiceCartographicWithTime>(request).Result; // Tests are here to verify the results are returned and formatted correctly Assert.That(result != null); Assert.That(result.Count == 181); Assert.That(result[1].Time.Second == 20); Assert.That(result[1].Position.Latitude == 38.9988603381374); Assert.That(result[1].Position.Longitude == -104.77249465959173); Assert.That(result[1].Position.Altitude == 1909.1200208723517); }
public void TestTooManyPoints() { var request = new PointToPointRouteData(2); request.Waypoints[0].Position = new ServiceCartographic { Altitude = 20000, Latitude = 39.07096, Longitude = -104.78509 }; request.Waypoints[0].Time = new DateTime(2014, 02, 10, 10, 30, 0); request.Waypoints[1].Position = new ServiceCartographic { Altitude = 100, Latitude = 42.64541, Longitude = -61.11172 }; request.Waypoints[1].Time = new DateTime(2014, 02, 10, 18, 30, 20); request.OutputSettings.Step = 60; // too many results for a terrain calculation void ErrorFunction() { var result = TerrainServices.GetTerrainHeightsAlongARoute <PointToPointRouteData>(request).Result; } var ex = Assert.Throws <AggregateException>(ErrorFunction); Assert.That(ex.Message.Contains("BadRequest")); }
public void TestWeatherAlongARoute() { var request = new WeatherData <PointToPointRouteData>(); var route = new PointToPointRouteData(2); route.Waypoints[0].Position = new ServiceCartographic { Altitude = 2000, Latitude = 39.07096, Longitude = -104.78509 }; route.Waypoints[0].Time = DateTimeOffset.Now.AddDays(-2); route.Waypoints[1].Position = new ServiceCartographic { Altitude = 1800, Latitude = 39.743635, Longitude = -104.607925 }; route.Waypoints[1].Time = DateTimeOffset.Now.AddDays(-2).AddHours(2.5); route.OutputSettings.Step = 900; request.Path = route; var weather = WeatherServices.GetWeatherAlongARoute(request).Result; Assert.That(weather != null); Assert.That(weather.Count == 7); }
public void TestTerrainAlongPointToPointRoute() { var request = new PointToPointRouteData(2); request.Waypoints[0].Position = new ServiceCartographic { Altitude = 20000, Latitude = 39.07096, Longitude = -104.78509 }; request.Waypoints[0].Time = new DateTime(2014, 02, 10, 10, 30, 0); request.Waypoints[1].Position = new ServiceCartographic { Altitude = 100, Latitude = 42.64541, Longitude = -61.11172 }; request.Waypoints[1].Time = new DateTime(2014, 02, 10, 18, 30, 20); request.OutputSettings.Step = 900; var result = TerrainServices.GetTerrainHeightsAlongARoute <PointToPointRouteData>(request).Result; Assert.That(result != null); Assert.That(result.Count == 34); Assert.AreEqual(2269.87682f, result[0].TerrainHeightFromWgs84); Assert.AreEqual(-16.9748859f, result[0].MeanSeaLevelHeightFromWgs84); Assert.AreEqual(2286.85170f, result[0].TerrainHeightFromMeanSeaLevel); }
public void TestPointToPointRouteFromJson() { var json = "{\"Waypoints\": [{\"Position\": {\"Latitude\": 39.07096,\"Longitude\": -104.78509,\"Altitude\": 2000.0},\"Time\": \"2014-03-25T18:30:00\"},{\"Position\": {\"Latitude\": 39.06308,\"Longitude\": -104.78500,\"Altitude\": 2010.0},\"Time\": \"2014-03-25T18:30:20\"}],\"IncludeWaypointsInRoute\": true,\"OutputSettings\": {\"Step\": 5,\"TimeFormat\": \"Epoch\",\"CoordinateFormat\": {\"Coord\": \"LLA\" }}}"; var request = new PointToPointRouteData(json); // Tests are here to verify the results are returned and formatted correctly Assert.That(request.Waypoints[0].Position.Latitude == 39.07096); Assert.That(request.Waypoints[1].Position.Longitude == -104.78500); Assert.That(request.OutputSettings.Step == 5); }
public void PopulationDensity_AlongARoute() { var routePopData = new RoutePopulationData <IVerifiable>() { PopulationType = PopulationDataType.Count }; var routePath = new PointToPointRouteData() { Waypoints = new List <ServiceCartographicWithTime>(), IncludeWaypointsInRoute = true, OutputSettings = new OutputSettings() { Step = 60, TimeFormat = TimeRepresentation.Epoch, CoordinateFormat = new CoordinateType() { Coord = CoordinateRepresentation.LLA } } }; routePath.Waypoints.Add(new ServiceCartographicWithTime() { Position = new ServiceCartographic(39.07096, -104.78509, 2000.0), Time = DateTimeOffset.Parse("2014-03-25T18:30:00Z") }); routePath.Waypoints.Add(new ServiceCartographicWithTime() { Position = new ServiceCartographic(38.1, -104.785, 1600.0), Time = DateTimeOffset.Parse("2014-03-25T20:30:00Z") }); routePopData.Path = routePath; var routePopResults = PopulationServices.GetPopulationAlongARoute(routePopData).Result; Assert.AreEqual(8088.3678982750444, routePopResults.WeightedMean); // value is # of people along the route (pop count) Assert.AreEqual(7862.6120876669884, routePopResults.Mean); Assert.AreEqual(121, routePopResults.SumOfWeights); Assert.AreEqual(24, routePopResults.Weights.Count); Assert.AreEqual(routePopResults.Weights.Count, routePopResults.PopulationValues.Count); Assert.AreEqual(1581.945556640625, routePopResults.PopulationValues[0]); Assert.AreEqual(41.257167816162109, routePopResults.PopulationValues[routePopResults.PopulationValues.Count - 1]); Assert.AreEqual(4, routePopResults.Weights[0]); Assert.AreEqual(4, routePopResults.Weights[routePopResults.Weights.Count - 1]); }
public void SolarAnglesAlongARoute() { var route = new PointToPointRouteData(); route.Waypoints.Add(new ServiceCartographicWithTime { Position = new ServiceCartographic(39.07096, -75.78509, 2000.0), Time = new DateTimeOffset(2014, 03, 25, 18, 30, 0, new TimeSpan(0, 0, 0)) }); route.Waypoints.Add(new ServiceCartographicWithTime { Position = new ServiceCartographic(39.06308, -75.7850, 2010.0), Time = new DateTimeOffset(2014, 03, 25, 18, 30, 20, new TimeSpan(0, 0, 0)) }); route.OutputSettings.Step = 5; var solarData = new SolarLightingData <PointToPointRouteData> { Path = route, OutputTimeOffset = -4.0f }; var angles = LightingServices.GetSolarAnglesAlongARoute(solarData).Result; Assert.That(angles.Count == 5); // Validated against STK Components var firstAzimuth = 211.51272744968563; var lastAzimuth = 211.63258762262419; var firstElevation = 48.583033190527004; var lastElevation = 48.555909311795077; var firstTime = new DateTimeOffset(2014, 3, 25, 18, 30, 0, new TimeSpan(0, 0, 0)); var lastTime = new DateTimeOffset(2014, 3, 25, 18, 30, 20, new TimeSpan(0, 0, 0)); Assert.AreEqual(firstTime, angles[0].Time); Assert.AreEqual(firstAzimuth, angles[0].Azimuth); Assert.AreEqual(firstElevation, angles[0].Elevation); Assert.AreEqual(lastTime, angles[4].Time); Assert.AreEqual(lastAzimuth, angles[4].Azimuth); Assert.AreEqual(lastElevation, angles[4].Elevation); }