Skip to content

Instantly share code, notes, and snippets.

@yohanboniface
Created September 29, 2014 17:32
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yohanboniface/dc95cf060e709c83fe67 to your computer and use it in GitHub Desktop.
Save yohanboniface/dc95cf060e709c83fe67 to your computer and use it in GitHub Desktop.
Example of Kosmtik localconfig files used for HDM rendering
exports.LocalConfig = function (localizer, project) {
var country = 'burundi',
centers = {
hispaniola: [-71.7325, 19.1075, 9],
burundi: [29.9377, -3.4216, 9],
sierraleone: [-13.2366965, 8.4732210, 9],
chad: [16.56874, 8.68063, 9],
mauritania: [-11.558, 19.725, 9]
};
project.mml.compareUrl = "http://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png";
localizer.where('center').then(centers[country]);
localizer.where('Layer').if({'Datasource.type': 'postgis'}).then({
"Datasource.dbname": country,
"Datasource.password": "",
"Datasource.user": "ybon",
"Datasource.host": ""
});
localizer.where('Layer').if({id: 'hillshade'}).then({'Datasource.file': '/home/ybon/Code/maps/hdm/DEM/data/hillshade.vrt'});
localizer.where('Layer').if({id: 'contour_line'}).then({'Datasource.file': '/home/ybon/Code/maps/hdm/DEM/data/contour-25m.shp'});
localizer.where('Layer').if({id: 'land-high'}).then({'Datasource.file': '/home/ybon/Data/geo/shp/land-polygons-split-3857/land_polygons.shp'});
localizer.where('Layer').if({id: 'land-low'}).then({'Datasource.file': '/home/ybon/Data/geo/shp/simplified-land-polygons-complete-3857/simplified_land_polygons.shp'});
};
[
{
"where": "center",
"then": [-70.7481114, 19.4959913, 9]
},
{
"where": "Layer",
"if": {
"Datasource.type": "postgis"
},
"then": {
"Datasource.dbname": "hispaniola",
"Datasource.password": "",
"Datasource.user": "ybon",
"Datasource.host": ""
}
},
{
"where": "Layer",
"if": {
"id": "hillshade"
},
"then": {
"Datasource.file": "/home/ybon/Code/maps/hdm/DEM/data/hillshade.vrt"
}
},
{
"where": "Layer",
"if": {
"id": "contour_line"
},
"then": {
"Datasource.file": "/home/ybon/Code/maps/hdm/DEM/data/contour-25m.shp"
}
},
{
"where": "Layer",
"if": {
"id": "land-high"
},
"then": {
"Datasource.file": "/home/ybon/Data/geo/shp/land-polygons-split-3857/land_polygons.shp"
}
},
{
"where": "Layer",
"if": {
"id": "land-low"
},
"then": {
"Datasource.file": "/home/ybon/Data/geo/shp/simplified-land-polygons-complete-3857/simplified_land_polygons.shp"
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment