diff --git a/docs/deployment.rst b/docs/deployment.rst index 3dff3ae..98aecb0 100644 --- a/docs/deployment.rst +++ b/docs/deployment.rst @@ -2,7 +2,7 @@ Deployment ========== -Typically - you should use nginx/lighttpd/apache on the frontend - and the tileserver-gl server is hidden behind it in production deployment. +Typically, you should use nginx, lighttpd or apache on the frontend. The tileserver-gl server is hidden behind it in production deployment. Caching ======= @@ -17,4 +17,4 @@ Nginx can be used to add protection via https, password, referrer, IP address re Running behind a proxy or a load-balancer ========================================= -If you need to run TileServer GL behind a proxy, make sure the proxy sends ``X-Forwarded-*`` headers to the server (most importantly ``X-Forwarded-Host`` and ``X-Forwarded-Proto``) to ensures the URLs generated inside TileJSON etc. are using the desired domain and protocol. +If you need to run TileServer GL behind a proxy, make sure the proxy sends ``X-Forwarded-*`` headers to the server (most importantly ``X-Forwarded-Host`` and ``X-Forwarded-Proto``) to ensure the URLs generated inside TileJSON, etc. are using the desired domain and protocol. diff --git a/src/serve_rendered.js b/src/serve_rendered.js index 69a04de..e95dbf3 100644 --- a/src/serve_rendered.js +++ b/src/serve_rendered.js @@ -301,9 +301,11 @@ export const serve_rendered = { }); if (z > 2 && tileMargin > 0) { + const [_, y] = mercator.px(params.center, z); + let yoffset = Math.max(Math.min(0, y - 128 - tileMargin), y + 128 + tileMargin - Math.pow(2, z + 8)); image.extract({ left: tileMargin * scale, - top: tileMargin * scale, + top: (tileMargin + yoffset) * scale, width: width * scale, height: height * scale });