We have downloaded OSM data for our region and loaded them into PostGIS using osm2pgsql. So far so good. On top we have GeoServer and we would like to expose the OSM data using WMS. We would as well like to style data like in "standard" OpenStreetMaps (e.g. osm.org) as this cartography is well designed. We have tried to download som standard SLD for OSM data, but there seem to all sorts of problems using these SLDs (XML parsing errors, invalid content, etc.).

Any good ideas how to reuse an OSM SLD to style OSM through WMS?


I have used this one, created (but no longer maintained) by Florent Bervas, and it is quite good. Unfortunately, it only has lines and polygons style, but maybe it will help you.

  • I tried the osm_lines.sld but I get a lot of errors when validating the stylesheet in geoserver's SLD editor. The data was imported to postgis from an osm shapefile extract. Using Geserver 2.1-SNAPSHOT. – maning Nov 28 '11 at 12:47
  • try to upload without validation. I did not validate the SLD. Just uploaded it, and saved. – Mario Miler Nov 28 '11 at 13:58
  • Hi, Yes this was exactly my problem - the validation went wrong. I will try and use without validating – user4944 Nov 28 '11 at 14:35

Haven't played with these yet but check out these styles on github

  • These just make my shapefile blank – geoJshaun Apr 19 '17 at 0:33

They may not be exactly right, but I am working with modified versions of the ones included in OSM-in-a-Box (http://dev.ifs.hsr.ch/redmine/projects/osminabox/wiki). A preview is available at that first link.

You can get to the SLDs directly in the source from:


  • That link requires a login. If you could please post the styles somewhere accessible, I'd appreciate it! – Amit Naidu Sep 5 '13 at 21:40
  • 1
    Have a look at my answer here: gis.stackexchange.com/questions/70641/… No direct link, but accessible with a few steps. Cookies are needed. – AndreJ Sep 11 '13 at 12:56

The map that you can browse on


is quite problably not rendered with geoserver but with a tile server like mapnik instead.

Luckily you can easily (no, seriously) set up a server to render tiles like those on the OSM web site using TileDrawer. Unfortunately at the moment there is an issue that the author is working on that could prevent your setup from working automagically. I suggest you wait until the issue has been fixed. If you can't wait just make sure you install python-cssutils before launching the script.

If you find that TileDrawer takes a lot (like minutes) to render tiles, consider applying the following indexes to the planet_osm database (shameless plug):


  • TileDrawer links are dead. – Beachwalker Nov 15 '18 at 9:00

This rather indirect but what about converting the OSM style file to SLD? There's a tool for converting Mapnik style files to SLD. You might want to consider that option. Good luck. :)

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.