Can someone give an example? I am missing any OSM-specific docs around... I know I can download the real OpenStreetMap style but I do not really understand it. I am looking for a simpler example. asked 22 Mar '12, 19:47 Kozuch SomeoneElse ♦ |
Here is a simple example that I have taken from Jochen Topf's and my book, "OpenStreetMap - Using and Enhancing the Free Map of the World". Suppose you have imported data with osm2pgsql, and you want to draw all roads (no matter what type of road) as a grey line. You would make a style like this:
You will need a layer definition to go with that:
This assumes that there is a database called “osm” on the local PostGIS server, that the user “osm” has access to it, and that it has a table named planet_osm_line, populated with geometry data in the EPSG:4326 projection, from which we can load information about roads. This is exactly what Osm2pgsql produces when you run it with the --latlong option. The next thing you will want to do is of course have different rules for different types of roads (probably using the <filter> element), and maybe different rules styles for different zoom levels (using the <maxscaledenominator> and <minscaledenominator> elements). See the Mapnik documentation at https://github.com/mapnik/mapnik/wiki/ for further details. answered 22 Mar '12, 21:00 Frederik Ramm ♦ |