Tulip-Dev / tulip

Large graphs analysis, drawing and visualization framework
http://tulip.labri.fr/
GNU Lesser General Public License v3.0
125 stars 24 forks source link

GeographicView: Allow offline use and custom tile layer support #151

Closed anlambert closed 5 years ago

anlambert commented 5 years ago

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:

  1. 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.

  2. 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. image

  3. Now launch Tulip, create a Geographic View and copy paste the tiles layer url in the new dedicated part of the Options widget: image

  4. 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. image

Configuration for custom tiles layer will also be saved in the associated Tulip project file.

p-mary commented 5 years ago

Thanks for this new feature.