I have a tile server I've built on Ubuntu 18.04LTS using steps/sources from here.

Here is where I differed. I added a postgres cluster on another filesystem, and added the service on port 5433. Using a global environment variable, I set PGPORT to 5433; issuing psql loads up the correct database. Osm2pgsql and subsequent database updates appear to be working fine.

However, renderd does not like my setup:

An error occurred while loading the map layer 'ajt': Postgis Plugin: FATAL:  role "tile_server" does not exist
                                      Connection string: ' dbname=gis connect_timeout=4'
                                        encountered during parsing of layer 'landcover' in Layer at line 1026 of '/home/tile_server/src/openstreetmap-carto-AJT/mapnik.xml'

I figured this error is occurring because renderd has accessed the default postgresql database.

I grep'd source code looking for a hardcoded port, but it didn't jump out at me.

So, I started looking for renderd.conf options. I'm trying to find man page renderd.conf but no luck so far.


  1. Do you see a different explanation for my error that I should be researching?
  2. Is there a renderd.conf option to specify the postgres port?
  3. Ummm, where do I find the man page for renderd.conf?

asked 15 Jun '18, 16:35

tim_rohrer's gravatar image

accept rate: 100%

This is not a renderd issue; renderd doesn't know what PostgreSQL even is. The code responsible for connecting to PostgreSQL is in the mapnik rendering library, and controlled by your style file (mapnik.xml). You can configure a port in the <Datasource> section of your style file, as per the documentation here: https://github.com/mapnik/mapnik/wiki/PostGIS

If your XML is generated from a .mml/.yml file using the carto compiler, then you have to set the port in your .mml/.yml file accordingly.

permanent link

answered 15 Jun '18, 19:25

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 24%

My XML is generated from the project.mml provided in openstreetmap-carto-AJT.

From my read of the link, in the Layer section of the MML, I should add attributes for the Datasource.

Do I have to add "port": "5433", in every single section for which there is a Datasource of type postgis? Or is there a way to do this globally?

And thank you for helping me understand the dependencies!

(16 Jun '18, 04:02) tim_rohrer

Never tried it, but a quick web search finds this which has a syntax for "port" in a project.mml.

(16 Jun '18, 10:13) SomeoneElse ♦

Thanks @SomeoneElse. I promise I had been doing a lot of web searching when I wrote the comment. :-) That post had not come up. Interestingly, I had tried to add some lines to the JSON, but carto wasn't liking what I was doing.

Then I came across (this)[https://cartocss.readthedocs.io/en/latest/mml.html] which seemed to suggest the file needed to be in yaml to have global-like settings. I converted the project.mml to yaml, but haven't tested it with carto yet.

I did do a global replace to add the port settings after the type line (70 replacements), and that seems to have worked. Not very elegant :-) If I come up with a better process, I'll come back here an post a complete answer for future searchers.

(16 Jun '18, 15:56) tim_rohrer
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: 15 Jun '18, 16:35

question was seen: 2,416 times

last updated: 16 Jun '18, 15:58

powered by OSQA