-
Notifications
You must be signed in to change notification settings - Fork 30
Help
- Once you have the plugin installed, you can add a vector tile layer by using one of the two menus:
- Layer > Add Layer > Add Vector Tiles Layer...
- Vector > Vector Tiles Reader > Add Vector Tiles Layer...
- Connect to a predefined server by clicking on Connect or create an own connection
- As soon as the connection has been established, the available layers are shown in the list and the Add button is enabled. Click it. If you wish to only load specific layers, select them by clicking on it (CTRL+Click for multi selection). To clear the selection, click into the white area in the layer-list.
- The tiles matching your current canvas extent will be loaded*.
- If the source is a mbtiles file and none of its tiles are inside the bounds, the tiles will be loaded anyway. However, the tile limit is still respected.
A directory can be used as extremly fast tile source. To make that work, some conditions have to be fulfilled:
In the root folder of the directory-structure, there needs to be a file metadata.json with about the following content (TileJSON alike):
- minzoom (required)
- maxzoom (required)
- vector_layers (required, either directly or in the value json (see the example below, it contains both, vector_layers directly and as json in through the key json)
- scheme (optional, 'xyz' will be assumed if not available)
- bounds (optional, world-bounds will be assumed if not available)
- crs / srs (optional, EPSG:3857 will be assumed if not available)
Furthermore, the directory (starting from the folder where the metadata.json is located) requires the following structure:
/{z}/{x}/{y}.pbf
Example:
The tile (1,2) from zoom-level 0 will be located at:
/root-dir/
metadata.json
/0
/1
/2.pbf
Example
{
"attribution": "",
"basename": "osm_line_small",
"bounds": "[8.22821,47.20934,8.28255,47.23532]",
"center": "[8.25538,47.22233,2]",
"description": "osm_line_small",
"format": "pbf",
"id": "osm_line_small",
"json": "{\"vector_layers\":[{\"description\":\"\",\"fields\":{\"access\":\"\",\"addr:housename\":\"\",\"addr:housenumber\":\"\",\"addr:interpolation\":\"\",\"admin_level\":\"\",\"aerialway\":\"\",\"aeroway\":\"\",\"amenity\":\"\",\"area\":\"\",\"barrier\":\"\",\"bicycle\":\"\",\"boundary\":\"\",\"brand\":\"\",\"bridge\":\"\",\"building\":\"\",},\"id\":\"planet_osm_line\",\"maxzoom\":22,\"minzoom\":0}]}",
"maxzoom": 6,
"minzoom": 0,
"name": "osm_line_small",
"vector_layers": [{
"maxzoom": 14,
"fields": {
"class": "String"
},
"minzoom": 0,
"id": "water",
"description": ""
}, {
"maxzoom": 14,
"minzoom": 0,
"id": "waterway",
"description": ""
}, {
"maxzoom": 14,
"fields": {
"class": "String",
"subclass": "String"
},
"minzoom": 0,
"id": "landcover",
"description": ""
}, {
"maxzoom": 14,
"fields": {
"class": "String"
},
"minzoom": 0,
"id": "landuse",
"description": ""
}, {
"maxzoom": 14,
"minzoom": 0,
"id": "mountain_peak",
"description": ""
}
]
}
Such a directory structure (including the required metadata.json) can be generated by MBUtil:
mb-util World_Light.mbtiles /target/directory
Layers are automatically created in groups. The root node of the layer tree will be named like the connection the data is loaded from. Then each layer will be placed in a group with the same name as the layer. Since there are three geometric types (Point, LineString and Polygon) at most three layers will be in one group. Once a layer is in a group, it won't be removed or renamed, only its datasource will be updated.
If you wish to load more data, you can use the reload functionality: Vector > Vector Tiles Reader > Reload Notice, that this option is only enabled, if you'd already successfully connected to a source. The reload option only works for the current connection.
The plugin comes with multiple data sources, ready to use.
There are mbtiles file coming with the plugin. The folder containing the sample files opens automatically if a new file connection is created and the browse button is clicked. If that doesn't work or you've already navigated away, the files can be found at '%userprofile%/.qgis2/python/plugins/vector_tiles_reader'.
Several predefined connections are already included and can be used by just clicking "Connect" and "Add".
If the option Limit the number of loaded tiles is enabled, this is the maximum number of tiles, that will be loaded from the source. If this limit is hit, i.e. if there are more tiles that could be loaded, a notification will be shown in QGIS.
If enabled, the layers will be created in a predefined ordering, that is shown below.
- place
- housenumber
- water_name
- transportation_name
- poi
- boundary
- transportation
- building
- aeroway
- park
- water
- waterway
- landcover
- landuse
After a connection to any source has been established, tiles for the currently visible extent can be loaded by clicking Load features overlapping the view extent ({your source name})
If the option Merge Tiles is enabled, overlapping features on the same layer will be merged into one feature. This can be useful if you want to analyze areas, that are overlapping tile boundaries. Notice, that this makes the loading process significantly slower.
The zoom level for which the tiles will be loaded can either be set to "Max. Zoom" or it can be set manually. Notice, that not all sources provide the necessary metadata to automatically determine the minimum and maximum available zoom levels.
In the inspection mode, the tiles will stay untouched and displayed as received from the source. In all other modes, Points located outside of its tile, will be removed.
The plugins makes use of some caching in order to improve the reloading performance. The cache can be cleared by Vector > Vector Tils Reader > Clear Cache