diff --git a/README.md b/README.md index 459e408..aa50faa 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ No web browser around? No worries - discover the planet in your console! * [ ] Viewport * [x] start with zoom level which shows full vector tile * [X] boundary based on current zoom & size - * [ ] determain tiles to show + * [X] determain tiles to show * [X] zoom while keeping center * [ ] calculate tile areas * [X] center based on mercator @@ -94,7 +94,7 @@ No web browser around? No worries - discover the planet in your console! * [ ] line drawing * [x] support for stroke width * [ ] support for dashed/dotted lines? - * [x] feature selection for priority rerendering (roads -> warter -> roads:bridges) + * [ ] feature selection for priority rerendering (roads -> warter -> roads:bridges) * [ ] label drawing * [x] support for point labels diff --git a/package.json b/package.json index db81018..7f8b1a4 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "request-promise": "^4.1.1", "sphericalmercator": "^1.0.5", "term-mouse": "^0.1.1", + "tilebelt": "^1.0.1", "vector-tile": "^1.3.0", "x256": "0.0.2" } diff --git a/src/Renderer.coffee b/src/Renderer.coffee index f4b107c..f08f755 100644 --- a/src/Renderer.coffee +++ b/src/Renderer.coffee @@ -19,7 +19,6 @@ utils = require './utils' module.exports = class Renderer cache: {} config: - baseZoom: 4 fillPolygons: true language: 'de' @@ -27,6 +26,7 @@ module.exports = class Renderer tileSize: 4096 projectSize: 256 + maxZoom: 14 #"poi_label", "water", drawOrder: [ @@ -115,7 +115,7 @@ module.exports = class Renderer @lastDrawAt = Date.now() _visibleTiles: (center, zoom) -> - z = Math.max 0, Math.floor zoom + z = Math.min @config.maxZoom, Math.max 0, Math.floor zoom xyz = tilebelt.pointToTileFraction center.lon, center.lat, z tiles = [] @@ -222,7 +222,7 @@ module.exports = class Renderer @output.write output _scaleAtZoom: (zoom) -> - baseZoom = Math.floor Math.max 0, zoom + baseZoom = Math.min @config.maxZoom, Math.floor Math.max 0, zoom (@config.tileSize/@config.projectSize)/Math.pow(2, zoom-baseZoom) _drawFeature: (layer, data, scale, zoom) -> @@ -256,6 +256,7 @@ module.exports = class Renderer when "Point" text = feature.properties["name_"+@config.language] or + feature.properties["name_en"] or feature.properties["name"] or feature.properties.house_num or #@config.icons[feature.properties.maki] or diff --git a/src/Termap.coffee b/src/Termap.coffee index 6a365a1..db280f0 100644 --- a/src/Termap.coffee +++ b/src/Termap.coffee @@ -46,9 +46,8 @@ module.exports = class Termap lat: 49.0189 lon: 12.0990 - minZoom: null - maxZoom: 14.9 + maxZoom: 18 constructor: (options) -> @config[key] = val for key, val of options