From 4af6fb686f885a9dbb432cb191bb0219b895507d Mon Sep 17 00:00:00 2001 From: Petr Sloup Date: Mon, 27 Jun 2016 07:52:01 +0200 Subject: [PATCH] Change bearing and pitch format in static url --- README.md | 2 +- src/serve_rendered.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9bb9ca1..1a4526b 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ See https://github.com/klokantech/tileserver-gl-data/blob/master/config.json - Available formats: `png`, `jpg` (`jpeg`), `webp` - TileJSON at `/styles/{id}/rendered.json` - Static images are rendered at: - - `/styles/{id}/static/{lon},{lat},{zoom}[,{bearing},{pitch}]/{width}x{height}[@2x].{format}` (center-based) + - `/styles/{id}/static/{lon},{lat},{zoom}[@{bearing}[,{pitch}]]/{width}x{height}[@2x].{format}` (center-based) - `/styles/{id}/static/{minx},{miny},{maxx},{maxy}/{width}x{height}[@2x].{format}` (area-based) - `/styles/{id}/static/auto/{width}x{height}[@2x].{format}` (autofit path -- see below) - The static image endpoints additionally support following query parameters: diff --git a/src/serve_rendered.js b/src/serve_rendered.js index 278d345..c98d924 100644 --- a/src/serve_rendered.js +++ b/src/serve_rendered.js @@ -408,15 +408,15 @@ module.exports = function(options, repo, params, id) { ':scale(' + SCALE_PATTERN + ')?\.:format([\\w]+)'; var centerPattern = - util.format(':lon(%s),:lat(%s),:z(\\d+):bearing(,%s)?:pitch(,%s)?', + util.format(':lon(%s),:lat(%s),:z(\\d+)(@:bearing(%s)(,:pitch(%s))?)?', FLOAT_PATTERN, FLOAT_PATTERN, FLOAT_PATTERN, FLOAT_PATTERN); app.get(util.format(staticPattern, centerPattern), function(req, res, next) { var z = req.params.z | 0, x = +req.params.lon, y = +req.params.lat, - bearing = +((req.params.bearing || ',0').substring(1)), - pitch = +((req.params.pitch || ',0').substring(1)), + bearing = +(req.params.bearing || '0'), + pitch = +(req.params.pitch || '0'), w = req.params.width | 0, h = req.params.height | 0, scale = getScale(req.params.scale),