Once the mbtiles file downloaded and stored in a local directory, a server must be executed to serve the tiles to Leaflet. The best and easiest to use I found so far is tileserver-gl. In a terminal, go to the directory where you put the tiles bundle and start the server using docker with the following command:
$ docker run --rm -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl
Please note that the klokantech/tileserver-gl docker image must also be downloaded or built a priori if you intend to use Tulip without an active internet connection.
Now navigate to http://localhost:8080 and get the XYZ url of the tiles layer of interest.
Now launch Tulip, create a Geographic View and copy paste the tiles layer url in the new dedicated part of the Options widget:
Use the dropdown menu in the upper left part of the view ans select the Custom Tile Layer (Leaflet) entry. Tiles are now served by your local server.
Configuration for custom tiles layer will also be saved in the associated Tulip project file.
That PR adds support for using the Geographic View without an active internet connection (#130).
First, Leaflet source code is embedded and retrieved from Qt resources instead of getting it through a CDN.
Second, users can now supply an url to a custom tile layer that will be consumed by Leaflet. Notably an url pointing to a local server is allowed.
The instructions below explain how to setup a tile layer served from a local server:
To be able to serve tiles locally, a tiles bundle must be downloaded a priori. The easiest and free solution is to get one from https://openmaptiles.com/. As an example we will use the lightweight Satellite Lowres raster tiles Planet bundle.
Once the mbtiles file downloaded and stored in a local directory, a server must be executed to serve the tiles to Leaflet. The best and easiest to use I found so far is tileserver-gl. In a terminal, go to the directory where you put the tiles bundle and start the server using docker with the following command:
$ docker run --rm -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl
Please note that theklokantech/tileserver-gl
docker image must also be downloaded or built a priori if you intend to use Tulip without an active internet connection. Now navigate to http://localhost:8080 and get the XYZ url of the tiles layer of interest.Now launch Tulip, create a Geographic View and copy paste the tiles layer url in the new dedicated part of the Options widget:
Use the dropdown menu in the upper left part of the view ans select the
Custom Tile Layer (Leaflet)
entry. Tiles are now served by your local server.Configuration for custom tiles layer will also be saved in the associated Tulip project file.