* fix: allow sprite array in styles
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: add 'sprite/' to generated path
So it doesn't conflict with style json url
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: allow old sprite endpoints to work
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: lint
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* docs: add multi-sprite name to endpoint
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: duplicate styleJSON.sprite
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: try to fix some codeql errors
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: try to fix some codeql errors
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: try to fix some codeql errors
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: try to fix some codeql errors
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: try to fix some codeql errors
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: lint
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: ci sprite issue
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: remove console.log's
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: use sprite id instead of name
Signed-off-by: acalcutt <acalcutt@techidiots.net>
* fix: add suggestions
Signed-off-by: acalcutt <acalcutt@techidiots.net>
* fix: remove unneeded array check
Signed-off-by: acalcutt <acalcutt@techidiots.net>
* fix: lint
Signed-off-by: acalcutt <acalcutt@techidiots.net>
* fix: don't force multi-sprites in style
Signed-off-by: acalcutt <acalcutt@techidiots.net>
* fix: move fixUrl and allowedOptions to utils
Signed-off-by: acalcutt <acalcutt@techidiots.net>
* fix: add test for default sprite
Signed-off-by: acalcutt <acalcutt@techidiots.net>
* fix: lint
Signed-off-by: acalcutt <acalcutt@techidiots.net>
---------
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
Signed-off-by: acalcutt <acalcutt@techidiots.net>
* fix: tilesize should not be added to data endpoint
* fix: make tilesize and option of addtilejson urls
* docs: update tilesize info for index.json and rendered.json
* fix: lint
* fix: try to add attribution to wmts
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: 512 tiles being wrong level for maplibre-js
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: revert wmts zoom level hack
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: test tileMargin
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: remove broken mercator_512 change
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: put back mercator
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* Revert "fix: try to add attribution to wmts"
This reverts commit b8d858f2c6d6354ea54a7fe18d08bb50d8f28219.
* fix: put back if
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: semicolon
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: semicolon
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: lint
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: center without mercator_512
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: put back const
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: lint
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: text
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
---------
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* test: using 512px rendered tiles
Based on https://github.com/maptiler/tileserver-gl/pull/495
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: use static renderer at zoom 0
renderer is not able to change the size of tile to more than 512px in tile mode
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* Add support for 512 sized raster tiles (#1)
* Enable setting tilesize for raster tiles
* Serve correct endpoint for raster tiles
* Add 256 & 512 sized raster layers to wmts getCapabilities document
* Update wmts getCapabilities tileMatrixSets
* Add rendered tiles format for getTileUrls method
* Update endpoints documentation
* Add and fix tiles_rendered tests
* fix: formatting
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: corrent bad merge
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: if tile size is undefined don't add it
needed for data endpoint right now
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: set tile size in raster endpoints to 512
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: add semicolon
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: lint
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: test z1 512px file that actually exists
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: make tileSize optional
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: cleaner if statement
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* docs: update tileSize to show as optional
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: allow tile size in data url
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: remove unneeded tileSize
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: set data as 256 tileSize for consistency
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* docs: add note about optional data tileSize
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: lint
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* Revert "fix: remove unneeded tileSize"
This reverts commit a4583161bf53653d65a4606c407ba9b5249d1061.
* fix: allow tile size to be set at json endpoints
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: set default endpoint tilesizes
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: don't use tilesize one data endpoint
It doesn't do anything
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: default style endpoint to undefined
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: zoom 0 workaround
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* Revert "fix: zoom 0 workaround"
This reverts commit 0f3bbd765c9c151016cec66768675f990676c8b3.
* fix: limit min zoom to 1 in viewer
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: put back orig string
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* docs: add optional tilesize to TileJSON
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: cleanup thumbnails
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: default undefined like other data endpoints
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: move data xyz_link
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: remove console.log
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: lint
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* chore: update version
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: update path
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: join error
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: revert path change
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
---------
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
Co-authored-by: Petteri Pesonen <teemu.p.pesonen@gmail.com>
* chore: fix crash on ARM during rendering
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
* chore: remove useless comment
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
---------
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
Promise code never worked: listFonts did not wait for fs.stat() to resolve().
This was not evident because late results were still used.
A recent PR made it worse: late results are now ignored.
This manifested for styles with missing fonts, no fallback could be used.
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
Maplibre-native outputs premultiplied pixels values. The sharp library did not
support it so we added code to cancel the alpha premultiplication.
Note that this can only visible onr raster tiles (and probably static maps).
The sharp library now supports premultiplied pixels with the right config.
Let's use it: it should be faster and easie to maintain.
Feature announced here:
https://github.com/lovell/sharp/issues/1599#issuecomment-837004081
Feature developped here by @mnutt:
https://github.com/lovell/sharp/pull/2685
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
* chore: make sure error exit codes of tests are returned
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
* chore: replace the last 'var' with 'const'
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
* chore: extract duplicated font listing
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
* chore: extract rendering functions to a new file
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
* chore: move nested respondImage() function to top level
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
* chore: simplify respondImage() args
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
* chore: fix typo in rendeAttribution
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
---------
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
Root cause: modified regex in #1002 caused URLs to be broken.
Fixed by reverting previous regexes.
Tests:
* Confirmed by building and running locally with formerly breaking config.json and style json.
* Run tests via Dockerfile_test
Adds pmtiles support to TileServer-GL
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
Signed-off-by: Michael Nutt <michael@nuttnet.net>
Co-authored-by: Michael Nutt <michael@nuttnet.net>
* chore: cleanup useless decodeURIComponent() calls
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
* chore: try to fix CodeQL failure "Polynomial regular expression"
Fix 1:
\d\.?\d* can backtrack catastrophically
\d(\.\d*)? is safer
Fix 2:
Useless parenthesis around "enc:"
Fix 3:
The httpTester regex was misleading. It did not really check for "http".
Simplified to show its true meaning. The behaviour should not have changed.
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
* chore: try to optimize the regex further, to fix CodeQL failure
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
* chore: consistency between previous changes, docs, and serve_style.js
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
---------
Signed-off-by: Martin d'Allens <martin.dallens@liberty-rider.com>
* fix: incorrect polyline decoding
Don't split static image encoded path on pipe or comma
Signed-off-by: boldtrn <boldtrn@gmail.com>
* fix: still allow other parameters other than enc:
That way we can still style individual paths
Signed-off-by: boldtrn <boldtrn@gmail.com>
* chore: lint
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* chore: lint + comment
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* docs: try to clarify path information
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: stroke color not working unless path is specified
i found this issue testing encoded paths. If width is not specifed, stroke color does not work
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
* docs: show different options
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
---------
Signed-off-by: boldtrn <boldtrn@gmail.com>
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
Co-authored-by: Andrew Calcutt <acalcutt@techidiots.net>
* fix: don't crash the server on processing issues
Use a try/catch for async functions
Signed-off-by: boldtrn <boldtrn@gmail.com>
* chore: run lint
Signed-off-by: boldtrn <boldtrn@gmail.com>
---------
Signed-off-by: boldtrn <boldtrn@gmail.com>
* fix: allow to style each individual path for static images
Signed-off-by: Samuel Leihkamm <s.leihkamm@gmx.com>
* chore: cleanup drawPath render function
Signed-off-by: Samuel Leihkamm <s.leihkamm@gmx.com>
---------
Signed-off-by: Samuel Leihkamm <s.leihkamm@gmx.com>
* Use center and zoom from style json as default center for tilejson of rendered maps
* Round zoom as style spec allows fractional zooms while tilejson spec does not
* Handle SIGTERM
Resolve#781
* Add `Caught signal ...` messages
Container log when sending a `SIGHUP` signal and then a `SIGTERM` signal using
`docker kill --signal ...` :
```
Starting tileserver-gl v4.4.8
[INFO] Automatically creating config file for zurich_switzerland.mbtiles
[INFO] Only a basic preview style will be used.
[INFO] See documentation to learn how to create config.json file.
Run with --verbose to see the config file here.
Starting server
Listening at http://[::]:8080/
Startup complete
Caught signal SIGHUP, refreshing
Stopping server and reloading config
Starting server
Listening at http://[::]:8080/
Startup complete
Caught signal SIGTERM, stopping gracefully
```
Note that the numeric signal values, as used in the shell version, were
replaced by signal names, as used in nodeJS.
* run 'npm run lint:js:fix'
---------
Co-authored-by: acalcutt <acalcutt@techidiots.net>
* Add Docker Healthcheck
Fixes#635
* Update Dockerfile_light
* Update healthcheck.js
fix healthcheck output error: "file:///usr/src/app/src/healthcheck.js:1\nvar http = require(\"http\");\n ^\n\nReferenceError: require is not defined in ES module scope, you can use import instead\nThis file is being treated as an ES module because it has a '.js' file extension and '/usr/src/app/package.json' contains \"type\": \"module\". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.\n at file:///usr/src/app/src/healthcheck.js:1:12\n at ModuleJob.run (node:internal/modules/esm/module_job:193:25)\n at async Promise.all (index 0)\n at async ESMLoader.import (node:internal/modules/esm/loader:526:24)\n at async loadESM (node:internal/process/esm_loader:91:5)\n at async handleMainPromise (node:internal/modules/run_main:65:12)\n"
* update version
Co-authored-by: acalcutt <acalcutt@techidiots.net>
* extended staticmap capabilities
* added allowRemoteMarkerIcons configuration option and restricted fetching of remote marker icons only when option is set to true;
asynchronously load all available icons in a settings object on server startup;
replaced fs.existsSync() call in serve_rendered when drawing marker icons with a check against available icons settings object;
* updated documentation for linecap parameter in staticmaps endpoint;
added linejoin parameter to staticmaps endpoint;
* added capability of staticmap endpoint to draw multiple paths
In WMTS the publicUrl path was missed and it was not working properly.
Similar story about wmts.tmpl: the baseUrl is not working properly when
tileserver is hidden behind the proxy with different root path.
* Minor bugfix: make baseUrl always use '/' in the end
Co-authored-by: Oleksandr Shyshatskyi <oshyshatskyi@cloudlinux.com>
Co-authored-by: acalcutt <acalcutt@techidiots.net>
* switch to esm module
* Update package.json
* change to maplibre package
* fix tests
* eslint
* remove extra package updates
* Delete package-lock.json
* change 'fs' to 'node:fs'
* put back node 10.
without the package updates this still works
* remove trailing commas
* remove unassociated fix / formatting
* remove unassociated fix
* remove eslint from this PR
* remove unassociated fix
* lint
* Merge remote-tracking branch 'upstream/master' into esm_update
* fix mlgl
* update maplibre-native to new version with arm64
* update minor version