I have set up my map tile server and have used the following components:

  1. Mod_tile
  2. osm2pgsql
  3. postgres
  4. Mapnik
  5. open street map carto

In my configuration, postgres is on a different server. when I access the /osm_tiles/0/0/0.png, I get a blank square. I think the data is not being fetched from postgres database. I have mentioned the configuration in the osm2pgsql/project.yaml file.

  1. How do I tell my server that the PostgreSQL db is on another server? Do I need to mention the db details in some other place as well?
  2. Which of tool fetches the tiles from the PostgreSQL db to be displayed?

P.s I've used this link as the setup guide.


1 Answer 1


Question 1 In the project-1.mml file (at this step) check the database value and rerun carto command:

carto project-1.mml > OSMDefault.xml

Values should like:

  osm2pgsql: &osm2pgsql
    type: "postgis"
    dbname: "gis"
    host: "<your-server-zone>.rds.amazonaws.com"
    user: "postgres"
    password: "<your-postgres-password>"

If you still have diffculties check the connection between your Mapnik EC2 instance and your database.

psql -h <host> -p <port> -U <username> -W <password> <database>

If you can't connect check your security groups the database server security group must allow inbound traffic from the mapnik server. A recommended practice is to reference the security group of the mapnik server from the security group definition of the database server (see details here).

Question 2

This is Mapnik that fetch the data from PostgreSQL and generate the tiles. The tiles are not in the database, this is Mapnik that generate them using geospatial data from the database and a stylesheet (to select the rendering colors and size of all elements)

  • can we use port in this config? something like this:-- osm2pgsql: &osm2pgsql type: "postgis" dbname: "gis" port: 5433
    – suneet
    Sep 12, 2020 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.