Making Web Maps Prettier

Ian Turton, Astun Technology Ltd

August 2016


  • Introduction
  • Examples
  • Solutions

Surely all maps are pretty

  • Well some are and some aren't
  • check out #cartofail for examples

Styled Layer Descriptor (SLD)

  • it's a standard!
  • hardly anyone implements it!



  <se:Name>Scientific station</se:Name>
    <se:Title>Scientific station</se:Title>
  <ogc:Filter xmlns:ogc="">
      <ogc:Literal>Scientific station</ogc:Literal>
          <se:SvgParameter name="fill">#ffffff</se:SvgParameter>
          <se:SvgParameter name="stroke">#000000</se:SvgParameter>

Cascading Style Sheets (CSS)

  • it's not a mapping standard
  • every one implements it differently
  • no compatibility
 * { 
        fill: lightgray;
          stroke: black;
            stroke-width: 2;

    [PERSONS < 2000000]{
        fill: #4DFF4D;

    [PERSONS >= 2000000] [PERSONS < 4000000]{
        fill: #FF4D4D;

    [PERSONS >= 4000000]{
        fill: #4D4DFF;

Writing SLD

  • By hand (not really good)
  • Using a GIS (OK but tiring)
  • By program (good if it knows what you want)

Hand Editing

  • use a TEXT editor (not Word)
  • Use the GeoServer editor (validating)

GIS Editors

  • QGIS
  • UDIG


  • Good styling tools
  • No Label export (yet?)


  • Good styling tools
  • Can edit raw XML
  • Some what unstable

Custom SLD Editors

  • Shapefile Viewer
  • SLDEditor

Shapefile Viewer

  • Applies ColorBrewer to a shapefile attribute


  • Interactive GUI for writing SLDs
  • Developed by SciSys, planning to become OSGEO project

Pretty Maps

Tips & tricks

  • set the background colour of the map (bgcolor=0x9fd9c9)
  • chose a "good" colour scheme
  • use interpolate instead of many filters
        <se:SvgParameter name="fill">
        <ogc:Function name="Interpolate">


Tips & tricks

  • if need be draw the layer twice
  • use geometry functions to get the centroid
  • use maths functions to calculate sizes
    <ogc:Function name="buffer">
      <ogc:Function name="Centroid">
          <ogc:Function name="pow">
          <!--<ogc:Literal>1000000000</ogc:Literal> sqrt -->

Tips & tricks

  • GeoServer can follow lines
      <sld:VendorOption name="followLine"> true</sld:VendorOption>
  • If you don't want to see the lines then don't add a LineSymbolizer!

Other Issues

Bad Choropleths

  • ColorBrewer to the rescue

  • both QGis and UDig provide access to ColorBrewer palettes
  • don't use rainbows unless you want to appear on #cartofail

Missing and Repeated Labels

  • Use the centroid
  • Use <VendorOption name="partials">


  • Think about how your map will look.
  • Think about your map will be used.