What is the relation between cropping a .osm file by osmium cat and the crop! function provided in OpenStreetMapX package?

I’m confused by the two cropping operations as mentioned in the title. My goal is to obtain the roadnetwork of a certain area using open street map data.
Reference link: What's the general algorithm to draw a road network of a certain area?
I download the .osm.pbf file, say a.osm.pbf from https://www.geofabrik.de/data/download.html, and then using command osmium extract --bbox 10,10,40,40 a.osm.pbf -o b.osm.pbf to extract or crop the file based on the bbox given by the four parameters. Then, I used osmium cat b.osm.pbf -o c.osm to transfer the .osm.pbf file into a different format .osm. I also have the a.osm file obtained from command osmium cat a.osm.pbf -o a.osm. The file a.osm has size roughly 600MB, while the c.osm has size roughly 100MB.

When I use c.osm with my code, during the function call get_map_data, I realized that there is the other function OpenStreetMapX.crop!(osmdata, crop_relations = false). I understand that the purpose of this function is to crop the nodes, ways, relations based on a given bounds. But I have already crop / extract based on a known bbox already using osmium commands. So I do not need this operation. Am I missing something or ? The other small/side question is, what is the relation between nodes and vertices? From my understanding, nodes are more concrete, and vertices are more abstract I guess. Nodes refer to the nodes elements in .osm file. Do I understand it correctly? Any comments are greatly appreciated indeed!

@ pszufe, @ Bartosz_Pankratz

partial answer …

As I know - Geofabrik extract the (country/region) data

imho : the osmium extract should be enough with the default complete_ways strategy.

for extreme cases - for example - you want full ‘EuroVelo’ data ( == European cycle route network ) - you need different extraction strategy … and you have to know deeply the osm relation types …

1 Like

Thank you for your quick reply. What I need is car route network, something similar to cycle route network. Could you provide more references?

  • can you clarify what you mean by “car route network”?
  • what is your real problem? what you want to solve?
  • what is you background?

For example …
the OSRM is using this tags for car routing ( building - car route network )

Telenav : OSM Tags for Routing:

Valhalla : routing tags:

General OSM Wiki info about routing:

2 Likes

By “car route network”, I mean “driving road/route network”. I need to simulate / visualize cars driving on a road network, from given location A to location B.

not too much info … :slight_smile:
but probably in your case the

  • osmium extract --bbox 10,10,40,40 a.osm.pbf -o b.osm.pbf

is enough for you. ( but you have to make some experiments for testing this … )

on the other hand …

IF you need speed limits … THEN you need administration areas to decode some values

IF you need road hierarchy ; THEN you need osm relations …

etc …

so this is a complex problem … good luck ! :slight_smile:

disclaimer: I have not used the OpenStreetMapX package yet … because I am mostly loading the OSM data to the Postgres/Postgis database … so probably my comments not the global optimum … sorry ;

2 Likes