Beispiel #1
0
        private static async Task Table5x(Osrm5x osrm)
        {
            var locations = new Location[] {
                new Location(52.517037m, 13.388860m),
                new Location(52.529407m, 13.397634m),
                new Location(52.523219m, 13.428555m)
            };

            //Returns a 3x3 matrix:
            var result = await osrm.Table(locations);

            //Returns a 1x3 matrix:
            var result2 = await osrm.Table(new TableRequest()
            {
                Coordinates = locations,
                Sources     = new uint[] { 0 }
                //Sources = src,
                //DestinationLocations = dst
            });

            //Returns a asymmetric 3x2 matrix with from the polyline encoded locations qikdcB}~dpXkkHz:
            var result3 = await osrm.Table(new TableRequest()
            {
                Coordinates = locations,
                SendCoordinatesAsPolyline = true,
                Sources      = new uint[] { 0, 1 },
                Destinations = new uint[] { 1, 2 }
                //Sources = src,
                //DestinationLocations = dst
            });
        }
Beispiel #2
0
        private static void Table5x(Osrm5x osrm)
        {
            var locations = new Location[] {
                new Location(52.517037, 13.388860),
                new Location(52.529407, 13.397634),
                new Location(52.523219, 13.428555)
            };

            //Returns a 3x3 matrix:
            var result = osrm.Table(locations);

            //Returns a 1x3 matrix:
            var result2 = osrm.Table(new Osrm.Client.Models.TableRequest()
            {
                Coordinates = locations,
                Sources     = new uint[] { 0 }
                //Sources = src,
                //DestinationLocations = dst
            });

            //Returns a asymmetric 3x2 matrix with from the polyline encoded locations qikdcB}~dpXkkHz:
            var result3 = osrm.Table(new Osrm.Client.Models.TableRequest()
            {
                Coordinates = locations,
                SendCoordinatesAsPolyline = true,
                Sources      = new uint[] { 0, 1 },
                Destinations = new uint[] { 1, 2 }
                //Sources = src,
                //DestinationLocations = dst
            });
        }
Beispiel #3
0
        public void Table_Response()
        {
            var locations = new Location[] {
                new Location(52.554070, 13.160621),
                new Location(52.431272, 13.720654),
                new Location(52.554070, 13.720654),
                new Location(52.554070, 13.160621),
            };

            var result = osrm.Table(locations).GetAwaiter().GetResult();

            Assert.AreEqual <string>("Ok", result.Code);
            Assert.AreEqual <int>(4, result.Durations.Length);
            Assert.AreEqual <int>(4, result.Durations[0].Length);
            Assert.AreEqual <int>(4, result.Durations[1].Length);
            Assert.AreEqual <int>(4, result.Durations[2].Length);
            Assert.AreEqual <int>(4, result.Durations[3].Length);

            var srcAndDests = new Location[] {
                new Location(52.554070, 13.160621),
                new Location(52.431272, 13.720654),
                new Location(52.554070, 13.720654),
                new Location(52.554070, 13.160621),
            };

            var result2 = osrm.Table(new TableRequest()
            {
                Coordinates  = srcAndDests,
                Sources      = new uint[] { 0 },
                Destinations = new uint[] { 1, 2, 3 }
            }).GetAwaiter().GetResult();

            Assert.AreEqual <string>("Ok", result.Code);
            Assert.AreEqual <int>(1, result2.Durations.Length);
            Assert.AreEqual <int>(3, result2.Durations[0].Length);
        }