Good free tools for designing styles and rendering OSM data?

What are good free tools for designing styles and rendering OpenStreetMap data? I’m currently using modified CartoCSS stylesheets, Kosmtik, and Mapnik and I’m fairly happy with it. The downside with my setup: slow turnaround for testing changes, difficult to debug, and not sure how many people are still using this stack.

I do. What are you finding hard to debug?

1 Like
  1. Mainly labels not showing up or being in wrong style due to either label overlap, or multiple rules for the item. I can eventually fix them, but it’s tedious. I set text color to red,ornage,purple for different rules until finally I find the right rule. Each test takes 30 seconds to render. 2. Almost all my styling goes away for zoom=18 and everything is rendered in black. I can’t figure that out at all. 3. Performance tuning - i have no idea how to tell where there are performance problems from a style. Here is what I am working on:
4 Likes

Labels not showing up because of collision with another label is definitely one of the more time consuming things - determining what the item is colliding with, figuring out which rule is displaying the other item and then figuring out how to set up the right order of rules so the item I want is shown first.

Yeah, for label placement I live with trial and error for so long I don’t pay attention anymore.
For performance issues, postgresql log is very handy: you can log statements longer than xx ms. Look at postgresql.conf doc.

1 Like

Thanks! I’ll check the logging

I turned on logging and used pgbadger and in 30 minutes fixed some bad queries and improved z8 performance 5x.

I regularly work with CartoCSS styles. If a map style feels slow, I do the following steps:

  • As you described below, use log_min_duration in postgresql.conf (don’t forget to reload PostgreSQL) to find slow queries.
  • Check if the slow queries make use of the indexes or if conditional indexes could be helpful. For example, a query selecting trees from planet_osm_point can be faster if it does not use a spatial index on planet_osm_point but an index created like this: CREATE INDEX my_tree_index ON planet_osm_point WHERE "natural" = 'tree'.
  • If queries combine multiple SELECT statements with UNION ALL (or queries joining tables), consider adding an explicit way && !bbox! in the inner SELECT statements. !bbox! is a template for the bounding box used by Mapnik.
  • Split long contour lines into shorter sections. Long/large features do not improve performance of spatial indexes.
3 Likes

Thank you!

That’s a gorgeous terrain layer, especially the rich texture on the ice fields and the changing greens and brown throughout. What are you using as a source?

Thanks! I’m trying to over-accentuate geologic features.

I want to post the tools and steps to github at some point but it’s basically using gdal tools to create a hillshade and a color-ramp and then merge them.

  1. gdaldem hillshade -z 2 -igor

  2. gdaldem color-relief with the color ramp at the end.

  3. merge the layers using a composite multiply: gdal_calc.py --calc “(A.astype(float)*B.astype(float))/255.0” -A “color_relief.tif” -B “hillshade.tif”. --A_band=“$band” --B_band=1

$band is set to 1 thru 4 to do all RGBA bands

Color-ramp:

9300 255 255 255 255
8700 255 255 255 255
8000 133 124 116 255
5900 160 150 137 255
4000 205 200 166 255
500 114 144 99 255
1 147 161 112 255
0 75 87 111 255
-30 75 87 111 255

I wrote a very simple tool that displays the ramp colors to help set them:

Higher elevations are white the glaciers are drawn over them with .6 opacity.

I have a makefile and a few shell scripts that tie that all together and allow different configurations by region. It also has the ability to generate an arid relief image and a temperate relief image and merge the two based on precipitation with surprisingly good results.

3 Likes

UH-mazing work there. Please don’t underestimate the value of what you’ve done already. I think this is super-showcase-able (if that’s a word). And, yes please! to putting this up on Github. I’d definitely love to see it in other areas.

4 Likes