osm2pgrouting icon indicating copy to clipboard operation
osm2pgrouting copied to clipboard

what tags used by osm2pgrouting that can be filtered by osmfilter?

Open tbicr opened this issue 4 years ago • 4 comments

Is your feature request related to a problem? Please describe. osm2pgrouting suggest to decrease osm file size, but I don't find suggestion to use osmfilter for it.

There are a few objects probably used like highways or cycleways or barriers as example.

So the question what the best filter for osmfilter I can use to reduce osm file size, but don't affect result importing data?

For example:

osmconvert INPUT.osm.pbf -o=INPUT.o5m
osmfilter INPUT.o5m  -o=OUTPUT.o5m \
--keep="highway= cycleway= cycleway:right= cycleway:left= tracktype= junction= barrier="
osmconvert OUTPUT.o5m -o=OUTPUT.osm

Describe the solution you'd like

Describe alternatives you've considered

Additional context

tbicr avatar Apr 13 '20 22:04 tbicr

Hi @tbicr ,

We suggest in "Tips" that you can use --drop-author and --drop-version flags with osmconvert to reduce size. If you would like to reduce more your dataset you should use osmfilter as you can have more granular filter functionality.

Answering your question I think you can reduce your data by removing all data you don't want to use to build your graph. I don't know what you need in your use case but you should be careful removing tags because you could build an incomplete graph.

cayetanobv avatar Apr 14 '20 00:04 cayetanobv

@cayetanobv , thanks for reply.

How can I figure out what tags use osm2pgrouting? I find tags usage in next places, but not sure that it all:

  • https://github.com/pgRouting/osm2pgrouting/blob/2adbbf361af7cbd45b8821a498ed586bd64bbf65/mapconfig.xml
  • https://github.com/pgRouting/osm2pgrouting/blob/2adbbf361af7cbd45b8821a498ed586bd64bbf65/src/configuration/configuration.cpp
  • https://github.com/pgRouting/osm2pgrouting/blob/b80898afa3b2d045a3ae3185f15919b802fba565/src/osm_elements/Way.cpp

tbicr avatar Apr 14 '20 12:04 tbicr

Exactly, you need to define in mapconfig.xml your own use case or use this file directly. You have more xml config examples in the repository (you can tune as you want): image

cayetanobv avatar Apr 14 '20 13:04 cayetanobv

It is possble to use additional mapconfig options for truck using maxwdth / maxhieight and maxweight tags? Have you an example?

  <tag_name name="highway" id="1">
    
[...]

    <tag_value maxweight="*"            id="201" priority="50"/>
    <tag_value maxwidth="*"            id="202" priority="100"/>

  </tag_name> 

but I encountered this error:

    Parsing configuration

osm2pgrouting: /build/osm2pgrouting-8kyiLn/osm2pgrouting-2.3.6/src/configuration/tag_value.cpp:33: osm2pgr::Tag_value::Tag_value(const char**): Assertion `has_attribute("name")' failed.
Aborted (core dumped)

rmarzocchi84 avatar May 09 '22 07:05 rmarzocchi84