I've recently realized that OpenStreetMap is more than just roads and boundaries. It's incredible. I had no idea. A true masterpiece of community collaboration. However, that creates a small problem. I'm looking to stand up a basic vehicle routing service without all the additional data bells and whistles. (Very cool never the less).

I found osmfilter - https://journocode.com/2018/01/08/extract-geodata-openstreetmap-osmfilter/

As well as the categories - https://wiki.openstreetmap.org/wiki/Map_Features

That's a lot of possible combinations and potential relationships within the data that if I remove may have unexpected consequences. I'd be looking for some direction on what categories to keep and drop to hit the goal below.


  • List item
  • Look/data similar to google directions.
  • Vehicle routing within city limits.
  • Dataset for the entire USA.
  • Needs to render and serve tiles.
  • Should I use OSRM in docker or the switch2osm 18.04 tutorial?
  • Expected Disk space needed and RAM. I've found that 24 GB and 60 GB of disk space wasn't enough but that was a full import without any category drops via osmfilter. Smaller is better in RAM and Disk but quality shouldn't suffer for vehicle directions.

Thank you for your help.


Ref URLs:

asked 01 Jul '19, 18:06

chavenor1's gravatar image

accept rate: 0%

edited 01 Jul '19, 18:12

Routing and tile rendering are entirely separate toolchains.

OSM data can power both, but you'll need to process it separately for each application, and run two different servers (those servers can, of course, be on the same box!). Typically to render raster map tiles you'll use the switch2osm workflow, loading data into a PostGIS database with osm2pgsql, and then rendering as tiles with Mapnik, renderd and mod_tile. For routing, you'll use software like OSRM, Graphhopper or Valhalla, each of which has a preparation step and then a route server.

Note that OSRM's fast Contraction Hierarchies routing algorithm is very memory-hungry, so if "smaller is better in RAM", you might prefer to choose a tool which offers a slower but more memory-efficient algorithm.

By default, each tool chooses a set of features from OSM to render or route along. You can change these by redesigning the stylesheet for the tileserver, or the "routing profile" for the routing tool. The tools have their own filtering abilities so you probably won't need osmfilter.

permanent link

answered 02 Jul '19, 14:28

Richard's gravatar image

Richard ♦
accept rate: 19%

edited 02 Jul '19, 14:30

Can I slim down the Postgres DB by filtering out stuff I don't need for the tile server? Like I don't need to know where all the bus stops are and so on. Any advice on how to trim it down. For the OSRM -- is one better than the other?

(02 Jul '19, 16:14) chavenor1

Yes, you can slim the Postgres db by editing the "style file" which tells osm2pgsql which columns to import. Note, however, that you'll then need to edit the stylesheet so that it doesn't try to retrieve data from the columns you've dropped, and that's not necessarily trivial.

When you say "is one better than the other", one what?

(02 Jul '19, 20:30) Richard ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 01 Jul '19, 18:06

question was seen: 787 times

last updated: 02 Jul '19, 20:30

powered by OSQA