Skip to content

Commit 0ce9ed7

Browse files
authored
Merge pull request #5 from pnorman/tilekiln
Improve tilekiln configuration
2 parents 110646a + c055e11 commit 0ce9ed7

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
t-rex-config.toml
2+
shortbread_config

config/shortbread.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,13 @@ if osm2pgsql.mode == 'create' then
6464
-- themepark:plugin('t-rex'):write_config('t-rex-config.toml', {})
6565

6666
-- Enable if you want to create a config file for the Tilekiln tile server.
67-
-- (You must also create the directory 'tk'.)
67+
-- (You must also create the directory 'shortbread_config'.)
6868
--
69-
-- themepark:plugin('tilekiln'):write_config('tk')
69+
-- themepark:plugin('tilekiln'):write_config('shortbread_config', {
70+
-- tileset = 'shortbread_v1',
71+
-- name = 'OpenStreetMap Shortbread',
72+
-- attribution = '<a href="https://www.openstreetmap.org/copyright">© OpenStreetMap</a>'
73+
-- })
7074

7175
-- Enable if you want to create a taginfo project file.
7276
--

config/shortbread_gen.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,13 @@ if osm2pgsql.mode == 'create' then
9696
-- })
9797

9898
-- Enable if you want to create a config file for the Tilekiln tile server.
99-
-- (You must also create the directory 'tk'.)
99+
-- (You must also create the directory 'shortbread_config'.)
100100
--
101-
-- themepark:plugin('tilekiln'):write_config('tk')
101+
-- themepark:plugin('tilekiln'):write_config('shortbread_config', {
102+
-- tileset = 'shortbread_v1',
103+
-- name = 'OpenStreetMap Shortbread',
104+
-- attribution = '<a href="https://www.openstreetmap.org/copyright">© OpenStreetMap</a>'
105+
-- })
102106
end
103107

104108
-- ---------------------------------------------------------------------------

lua/themepark/plugins/tilekiln.lua

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ local lyaml = require 'lyaml'
3333

3434
function plugin:build_sublayer_config(main_layer, sub_layer)
3535
local config = {
36-
minzoom = sub_layer.tiles.minzoom or 0,
37-
maxzoom = sub_layer.tiles.maxzoom or 14,
38-
extent = sub_layer.tiles.extent or 4096,
39-
buffer = sub_layer.tiles.buffer_size or 10,
36+
minzoom = sub_layer.tiles.minzoom or self.minzoom,
37+
maxzoom = sub_layer.tiles.maxzoom or self.maxzoom,
38+
extent = sub_layer.tiles.extent,
39+
buffer = sub_layer.tiles.buffer_size,
4040
}
4141

4242
local mvt = 'ST_AsMVTGeom("' .. sub_layer.geom_column .. '", {{unbuffered_bbox}}, {{extent}}, {{buffer}}) AS way'
@@ -99,17 +99,19 @@ end
9999

100100
function plugin:write_config(directory, options)
101101
self.directory = directory
102+
self.minzoom = options.minzoom or 0
103+
self.maxzoom = options.maxzoom or 14
102104

103105
if not options then
104106
options = {}
105107
end
106108

107109
local config = {
108110
metadata = {
109-
id = 'v1',
110-
name = options.tileset or 'osm',
111+
id = options.tileset or 'mytiles',
112+
name = options.name,
111113
attribution = options.attribution or plugin.themepark.options.attribution,
112-
version = '0.0.1',
114+
version = options.version,
113115
},
114116
vector_layers = {}
115117
}

0 commit comments

Comments
 (0)