go-spatial/tegola-osm

How to configure all 3 databases in the sample tegola.toml file

adamakhtar opened this issue · 4 comments

Hi,

Thank you so much for all the hard work involved in putting this sample config together. It has been really helpful for me.

I'm running into a small problem and it is most probably due to my misunderstanding of the instructions in the Readme.

It seems to suggest after importing all the data in steps 1 & 2 that there will be 3 databases.

  1. One for the data imported from the OSM .pbf file (no specific db name specified so I am free to choose?)
  2. Another for the data imported from natural earth (db name: natural_earth)
  3. The last one from OSM land. (db name: osm)

Yet the tegola.toml file only asks for the details for the first two databases. Where do I specify the details for number 3?

When I try to run tegola with the tegola.toml file I'm getting the following error:

./tegola serve --config tegola.toml
2020-06-25 20:45:02 [INFO] root.go:61: Loading config file: tegola.toml
2020-06-25 20:45:02 [INFO] config.go:209: loading local config (tegola.toml)
Error: could not register providers: error fetching geometry type for layer (land_8-20): ERROR: relation "land_polygons" does not exist (SQLSTATE 42P01)

I assume this is because I havent configured tegola to use the 3rd DB which has the osm land data.

Or am I misreading the instructions?

The only modifications I made to the tegola.toml file are the following

#   OpenStreetMap (OSM)
[[providers]]
name = "osm"
type = "postgis"
host = "localhost"
port = "5432"
database = "open_street_map"  #<= name of the db which contains the data from the pbf file in step 1
user = "myuser"
password = "xxxx"

...
...

#	Natural Earth
[[providers]]
name = "ne"
type = "postgis"
host = "localhost"
port = "5432"
database = "natural_earth"
user = "myuser"
password = "xxxx"

@adamakhtar It's great to hear this repo is helpful! Admittedly it does have some deficiencies in the instructions and so if we figure out where things are unclear it would be great to update accordingly.

In a nutshell, the OMS land should be in the same database as the rest of the OSM data. The land polygons require a separate workflow, thus the separate scripts, but the data should live alongside the other OSM data. In the end, you should only have 2 databases, one for Natural Earth and one for OSM. You could even have 1 database to house all this data if you prefer.

@ARolek ah I should have tried that. I had at one point tried placing all 3 in the one database but it didn't work. TBH my workflow was a bit scrappy then so that was more likely an error on my part.

Regarding suggestions for the readme I think the individual sections read well as is. I'd probably edit step 1 to mention a database called osm should be created and used with imposm to import the pbf file. I think with that everything is super clear.

Again thank you for the great work. It's great to have non trivial examples of imposm mappings and tegola config.

@adamakhtar got it. Would you be interested in submitting some edits to section 1 that would make it more clear? Sometimes I have an issue writing instructions with a fresh perspective so it's helpful to have outside suggestions.

@ARolek sure no problem. I'll first get the script running ok to ensure I understand everything correctly and will then submit a PR. Should be able to do that in the next few days.