I am currently setting up an osm stack on my macOS computer. I have set up the rails port for the OSM website and a map tiles server from this GitHub page: GitHub page. I followed the instructions for both installations and set up separate psql databases. Is it possible for the rails port OSM psql database to be the same as the tile server database (in a docker container)? There are instructions on the map tiles GitHub page: "to connect to the PostgreSQL database inside the docker container." Could the OSM server directly use the tile server database or vice versa? Thanks!

Edit: I am importing a .pbf file for the OSM psql database, and it seems to be way larger compared to the tile server docker database. How large is a country-sized psql database supposed to be?

asked 18 Apr, 03:27

Nightilon's gravatar image

Nightilon
16113
accept rate: 0%

edited 18 Apr, 07:05


No, this is absolutely not possible. You need to export data from your rails database using e.g. the planet_dump_ng utility (https://github.com/zerebubuth/planet-dump-ng) and then import into a new database with osm2pgsql in order to use it for a tile server. (Both databases could be run on the same PostgreSQL instance / in the same container if you want but the data needs to be there twice.) The reason for this is that osm2pgsql builds geometry objects and indexes on import, which the original rails database has no need for. The tile server database is on a different abstraction level, for example when you have a building with four nodes, it is not interested in the individual nodes anymore, just the building object, whereas the rails database needs to record details about every single node.

permanent link

answered 18 Apr, 11:51

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
79.9k907021235
accept rate: 23%

Thanks, I think I got it working now with your explanation. Is there a process that can automate the transition from the rails psql database to the tile server psql database?

(18 Apr, 16:33) Nightilon
1

If you want to make changes to your rails database and have these replicated to the tile server, the process for that would be using osmosis (see https://wiki.openstreetmap.org/wiki/Osmosis/Replication#Server-side_Replication) to create minutely diffs and then processing these with osm2pgsql --append to modify the tile server database. If your database is very small and edits happen infrequently then it is possible that making a full dump every time a change has been made and processing that with osm2pgsql --create is the simpler option though.

(19 Apr, 00:21) Frederik Ramm ♦
Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

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:

×664
×194
×165
×115

question asked: 18 Apr, 03:27

question was seen: 368 times

last updated: 19 Apr, 00:25

powered by OSQA