Skip to content
Daniele Santini edited this page Jan 19, 2019 · 9 revisions

Dependencies

Only Kosmtik dependency is NodeJS.

Install NodeJS on Linux

Follow the instructions in the NodeJS wiki.

Install Kosmtik

Install instructions are available on the Github README.

Install Kosmtik plugins

Once in the kosmtik root, run:

node index.js plugins --install kosmtik-tiles-export
node index.js plugins --install kosmtik-mbtiles-export
node index.js plugins --install kosmtik-fetch-remote

Clone the project

git clone https://github.com/hotosm/HDM-CartoCSS.git

Local config

We need to override some of the project's configurations to match our working environment, for example for the database credentials. For this, create a localconfig.js file in the root of the hdm project, with this content (adapt it to your needs):

exports.LocalConfig = function (localizer, project) {
    localizer.where('Layer').if({'Datasource.type': 'postgis'}).then({
        'Datasource.dbname': 'yourdbname',
        'Datasource.password': '',
        'Datasource.user': 'youruser',
        'Datasource.host': ''
    });
};

You will need to configure your Local Config file for any hard-coded paths, especially contour and hillshade files. See Kosmtik local configuration for an example localconfig.js

Create a database and import the data

Follow the instruction here

Download and preprocess DEM

Follow the instruction here

If you don't want DEM, you can add those lines in your localconfig.js file:

localizer.where('Layer').if({id: 'hillshade'}).then({'status': 'off'});
localizer.where('Layer').if({id: 'contour_line'}).then({'status': 'off'});

Open the map on Kosmtik

From the root of your kosmtik instance, run:

node index.js serve path/to/hdm/project.yml

Then browse to http://localhost:6789

Export map

Export a tiles tree:

node index.js export path/to/hdm/project.yml --format tiles --output path/to/output/ --minZoom 10 --maxZoom 14

Export a MBTiles file:

node index.js export path/to/hdm/project.yml --format mbtiles --output path/to/output.mbtiles --minZoom 10 --maxZoom 14