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

#21

@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?

#22

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)

#23

@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?

#24

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

2 Likes
#25

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

#26

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

#27

Is OpenStreetMapXSim part of your traffic modelling work?

#28

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

#29

@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!

#30

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.

#31

my2c:

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
#32

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

#33

GPS coordinates - A bounding box.

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

osmium extract --bbox LEFT,BOTTOM,RIGHT,TOP [OPTIONS] OSM-FILE

and:

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
: LONG1,LAT1,LONG2,LAT2
: and this area :
http://geojson.io/#id=gist:ImreSamu/0e92e8be644724ba65028ec296d3fd7b&map=11/48.1501/11.5400

see more:

1 Like
#34

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": [
          12.368545532226562,
          41.794864268833145,
          12.623291015625,
          41.99011884096809
        ]
1 Like