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

**URL:** <https://discourse.julialang.org/t/what-is-the-relation-between-cropping-a-osm-file-by-osmium-cat-and-the-crop-function-provided-in-openstreetmapx-package/30210>\
**Category:** General Usage\
**Tags:** package\
**Created:** [October 23, 2019, 9:48am UTC](https://discourse.julialang.org/t/what-is-the-relation-between-cropping-a-osm-file-by-osmium-cat-and-the-crop-function-provided-in-openstreetmapx-package/30210 "2019-10-23T09:48:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [October 23, 2019, 9:48am UTC](https://discourse.julialang.org/t/what-is-the-relation-between-cropping-a-osm-file-by-osmium-cat-and-the-crop-function-provided-in-openstreetmapx-package/30210/1 "2019-10-23T09:48:04Z")

</div>

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? - #34 by ImreSamu](https://discourse.julialang.org/t/whats-the-general-algorithm-to-draw-a-road-network-of-a-certain-area/20657/34)  
I download the .osm.pbf file, say a.osm.pbf from [GEOFABRIK // Downloads](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!

---

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [October 23, 2019, 9:49am UTC](https://discourse.julialang.org/t/what-is-the-relation-between-cropping-a-osm-file-by-osmium-cat-and-the-crop-function-provided-in-openstreetmapx-package/30210/2 "2019-10-23T09:49:12Z")

</div>

@ [pszufe](https://discourse.julialang.org/u/pszufe), @ [Bartosz\_Pankratz](https://discourse.julialang.org/u/Bartosz_Pankratz)

---

<div class="post-metadata">

**Author:** ![ImreSamu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imresamu/32/20677_2.png) [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)\
**Post date:** [October 23, 2019, 5:12pm UTC](https://discourse.julialang.org/t/what-is-the-relation-between-cropping-a-osm-file-by-osmium-cat-and-the-crop-function-provided-in-openstreetmapx-package/30210/3 "2019-10-23T17:12:02Z")

</div>

partial answer …

> [@bsnyh](#):
>
> I download the .osm.pbf file, say a.osm.pbf from [GEOFABRIK // Downloads](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.

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

- from the (locally updated) [OSM Planet file](https://planet.openstreetmap.org/) ( = full earth data ) and
- using the [`osmium extract`](https://docs.osmcode.org/osmium/latest/osmium-extract.html) tool …

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

for extreme cases - for example - you want full [‘EuroVelo’ data](https://wiki.openstreetmap.org/wiki/WikiProject_Europe/EuroVelo) ( == European cycle route network ) - you need different extraction strategy … and you have to know deeply the osm relation types …

- [Relation:route - OpenStreetMap Wiki](https://wiki.openstreetmap.org/wiki/Relation:route)

---

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [October 24, 2019, 8:29am UTC](https://discourse.julialang.org/t/what-is-the-relation-between-cropping-a-osm-file-by-osmium-cat-and-the-crop-function-provided-in-openstreetmapx-package/30210/4 "2019-10-24T08:29:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ImreSamu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imresamu/32/20677_2.png) [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)\
**Post date:** [October 24, 2019, 6:12pm UTC](https://discourse.julialang.org/t/what-is-the-relation-between-cropping-a-osm-file-by-osmium-cat-and-the-crop-function-provided-in-openstreetmapx-package/30210/5 "2019-10-24T18:12:44Z")

</div>

> [@bsnyh](#):
>
> What I need is car route network,

- 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 )

- [Open Source Routing Machine (car profile) | Projects | OpenStreetMap Taginfo](https://taginfo.openstreetmap.org/projects/osrm#tags)

Telenav : OSM Tags for Routing:

- [Telenav OSM Tags for Routing | Projects | OpenStreetMap Taginfo](https://taginfo.openstreetmap.org/projects/scout_routing#tags)

Valhalla : routing tags:

- [Valhalla | Projects | OpenStreetMap Taginfo](https://taginfo.openstreetmap.org/projects/valhalla#tags)

General OSM Wiki info about routing:

- [Routing - OpenStreetMap Wiki](https://wiki.openstreetmap.org/wiki/Routing)
- [OSM tags for routing - OpenStreetMap Wiki](https://wiki.openstreetmap.org/wiki/OSM_tags_for_routing)

---

<div class="post-metadata">

**Author:** ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Post date:** [October 25, 2019, 7:13am UTC](https://discourse.julialang.org/t/what-is-the-relation-between-cropping-a-osm-file-by-osmium-cat-and-the-crop-function-provided-in-openstreetmapx-package/30210/6 "2019-10-25T07:13:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ImreSamu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imresamu/32/20677_2.png) [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)\
**Post date:** [October 25, 2019, 1:44pm UTC](https://discourse.julialang.org/t/what-is-the-relation-between-cropping-a-osm-file-by-osmium-cat-and-the-crop-function-provided-in-openstreetmapx-package/30210/7 "2019-10-25T13:44:34Z")

</div>

> [@bsnyh](#):
>
> 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 … 🙂  
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

- [Speed limits - OpenStreetMap Wiki](https://wiki.openstreetmap.org/wiki/Speed_limits#Country_code.2Fcategory_conversion_table)

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

- [Relation:route - OpenStreetMap Wiki](https://wiki.openstreetmap.org/wiki/Relation:route#Road_routes)

etc …

so this is a complex problem … good luck ! 🙂

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 ;
