I noticed that the recommended command to import data into the postgresql database from the tutorial here
is
which lists the openstreetmap-carto style file. The recommended import command for OSM-Bright from
is
My question is do I need to re-import the raw OSM data into the postgresql database everytime I want to change map styles and specify it during data import? The first tutorial specifies a style in the import command while the OSM-Bright tutorial does not. Thanks for any help. asked 13 Sep '18, 22:25 coderunner |
Short answer: Yes. There is no need to reimport data. A style file for osm2pgsql specifies aspects of how osm2pgsql converts OSM data into PostgreSQL tables, how much data is transferred from OSM xml into Postgres database. For example if a style does not display some kind of objects (powerlines, sidewalks etc) there is no much sense in keeping them in the rendering database. By constructing custom style you can filter what objects to include. More on this can be found here: https://wiki.openstreetmap.org/wiki/Osm2pgsql#Import_style Now to compatibility of openstreetmap-carto.style for OSM-Bright. Though default style that comes with osm2pgsql imports more data comparing to openstreetmap-carto (you can take diff of these two styles to see what objects are filtered) OSM-Bright does not use these data. So you can safely use the OSM-Bright style on the same database you made for openstreetmap-carto style. You can look at layers that are used by OSM-bright in this file https://github.com/mapbox/osm-bright/blob/master/osm-bright/osm-bright.osm2pgsql.mml - look for SQL statements. This is how data is queried from Postgres to Mapnik for rendering. answered 18 Sep '18, 09:44 getmaps_io 1
Makes sense, thank you for the explanation of what's going on under the hood. That was very helpful.
(18 Sep '18, 16:30)
coderunner
|
Probably yes. Rendering database is a special purpose database derivative and this can be very different for different styles. One can make some mappings, but it needs some knowledge about SQL. Quite simple solution (if you have enough of disc space) is to have more databases and just switch them - this is my rough script for this purpose (gis is default database, gis2 is the second one):
answered 13 Sep '18, 22:43 kocio That is a good idea. Thank you.
(18 Sep '18, 16:30)
coderunner
|