Skip to content

Filter Format

Daniel Tischner edited this page May 20, 2018 · 5 revisions

Overview

The backend uses .filter files to optimize the initialization process.

Their location can be configured, see Configuration.

Usages include:

  • Graph construction - Filter the OSM entities to include in the graph
  • Reduce command - Filter the OSM entities to include in the reduced file

Structure

A .filter file consists of key-value pairs and modifiers, one entry per line. Lines which start with # are interpreted as comment and thus ignored. Modifiers have a prefix of --, supported modifiers are

  • KEEP - Following key-value pairs contain tags which an OSM way must contain at least one of in order to be kept
  • DROP - Following key-value pairs contain tags which are forbidden for an OSM way. If a way contains at least one of them, it is rejected.

An example for a road filter might look like:

--KEEP

#highways
highway=motorway
highway=trunk
highway=primary
highway=secondary
highway=tertiary
highway=residential
highway=living_street
highway=unclassified

#highwaylinks
highway=motorway_link
highway=trunk_link
highway=primary_link
highway=secondary_link
highway=tertiary_link
highway=residential_link

#non-standard
way=primary
way=seconday

--DROP

area=yes
train=yes
access=no
type=multipolygon
railway=platform
railway=station
highway=proposed
highway=construction
building=yes
building=train_station

Usage

OSM files usually contain a lot of data which is not relevant for routing. The filter is used to find only relevant entities.

Therefore, a filter lists tags which an OSM way must contain at least one of and tags which are forbidden. Nodes are filtered based on the ways. The graph only contains nodes which are referenced by the filtered ways.