What's the general algorithm to draw a road network of a certain area?

@pszufe, @bennedich, if I’d like to know the position / location of the vehicles on the road map at any given time point, then how to proceed? I figured this might have something to do with the shape of the road for a precise prediction. But if it’s a straight line, then linear interpolation should work, right? Or do you have any suggestions?

you have travel speeds depending on road class and road fragments are straight lines.
So yes interpolation seems OK (unless you want to model queues etc but than it is far more complicated)

@pszufe, a few questions:
(1): without this linear interpolation, is there some other ways to do it?
(2): travel speeds, and road class can be obtained from the osm data, right?
(3): what is “unless you want to model queues etc but than it is far more complicated”? What do you mean
by “queue” here? Is it the traffic queue?

Ad. 1. and Ad.3. You definitely need to do the literature review part of you project - here is a good start https://www.informs-sim.org/wsc17papers/includes/files/052.pdf
Ad.2. Road class - osm data, travel speeds - have a look at speeds.jl file


@pszufe, does the travel speeds change overtime? what’s the idea? Where shall I find documentations?

It’s up to you how you model it.
We are working on an extension where travel speeds changes in reaction to traffic volumes.
Int the end it is a weighted LightGraphs.jl graph and you can have whatever weights you need

Is OpenStreetMapXSim part of your traffic modelling work?

yes but it will be rewritten - you will not be able to use it at its current form

@pszufe, hey, I have an issue here about the .osm file and I hope you can share with me some ideas. The .osm file I got is still big (like 668MB ) after performing the commands recommended from you. I finally tried to draw the map, and a route. It takes a rather long time to draw it. I was wondering, is there anyway to crop the map data (the .osm file) based on the range of the latitude and longitude (I suppose I can get the corresponding ranges from the real data) I have? Looking forward to your reply!

I just found this link: https://help.openstreetmap.org/questions/4791/how-do-i-export-map-of-large-area-in-osm-format. So I thought ( osmosis --rx file="bla.osm" --bbox left=##.## right=##.## top=##.## bottom=##.## --wx file="extracted_city.osm" , where the numeric values are the lat and lon of a bounding box) would solve the above issue I mentioned. but I’m not 100% sure about which latitude and longitude formats are used here. Will dig more about it.


I prefer the osmium tool for preprocessing big osm files.

see osmium-extract - for creating geographical extracts from an OSM file`

in the example : Extract the city of Munich using a bounding box:

osmium extract -b 11.35,48.05,11.73,48.25 germany-latest.osm.pbf \
    -o munich.osm.pbf
1 Like

about the parameters 11.35, 48.05, 11.73, 48.25, , what are these exactly?

GPS coordinates - A bounding box.

in the doc: https://docs.osmcode.org/osmium/latest/osmium-extract.html
this part is relelvant for you:



OPTIONS -b, --bbox=LONG1,LAT1,LONG2,LAT2 Set the bounding box to cut out. Can not be used with --polygon/-p, --config/-c, or --directory/-d. The coordinates LONG1,LAT1 are from one arbitrary corner, the coordinates LONG2,LAT2 are from the opposite corner.

so the 11.35, 48.05, 11.73, 48.25 coordinates - real meaning
: and this area :

see more:

1 Like

You can generate BBOX with many online tools:

One example:

  • go http://geojson.io
  • Draw a rectangle ( around the city )
  • call the menu : “Meta”/"Add bboxes"
  • on the GeoJSON part: you will find the “bbox” coordinates.

like this ( Roma/Italy)

       "bbox": [
1 Like

I needed a more flexible visualization for my current project and found out that folium via PyCall works just great with Julia Jupyter notebooks.
Since there are always many Python-Julia integration issues I wrote a simple quick-start tutorial. I am quite happy with the result and believe many people observing this thread will find it very useful (the link link should be visited with Firefox):