示例#1
0
文件: ORS.cs 项目: rowanclarke/nea
        public static async Task <DirectionResponse> GetGeometry(Core.Route route)
        {
            string responseString = await UseORS("/v2/directions/driving-car/geojson", $"{{\"coordinates\":{route.Locations()},\"instructions\":\"false\"}}");

            DirectionResponse responseData = JsonSerializer.Deserialize <DirectionResponse>(responseString);

            return(responseData);
        }
示例#2
0
        public Core.GeoRoute GetGeoRoute(Core.RoutePackage task)
        {
            RemoteWorker worker = new RemoteWorker();

            ORS.MatrixResponse matrixResponse = ORS.ORS.GetMatrix(task).Result;
            task.matrix = new Core.AdjacencyMatrix(matrixResponse.ToFloat());
            Core.Route route = worker.GetRouteSubgraph(task);

            ORS.DirectionResponse directionResponse = ORS.ORS.GetGeometry(route).Result;

            Core.GeoRoute geoRoute = new Core.GeoRoute(route, directionResponse.features[0].geometry.ToFloat());

            return(geoRoute);
        }