From ccad4854a0d0ec119b530be904fefccc1423f197 Mon Sep 17 00:00:00 2001 From: Andrew Calcutt Date: Sat, 14 Oct 2023 21:07:09 -0400 Subject: [PATCH] docs: update docs Signed-off-by: Andrew Calcutt --- docs/config.rst | 48 +++++++++++++++++++++++++++++++++++++++---- src/serve_rendered.js | 2 +- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index fbeb35e..be049c8 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -180,11 +180,27 @@ Each item in this object defines one style (map). It can have the following opti ``data`` ======== -Each item specifies one data source which should be made accessible by the server. It has the following options: +Each item specifies one data source which should be made accessible by the server. It has to have one of the following options: -* ``mbtiles`` -- name of the mbtiles file [required] +* ``mbtiles`` -- name of the mbtiles file +* ``pmtiles`` -- name of the pmtiles file or url to the file. -The mbtiles file does not need to be specified here unless you explicitly want to serve the raw data. +For example:: + + "data": { + "source1": { + "mbtiles": "source1.mbtiles" + }, + "source2": { + "pmtiles": "source2.pmtiles" + }, + "source3": { + "pmtiles": "https://foo.lan/source3.pmtiles" + } + } + + +The data source file does not need to be specified here unless you explicitly want to serve the raw data. Referencing local files from style JSON ======================================= @@ -207,9 +223,33 @@ For example:: } Alternatively, you can use ``mbtiles://{zurich-vector}`` to reference existing data object from the config. -In this case, the server will look into the ``config.json`` to determine what mbtiles file to use. +In this case, the server will look into the ``config.json`` to determine what file to use by data id. For the config above, this is equivalent to ``mbtiles://zurich.mbtiles``. +PMTiles +------- + +To specify that you want to use local pmtiles, use to following syntax: ``pmtiles://switzerland.pmtiles``. +To specify that you want to use a http based pmtiles, use to following syntax: ``pmtiles://https://foo.lan/switzerland.pmtiles``. +The TileServer-GL will try to find the file ``switzerland.pmtiles`` in ``root`` + ``pmtiles`` path. + +For example:: + + "sources": { + "source1": { + "url": "pmtiles://switzerland.pmtiles", + "type": "vector" + }, + "source2": { + "url": "pmtiles://https://foo.lan/switzerland.pmtiles", + "type": "vector" + }, + } + +Alternatively, you can use ``pmtiles://{zurich-vector}`` to reference existing data object from the config. +In this case, the server will look into the ``config.json`` to determine what file to use by data id. +For the config above, this is equivalent to ``pmtiles://zurich.mbtiles``. + Sprites ------- diff --git a/src/serve_rendered.js b/src/serve_rendered.js index 47a3a10..91af39f 100644 --- a/src/serve_rendered.js +++ b/src/serve_rendered.js @@ -6,8 +6,8 @@ import path from 'path'; import url from 'url'; import util from 'util'; import zlib from 'zlib'; -import sharp from 'sharp'; // sharp has to be required before node-canvas on linux but after it on windows. see https://github.com/lovell/sharp/issues/371 import { createCanvas, Image } from 'canvas'; +import sharp from 'sharp'; // sharp has to be required before node-canvas on linux but after it on windows. see https://github.com/lovell/sharp/issues/371 import clone from 'clone'; import Color from 'color'; import express from 'express';