This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Loading different styles in custom openstreemap server

0

hello, i have setup an openstreetmap server and everything works perfectly..however there are somethings that i do not fully understand...

regarding alternative styles --when you load the osm file with osm2psql into postgresql you need to pass the style.xml as a parameter.. Than implies that postgresql holds representation data (for example, colors) into the tables? I have seen the tables loaded but i did not find anything related to style... --that leads to my main confusion..for example i want to load either the humanitarial style or the osm-bright? how do i do that? do i have to run the osm2psql with a different another_style.xml into the same database? i do not quite understand how to serve different layers ? another style means another database ? some explanations would be great...

also, lets say that i want to remove all the restaurants from the tiles and add them with javascript as points with leafletjs...as far as i understand, i need to create a style with tilemill, generate the mms file, convert it with mapnik and reload the data (and then it goes to my first question)..

asked 28 Jul '17, 09:27

dmtrs's gravatar image

dmtrs
31113
accept rate: 0%


One Answer:

3

You don't pass any style.xml file to osm2pgsql. Instead you pass a .style file, which describes to osm2pgsql what columns (attributes) should be added to the database. For example, here is the .style file for openstreetmap-carto.

You can often run multiple styles from the same osm2pgsql database, so long as they have been either written to work with the same columns, or use the same .style (and .lua rules, if used) files. If you are creating your own styles it's straightforward. If you are using other people's styles, sometimes they work, and sometimes they need small changes to their SQL queries.

answered 28 Jul '17, 11:40

Andy%20Allan's gravatar image

Andy Allan
12.5k23128153
accept rate: 28%

Source code available on GitHub .