U-Shift / biclar

Strategic cycle network planning tools, evidence and reproducible code
https://u-shift.github.io/biclar/
GNU Affero General Public License v3.0
4 stars 3 forks source link

Batch routing #19

Closed temospena closed 2 years ago

temospena commented 2 years ago

Testing the cyclestreets::batch() function

Do we need a special API for this, or does the regular one is ok?

temospena commented 2 years ago

https://github.com/U-Shift/biclar/commit/b5966d87a06530df2dade8d5ace3864ef84c7d5f Test with 100 jittered od pairs. 10 minutes taken, and still waiting.

temospena commented 2 years ago

image The script didn't work for 100 pairs. Any clue, @Robinlovelace ?

temospena commented 2 years ago

still not working after 5min waiting, for 10 desire lines

Robinlovelace commented 2 years ago

I'll message you about this Rosa...

Robinlovelace commented 2 years ago

Heads-up @mvl22, any ideas of the cause?

mvl22 commented 2 years ago

Robin, as I briefly mentioned, it’s not a good idea to have server 21 as the default for a public package, as that is dedicated to your own project. It’s not enabled for general users. Please change the package default to 1 as per the API documentation.

temospena commented 2 years ago
od_jittered_100 = readRDS(url("https://github.com/U-Shift/biclar/releases/download/0.0.1/od_all_jittered_100.Rds"))

od_jittered_test = od_jittered_100 %>% slice_sample(n = 10)
od_jittered_test$id = 1:nrow(od_jittered_test)
plot(od_jittered_test$geometry, lwd = 0.1)

routes_jittered = batch(od_jittered_test,
                        name = "biclar test",
                        strategies = "fastest", #or quietest
                        minDistance = 200,
                        maxDistance = 10000, #change here the assumed max euclidean distance
                        filename = "biclar_test",
                        includeJsonOutput = 1, #0 - only summary info like time and dist
                        # emailOnCompletion = "temospena@gmail.com",
                        username = "temospena",
                        password = Sys.getenv("CYCLESTREETS_PW"), #pw for CS account
                        # base_url = "https://api.cyclestreets.net/v2/batchroutes.createjob",
                        # id = 326, #number of job id 326
                        # id = "id",
                        pat = Sys.getenv("CYCLESTREETS"), #API key from CS for this project
                        serverId = 1
)

POSTing the request to create and start the job Job id: 331 Waiting to request the data for 30.5 seconds. Sending data, wait... Routing not complete No data returned yet. Trying again id 331 every 10 seconds 1 minutes taken, waiting another 10 s Sending data, wait... Routing not complete 1 minutes taken, waiting another 10 s Sending data, wait... [...] 5 minutes taken, waiting another 10 s Sending data, wait... [...] #then I canceled it... Error in curl::curl_fetch_memory(url, handle = handle) : Operation was aborted by an application callback

Although the job was completed and results were ready here:

https://www.cyclestreets.net/journey/batch/331/

temospena commented 2 years ago

we made routing with jittering (threshold = 100, instead of 500), for one-way, and both ways, with quietest and fastest. see batch_CycleStreets.R

We need a way to read the .gz files as routes!