GIScience / openrouteservice-r

:globe_with_meridians: query openrouteservice API from R
https://giscience.github.io/openrouteservice-r/
Apache License 2.0
96 stars 23 forks source link

Local Instance of ORS/VRoom getting 404 using documented options #72

Open fischert00 opened 3 years ago

fischert00 commented 3 years ago

I installed ORS and Vroom locally using Docker in Windows Docker desktop using Powershell. Both of them return 200 status code when checking the health but when I call them via the R package, ORS appears to work (calling ors_directions for instance) but the O=ors_optimization returns a 404. Here is the code for the Docker install and my R code:

ORS: docker run -dt --name ors -p 8080:8080 -v $PWD/graphs:/ors-core/data/graphs -v $PWD/elevation_cache:/ors-core/data/elevation_cache -v $PWD/conf:/ors-conf -e "JAVA_OPTS=-Djava.awt.headless=true -server -XX:TargetSurvivorRatio=75 -XX:SurvivorRatio=64 -XX:MaxTenuringThreshold=3 -XX:+UseG1GC -XX:+ScavengeBeforeFullGC -XX:ParallelGCThreads=4 -Xms1g -Xmx2g" -e "CATALINA_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9001 -Dcom.sun.management.jmxremote.rmi.port=9001 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost" openrouteservice/openrouteservice:latest

VROOM: docker run -dt --name vroom -p 3000:3000 -v $PWD/conf:/conf -e VROOM_ROUTER=ors vroomvrp/vroom-docker:v1.10.0

curl http://host.docker.internal:8080 - Returns statuscode 200

curl http://host.docker.internal:3000/health - returns statuscode 200 as well

http://localhost:8080/ors/health in the edge browser returns {"status":"ready"}

docker port vroom returns: 3000/tcp -> 0.0.0.0:3000 3000/tcp -> :::3000

docker port ors returns: 8080/tcp -> 0.0.0.0:8080 8080/tcp -> :::8080

Here is my R Code:

library(googlePolylines) library(openrouteservice) options(openrouteservice.url = "http://localhost:8080/ors") options(openrouteservice.paths = list(directions = "v2/directions", isochrones = "v2/isochrones", matrix = "v2/matrix", geocode = "geocode", pois = "pois", elevation = "elevation", optimization = "optimization"))

home_base <- data.frame(lon = -93.64601, lat = 41.62767)

vehicles = vehicles( id = 1:3, profile = "driving-car", start = home_base, end = home_base, capacity = 10, time_window = (c(43200, 57600)) )

locations <- list( c(-93.57451, 41.59161), c(-93.57130, 41.58079), c(-93.58744, 41.58646), c(-93.57532, 41.58513), c(-93.56330, 41.58088), c(-93.55686, 41.59055), c(-93.58068, 41.59409), c(-93.54889, 41.63307), c(-93.65483, 41.62888), c(-93.65246, 41.62580), c(-93.65175, 41.63488), c(-93.59358, 41.63204), c(-93.64699, 41.62459), c(-93.64565, 41.62989) )

campCount = c(1920,480,240,720,960,720,2640,240,480,1200,960,720,1680,3360)

jobs = jobs( id = seq.int(1, 14, 1), service = campCount, amount = 1, location = locations )

res <- ors_optimization(jobs, vehicles, options = list(g = TRUE))

This ors_optimization command returns Error: Not Found (HTTP 404).

Are my paths wrong in the Option list? The documentation isn't really clear what these should be when calling your own instance of VROOM/ORS using Docker. Any help is appreciated.

Thanks. Tom...

nilsnolde commented 3 years ago

cross-post of https://github.com/VROOM-Project/vroom-docker/issues/41

also the cause for this (I think): https://github.com/VROOM-Project/vroom-docker/issues/41#issuecomment-886434416

TheGreatRefrigerator commented 3 years ago

@fischert00 Not the maintainer and a bit late, but it might be possible to workaround by leaving the openrouteservice.url as an empty string or http://localhost and specify the full path (or rest of the path) in the path options? If you still have this issue, could you give it a try?