geometalab / Vector-Tiles-Reader-QGIS-Plugin

Vector Tiles Reader QGIS-Plugin - QGIS Python plugin which reads Mapbox Vector Tiles from a server, a local MBTiles file or a directory
http://plugins.qgis.org/plugins/vector_tiles_reader/
GNU General Public License v2.0
149 stars 30 forks source link

Known to work example #266

Open chebourne opened 5 years ago

chebourne commented 5 years ago

I can load tiles but am having problems with style not being applied - getting a 'Style generation failed' message.

Is there a TileJSON URL and GL Style JSON URL that is known to work so I can test?

mnboos commented 5 years ago

The predefined MapTiler (former OpenMapTiles) connections should do that. Did you use your own style?

chebourne commented 5 years ago

Found this eventually - had to dig into the style definition to get the TileJSON source.

You need to create an account on Maptiler website and then use this page to get the map style: https://cloud.maptiler.com/

So I came up with something like this for Basic style: TileJson: https://api.maptiler.com/tiles/v3/tiles.json?key= StyleJson: https://api.maptiler.com/maps/basic/style.json?key=

Substitute your key in of course.

This worked for me in QGIS but it does not work with my own styles - I have my own TileServer GL and styles.

My own server and styles work fine through the browser.

Is there anything to look out for in the style definition if you are creating them yourself and trying to use in Vector Tiles Reader?

chebourne commented 5 years ago

Actually, this is not working correctly with Maptiler sources - not all styles are being rendered correctly. Mainly place names e.g.: image

mnboos commented 5 years ago

That's correct and due to the fact, that the style converter is only an incomplete and experimental feature. The Mapbox GL Style specification is to big and fast changing in order for me to maintain a good working parser.

sfkeller commented 5 years ago

Pull requests are welcome :-).

tomchadwin commented 5 years ago

This probably merits its own thread, but I've just started using https://github.com/GeoCat/bridge-style to convert QGIS styles into Mapbox GL JS ones in qgis2web. There are stubbed out placeholders for conversions in the other direction. Perhaps offloading the work you have done so far on style conversion into that lib might be a way forward - since it's a generic style conversion lib, it might attract more contributors.

tomchadwin commented 5 years ago

bridge-style converts between various style formats by using the intermediate geostyler format. So MBGLJS conversion into Geostyler and then into QGIS would go in the following two files:

https://github.com/GeoCat/bridge-style/blob/master/bridgestyle/mapboxgl/togeostyler.py https://github.com/GeoCat/bridge-style/blob/master/bridgestyle/qgis/fromgeostyler.py