Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying max car speed #289

Open
ACalleros opened this issue Jul 20, 2022 · 13 comments
Open

Modifying max car speed #289

ACalleros opened this issue Jul 20, 2022 · 13 comments
Assignees
Labels
enhancement New feature or request

Comments

@ACalleros
Copy link

Hello, we're trying to calculate accesibility accouting for traffic congestions but we haven't found a way to limit car speed. Do you have any suggestions?

@rafapereirabr
Copy link
Member

rafapereirabr commented Jul 20, 2022

Unfortunately, there is currently no way to change the car speeds of road segments from within R. Although you could probably do that by editing the osm.pbf file using other programs

@ACalleros
Copy link
Author

I tried editing the .pbf with R, wrote the shapefile, loaded it into JOSM and writing the modified pbf file, but all the other_tags field is lost. Do you have any advice on this?

@rafapereirabr
Copy link
Member

I don't think it's possible to edit / save osm.pbf data in R, but I might be missing something here. Perhaps osmosis would be the way forward for what you'd like to do but I'm not entirely sure

@mvpsaraiva
Copy link
Collaborator

Hi @ACalleros. Sorry about the late response, I've just seen this issue now.
I took a quick look at R5's code, and I believe there's a way we can implement this feature. I'll try it later, once we complete some of our priorities.

@mvpsaraiva mvpsaraiva self-assigned this Jul 28, 2022
@mvpsaraiva mvpsaraiva added the enhancement New feature or request label Jul 28, 2022
@ACalleros
Copy link
Author

I followed @rafapereirabr advice and I imported the OSM file to R, created a column called maxspeed:motorcar and assigned random values between 1 and 5 as a proof of concept, wrote the file as a geojson, created a modified .osm.pbf file with JOSM and used it to route with R5R. It worked, here's a quick density plot showing travel time values between the original and the modified osm files.

image

@mvpsaraiva
Copy link
Collaborator

It's great that you managed to make it work! But stay tuned, we'll let you know once we have a simpler way to achieve this natively through r5r.

@rafapereirabr
Copy link
Member

@ACalleros , could you please share the code you used in your exercise above ?

@ACalleros
Copy link
Author

@rafapereirabr yes, I'm having issues generating the pbf files, I'll try to sort it out and share all the needed steps to reproduce it.

@rafapereirabr
Copy link
Member

Apparently, it would also be possible to modify car speeds using a geojson polygon. See R5 documenation here.

@ACalleros
Copy link
Author

@rafapereirabr Hi, Rafa. I've been trying unsuccesfully to generate the osm file. I'm not really sure why it is happening. Do you know any tool besides JOSM that I can use to generate a pbf file from a geojson?

@rafapereirabr
Copy link
Member

I followed @rafapereirabr advice and I imported the OSM file to R, created a column called maxspeed:motorcar and assigned random values between 1 and 5 as a proof of concept, wrote the file as a geojson, created a modified .osm.pbf file with JOSM and used it to route with R5R. It worked, here's a quick density plot showing travel time values between the original and the modified osm files.

image

Hi @ACalleros . I thought you said you had been successful before in creating a modified .osm.pbf file with JOSM. What has changed?

@ACalleros
Copy link
Author

ACalleros commented Oct 6, 2023

I did, here are the results, I don't know if there's an issue with latest JOSM versions, but every time I try to create a pbf file it ends up with no geometries.

@rafapereirabr
Copy link
Member

As reported by @mvpsaraiva on @290: Since the street_network_to_sf() includes detailed info on the road network, it might be possible to:

  • "allow users to modify the edges data.frame in any way they want, such as changing driving speeds, street classes, LTS, or if streets allow walking, driving and cycling (they can already do that, we just need to document it so it's done safely)"
  • "create a new function to read the modified edges data.frame and apply the changes back to R5's network (we need to decide if those changes will only be stored in memory during the R session or if we'll allow them to be 'permanently baked' into the network.dat)"

If there are any potential contributors who know Java and who might want to have a look at this, we would appreciate PR from collaborators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants