Once you insert your vector tiles into MapTiler Server, you need a map style that defines what your map will look like. This article shows how to work with map styles in MapTiler Server.
There are ready-to-use map styles prepared by our team that covers most of the use-cases and perfectly fit the MapTiler Data. Alternatively, you can download a third-party map style and adjust it or create your own from scratch.
MapTiler map styles
Download the ready-to-use map styles packed together with sample data.
In the same folder, you use for storing data, create /maps folder, here create a new folder for each map style and place the style.json into the subfolder (you will get e.g. /home/yourusername/maptiler-server/maps/maptiler-streets/style.json).
All map styles are available in the Maps tab.
If you replace the sample data by maps downloaded from MapTiler Data, your maps will be automatically styled with all the map styles you have there.
If you add a new style, click on the Re-scan button and it will immediately appear here.
Replace sample data with your MapTiler Data
If you want to replace sample data with your own MapTiler Data, you have two options:
-
rename the downloaded file to
maptiler-osm.mbtiles
and replace the sample data file with it -
edit your favorite map style (e.g. maps → streets → style.json) and on the very bottom of the file, replace the URL of the source with the filename of data you downloaded
-
e.g replace
"url": "#maptiler-osm"
with"url": "#osm-2020-09-07-v3.11_europe_andorra.mbtiles"
if you want to this map style to serve map of Andorra
-
Referencing locally served resources in your style.json
MapTiler Server supports special syntax for referencing local resources in your style.json.
If you use value "#" for property "glyphs", all requested font files will be served from directory "${workDir}/fonts/".
If you use value "#" for property "sprite", all sprite files (sprite.json, sprite.png, sprite@2x.json, sprite@2x.png) will be served from directory "${workDir}/maps/yoursMapId/".
If you would like to refer tiles served by your MapTiler Server, use value "#{tilesId}" in property "url" of the source object e.g.
Values not starting with the "#" prefix are considered as external references. This can lead to slower tile rasterization due to used network requests instead of direct file read.
Use your maps
Now you can start serving your maps.
Comments
0 comments
Please sign in to leave a comment.