Example #1
0
        public async Task <FireDangerResponse> NearestFire([FromBody] GeoCoordinate geoCoordinate)
        {
            var closestReport = await _fireReport.GetClosestFireReport(geoCoordinate);

            if (closestReport == null)
            {
                return(new FireDangerResponse()
                {
                    IsSafe = true
                });
            }
            var dis = closestReport.Coordinates.GetDistanceTo(geoCoordinate);

            return(new FireDangerResponse()
            {
                IsSafe = IsSafe(geoCoordinate, closestReport),
                ClosestFireInKm = dis,
                HeadingDegrees = geoCoordinate.GetDegrees(closestReport.Coordinates),
                HeadingString = geoCoordinate.GetDegrees(closestReport.Coordinates).WindDegreesToDirectionString(),
                FireReport = closestReport
            });
        }