Use MapTiler vector tiles on local (offline) QGIS instance
The article describes a way, how to download data, setup local instance of MapTiler Server, and use the data e.g. QGIS for later offline usage.
In the case, you are offline, you still can pre-download MapTiler Data and display them
e.g. using QGIS or a web browser. For this, you need 3 things:
- The data at this site
- MapTiler Server, download from here
- If you need a desktop GIS, use QGIS and install the MapTiler QGIS Plugin
With the QGIS Plugin, you already can display all our maps. But this solution describes, how to see your data offline.
###
Step 0: Register at MapTiler.com service
Most of the data and configuration files are available, some of them for free, but you have to register yourself in our service account. Go to e.g. https://cloud.maptiler.com and Sign in
###
Step 1: Download the data
Go to https://data.maptiler.com and download the requested dataset. NOTE: Most of the datasets are free, but if you go into the bigger level of detail, they are paid. Once you have your maptiler-…*.mbtiles file secured, proceed to step 2.
###
Step 2: Download basic styles as a ZIP file
To be able to see the data, you need to download and unzip basic styles. We are providing the styles available at https://data.maptiler.com/maps/ NOTE: you have to be registered into our services
Once the data and styles are downloaded, start the MapTiler Server.
###
Step 3: Download and Start the MapTiler Server
After you download the MapTiler server for your computer (use the free download link from MapTiler Server Page. Once installed, start the server.
You may use the command line for this. In Linux systems, start the Terminal application (usually available if you press Ctrl+Alt+t). On Windows, you have to run the cmd.exe command from the menu.
maptiler-server –adminPassword YOUR_PASSWORD –workDir C:\data\maptiler-data\
The –adminPassword parameter will set administrator password and --workDir parameter will set target directory, where necessary data and configuration will be stored. On Windows, you may use something like c:\path\to\data\dir, on Linux, it will look like /home/user/data/dir.
###
Step 4: Upload data and styles to MapTiler Server
Open the Web browser and go to the URL http://localhost:3650/admin. After login Drag & Drop the downloaded styles (as a ZIP file) to the administrative interface.
You will get a basic set of map styles and data tiles samples.
Go to Tiles (http://localhost:3650/admin/tiles) and drag & drop the downloaded MBtiles file.
You will get a new dataset along with the two samples.
###
Step 5: Change data ID
The map Styles and data Tiles are bound together. The Styles (Basic, Topo, Streets, …) are referring to the data Tiles by unique ID. We just need to switch it, to make the server use the correct input data.
- Go to the MapTiler Data (Zurich sample)
- Change the ID from maptiler-osm to maptiler-osm-zurrich (see picture lower)
- Go to uploaded custom Tileset and change the ID to maptiler-osm
Now check the maps and they all should use the newly uploaded dataset.
###
Step 6: Start QGIS and use the MapTiler plugin to read the data from the local MapTiler Server Instance
In QGIS, right-click on the MapTiler data source and pick Add a new map … selection option.
In the dialogue, set the name for your new map and insert the style.json URL.
After saving, you should see a new layer in the data catalog and you should add it to QGIS.
Conclusion
As a result of the process, you should now see the following:
- You have your own copy of the data on your computer
- You have running MapTiler Server on your computer, you can now share it with your colleagues who are in your network.
- Your QGIS instance is displaying local data from the local MapTiler server instance, you can go offline, and everything will work - as long as MapTiler Server is running.