NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hey everyone,

I have set up a tile server following this guide https://switch2osm.org/serving-tiles/manually-building-a-tile-server-18-04-lts/. What is the best way to change the style of the map?

asked 26 Mar '20, 20:17

JonasPonas's gravatar image

JonasPonas
31115
accept rate: 0%

1

Hi. Do you want to switch to another style ? In this case I guess you should check that style's doc. Or customize the default one ? In this case you could start with this page : https://github.com/gravitystorm/openstreetmap-carto/blob/master/CONTRIBUTING.md

(27 Mar '20, 19:10) H_mlet

Hey, thanks for the reply. Yes i would like to change the default style and also create my own styles. As I understand I can use Kosmtik to create Mapnik ready map styles? I tried TileMill, but i could not figure out how to apply Mapnik xml format file, i imported said file and when running renderd it had a lot of errors. If I would fix those errors it should work? Nonetheless, i will try Kosmtik.

(28 Mar '20, 15:58) JonasPonas
1

Editing pure Mapnik .xml is not to be recommended. Most people use CartoCSS and compile it with carto (the command-line utility).

(29 Mar '20, 12:01) Richard ♦
1

A quick note about Tilemill - as I understand it, it was designed originally to handle the editing of CartoCSS map styles. Unfortunately, OSM's "standard" tile layer has a lot of layers and it was always a bit cumbersome to edit so many layers with Tilemill (they literally didn't all fit on screen). Tilemill's had some recent redevelopment, so things may have got better, but I'd still suggest working from the command line so that you can see all the moving parts and carefully do one thing at once.

(29 Mar '20, 13:16) SomeoneElse ♦

It depends a bit on what sort of style change you're planning - if you want to perform minor changes to an existing style (and I'll assume that we're talking about this one for now), then start with that style, make minor changes to the source files (for example, try changing the colours at the top of this file), then:

  • rerun "carto project.mml > mapnik.xml" in the switch2osm guide,
  • restart renderd,
  • restart apache,
  • and (probably) remove previously rendered metatiles.

See the last few lines of this script for what I do when testing style changes.

Important - "carto" won't often flag up errors in the style file when run, so you'll need to keep an eye on your system's logfile to see errors like "... which failed to load" (against a map layer).

If you're changing something in the "lua" script that gets run at data load then you'll need to reload data as well. I use this script for that - you won't want the stuff in there that's specific to the map style I use but the "get a small test area from Geofabrik only when I need a new one" part might be useful.

permanent link

answered 29 Mar '20, 13:11

SomeoneElse's gravatar image

SomeoneElse ♦
36.9k71370866
accept rate: 16%

Hey, thanks for the reply. Could you explain if Kosmtik would make changing styles easier or I dont fully understand https://github.com/kosmtik/kosmtik?

(29 Mar '20, 15:10) JonasPonas
1

If I understand correctly the Kosmtik doc, it would replace renderd in your setup. The good point seems to be that changes in the style are rendered quickly. Bad point is that it doesn't support MapCSS, on which the main "openstreetmap-carto" style is based.

Hope this helps, I'm no specialist of these things.

(29 Mar '20, 16:14) H_mlet

Hey, thanks for replying, correct if I am wrong but here it is written that: https://github.com/gravitystorm/openstreetmap-carto

These stylesheets can be used in your own cartography projects, and are designed to be easily customised. They work with Kosmtik and also with the command-line CartoCSS processor.

(30 Mar '20, 08:13) JonasPonas
2

@H_mlet No, osm-carto is based on CartoCSS, not MapCSS.

(30 Mar '20, 14:30) Richard ♦
1

@JonasPonas I've never used Kosmtik, but would actually suggest editing everything manually to start with, because if something goes wrong you need people with two sets of knowledge (Kosmtik and CartoCSS) not just one.

(30 Mar '20, 15:26) SomeoneElse ♦
1

@Richard Oups, sorry for the confusion. I guess I'm out of my league here.

Is the rest of my remark valid ? That kosmtik is a renderer, like renderd, but more for desktop use ?

(30 Mar '20, 16:57) H_mlet
2

You're half right! Neither renderd nor Kosmtik are renderers: Mapnik is the renderer. Both Kosmtik and renderd are effectively glue code for Mapnik; they receive requests, fire them off to Mapnik, and then return the result. As you say, Kosmtik is intended for desktop use (and therefore includes a full UI), renderd for server use (no UI, but more performant).

(31 Mar '20, 12:49) Richard ♦
showing 5 of 7 show 2 more comments
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:

×341
×65
×36

question asked: 26 Mar '20, 20:17

question was seen: 11,791 times

last updated: 31 Mar '20, 12:49

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum