20

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?

5 Answers 5

6

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.

3
  • 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
    Commented Nov 28, 2011 at 12:47
  • try to upload without validation. I did not validate the SLD. Just uploaded it, and saved. Commented Nov 28, 2011 at 13:58
  • Hi, Yes this was exactly my problem - the validation went wrong. I will try and use without validating
    – user4944
    Commented Nov 28, 2011 at 14:35
2

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

1
  • These just make my shapefile blank
    – geoJshaun
    Commented Apr 19, 2017 at 0:33
2

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:

http://dev.ifs.hsr.ch/redmine/projects/osminabox/repository/revisions/master/show/Code/osm2gis/geoserver/geoserver_data/styles

2
  • That link requires a login. If you could please post the styles somewhere accessible, I'd appreciate it!
    – Amit Naidu
    Commented Sep 5, 2013 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
    Commented Sep 11, 2013 at 12:56
1

The map that you can browse on

http://www.openstreetmap.org/

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):

http://unicolet.blogspot.it/2012/06/improving-tiledrawer-rendering-speed.html

1
  • TileDrawer links are dead. Commented Nov 15, 2018 at 9:00
1

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 and acknowledge you have read our privacy policy.

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