I’m doing a project, part of which requires to simulate the transportation on the map of a certain area. After searching from the internet, I found the following two links related to map data simulation/visualisation.
I was wondering, are there useful updates as it’s already 2019. The other option is to write the code using Python and then execute these code using Julia. I, of course, really enjoy Julia and would like to see if it’s possible to do everything in Julia. Any comments are greatly appreciated.
I tried the two packages. They work really well. The only thing is, it takes a huge long time to run. I think it’s because of the huge size of the input Open Street Map (.osm) file, which is like 1.5 GB. (“crying…”) Is there a better way?
@bsnyh use the OSMFilter (Osmfilter - OpenStreetMap Wiki) utility to filter out unnecessary information from the .osm file (there is really lot to filter out like contributor name or not-road-related data).
Moreover, note the loading time is long only for the first time. With the default settings the OpenStreetMapX creates a *.osm.cache file that keeps a copy of the Julia object representing the map (using the serialization mechanism).
This library is currently under further development and you are welcome to comment/propose features.
@pszufe, thank you so much for your help. I plan to do some animations in the above generated image, like the movement of a car etc, and maybe show some nodes/points of interest, and show the selected route. Do you have good recommendations? I did not do much with the code. Just plug in the input file and call two functions. will paste the code here soon.
use OpenStreetMapX to process data required for animations (nodes, lattitudes, longitutdes) and use a seperate library such as leafletjs for vizualization. The problem is that LeafletJS.jl seems to be unmaintaned. However leafletjs works like a charm from R and there is no problem with working with the OpenStreetMap nodedis
The second approach could be more robust but seems to require development export.
Note on sharing the OSM file: go to https://www.openstreetmap.org/ , click “Manually select the different area” and now on the “Overpass API” link right click and select “Copy link location”. Another option is just uploading the OSM file somewhere (e.g. to GitHub pages).
@pszufe, thank you so much. Please see the following link for the .osm file. part of the .osm file · Issue #1 · bsnyh/osm · GitHub test.osm. I have tried to convert / delete some not useful information from the original .osm file.
test.zip is the zip version of a part of the .osm file I got finally after conversion. Thank you again. If you know a good way to get only the road-related information from the file, please let me know.
Your test.osm file is not readable (the contents seems to be corrupted)
You should test your osmfilter command on some smaller files and find a set of parameters that work. Check the filtered output files on some external software such JOSM (your osm file cannot be opened by JOSM).
Here is a sample osmfilter command: osmfilter mymap.osm --keep="highway=motorway highway=motorway_link highway=trunk highway=trunk_link highway=primary highway=primary_link highway=secondary highway=secondary_link highway=tertiary highway=tertiary_link" -o=mymap.osm
Once you find a set of osmfileter parameters that seems perfect for routing (for your case) - paste it here so others can see it.
Last, but not least - it would be better if you could describe a set of repeatable steps (starting from the export link described by my previous post) rather than using your own files. It seems that there might be problems that your data does not conform to the OSM standard and it is not a Julia-related issue (and probably might need a discussion on OSM forum).