public static OsrmJsonRouteModel GetSimpleRoute(string sourceQuery, string destinationQuery, params Position[] intermediates) { Position source = NominatimAPIHelper.GetPositionForAddress(sourceQuery); Position destination = NominatimAPIHelper.GetPositionForAddress(destinationQuery); Position[] positions = PositionArrayUtils.GetPositionsArray(source, destination, intermediates); return(GetSimpleRoute(positions)); }
public static OsrmJsonRouteModel GetOptimalRoute(Position first, Position last, params Position[] intermediates) { Position[] positions = PositionArrayUtils.GetPositionsArray(first, last, intermediates); string positionsString = StringUtils.GetStringFromPositions(positions); string uri = $"{usedApiUrl}trip/v1/driving/{positionsString}?roundtrip=false&source=first&destination=last&geometries=geojson&overview=full"; string html = HttpProxy.DownloadResource(uri); OsrmJsonRouteModel parsed = JsonConvert.DeserializeObject <OsrmJsonRouteModel>(html); return(parsed); }
public static OsrmJsonRouteModel GetOptimalRoute(Position first, Position last, params Position[] intermediates) { Position[] positions = PositionArrayUtils.GetPositionsArray(first, last, intermediates); string positionsString = StringUtils.GetStringFromPositions(positions); string uri = $"https://api.mapbox.com/optimized-trips/v1/mapbox/driving/{positionsString}?source=first&destination=last&roundtrip=false&access_token={API_KEY}&geometries=geojson&overview=full"; string html = HttpProxy.DownloadResource(uri); OsrmJsonRouteModel parsed = JsonConvert.DeserializeObject <OsrmJsonRouteModel>(html); return(parsed); }