Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement MB GL style sheets by mapping them to QGIS styles #87

Closed
sfkeller opened this issue Sep 29, 2017 · 19 comments
Closed

Implement MB GL style sheets by mapping them to QGIS styles #87

sfkeller opened this issue Sep 29, 2017 · 19 comments
Assignees
Milestone

Comments

@sfkeller
Copy link

Implement style sheets that conform to the Mapbox Style Specification by mapping them to QGIS styles.
Rather big issue!
Could re-use parts of https://github.com/mapbox/mapbox-gl-native ?

@sfkeller
Copy link
Author

  1. The river style generated (e.g. Limmat in Zurich) looks as if the line width is much too large, especially in zoom levels 12,11... down to 6: The style has about 10 pixel size, whereas it should be about 2 pixels.
  2. There are currently way too much labels from layer place and "mountain peak". So, it seems that there is a rule missing which filters them according to the "rank" attribute (values 11,12)?

snapshot

@sfkeller sfkeller added this to the Milestone 2 milestone Nov 16, 2017
@mnboos
Copy link
Collaborator

mnboos commented Nov 17, 2017

There is no auto-generated style included yet, because the development is not complete yet. I can show you a preview of a generated style:

image

@klokan
Copy link
Contributor

klokan commented Nov 30, 2017

I am looking forward to trying https://github.com/mnboos/mapbox-gl-style-to-qgis in this plugin.

@sfkeller
Copy link
Author

(@mnboos is working mo and Fr, so stepping in): Did you try to install the latest plugin code from branch 'develop' as instructed here https://github.com/geometalab/Vector-Tiles-Reader-QGIS-Plugin ?

I think we're still having issues with labels being displayed up to 2 to 4 times because they are in the buffer "area" of 4 neighbouring tiles.

Questions to @klokan:

  • It seems that Leaflet (resp. mapbox-gl-leaflet plugin) is handling those redundant labels, correct?
  • If yes, do you know how (in order to get a solution in QGIS)?

@tomchadwin
Copy link
Contributor

I think we're still having issues with labels being displayed up to 2 to 4 times because they are in the buffer "area" of 4 neighbouring tiles.

Ironically exactly the same issue I have faced today (with no way to solve) in Leaflet.VectorGrid:

qgis2web/qgis2web#566 (comment)

It's why I added a "me too" to the request for a unique ID field, @klokan:

openmaptiles/openmaptiles#303 (comment)

And also why I mentioned it (out of context) in the Geoserver MBVT issue:

#112 (comment)

@klokan
Copy link
Contributor

klokan commented Nov 30, 2017

It seems that Leaflet (resp. mapbox-gl-leaflet plugin) is handling those redundant labels, correct?

mapbox-gl-leaflet is embedding mapbox-gl-js in leaflet - so rendering of vector tiles is done by GL JS there. So, yes, correct - Mapbox GL JS does not have a problem with redundant labels.

If yes, do you know how (in order to get a solution in QGIS)?

I thought QGIS can clip the data for the tile extent before styling. If clipped, the labels should be drawn just once as buffers are removed and never loaded in QGIS.

QGIS is not clipping the styled drawn canvas like JavaScript clients - it is clipping the source data and styling them later on. Why not clip the source data?

... in Leaflet.VectorGrid

I see Leaflet rendering vector tiles into individual raster canvases:

screen shot 2017-11-30 at 17 35 15

If the labels are drawn in these canvases too - then each canvas should be drawn only from one vector tile.

If the labels are added to DOM as positioned elements - then you must clip the data to the tile extent - and remove the buffers before you draw them.

OpenLayers does not have the problem.

UPDATE: Labelgun can help to solve the problem too probably - simply by ensuring no overlapping labels are visible on the map. Does QGIS have such option for styling - to avoid label overlap?

BTW We are adding OSM-ID to the layers with labels in OpenMapTiles v3.7, which should be available latest by mid-Dec.
See my comment at athttps://github.com/openmaptiles/openmaptiles/issues/303#issuecomment-348094065

@sfkeller
Copy link
Author

sfkeller commented Nov 30, 2017

Clipping tiles is a very expensive - and therefore time consuming - operation...

@klokan
Copy link
Contributor

klokan commented Nov 30, 2017

You may clip by bbox just the point features, and not touch the polygons/lines, which are more expensive to process.

@mnboos
Copy link
Collaborator

mnboos commented Nov 30, 2017

Good idea. I did that already once. If this is done in the native decoder, we wouldn't even lose performance.

@mnboos
Copy link
Collaborator

mnboos commented Nov 30, 2017

Point clipping could be done always in my opinion.

@sfkeller
Copy link
Author

Yes - but don't clip in "Inspection Mode".

@sfkeller
Copy link
Author

sfkeller commented Dec 1, 2017

Coming back to styling, especially of labels:

  • It seems that somehow geographic names (like Greifensee in the example above) are not rendered as italic labels.
  • There are curved labels in the style as can be seen some street names. AFAIK QGIS can do this too.

@mnboos: Can you look at this?

@mnboos
Copy link
Collaborator

mnboos commented Dec 2, 2017

Will do.

@mnboos
Copy link
Collaborator

mnboos commented Dec 3, 2017

@sfkeller text-transform (https://www.mapbox.com/mapbox-gl-js/style-spec/#layout-symbol-text-transform) is now implemented. Italic doesn't seem to be available even in Mapbox GL Style and is therefore not implemented in the mapboxgl2qgis converter.

@mnboos mnboos closed this as completed Dec 3, 2017
@sfkeller
Copy link
Author

sfkeller commented Dec 3, 2017

Italic doesn't seem to be available even in Mapbox GL Style

Lake names and other geonames often are in italic in topographic maps. Look e.g. at "OSM Bright" syle from OMT (see figure below). Maybe it's just another font name the styles uses, so I assume the transformer can map to several QGIS fonts too, to get the same effect?
grafik

@mnboos
Copy link
Collaborator

mnboos commented Dec 3, 2017

Oops, didn't see that.

@mnboos mnboos reopened this Dec 3, 2017
@mnboos
Copy link
Collaborator

mnboos commented Dec 3, 2017

Ok, checked the style. Italic is only defined through the font. To make other fonts working, I'd have to download and install them. As this is intrusive and maybe not even safe, it's currently not supported by the converter.

 "layout": {
    "text-font": [
      "Open Sans Italic",
      "Klokantech Noto Sans Italic",
      "Klokantech Noto Sans CJK Regular"
    ],
    "text-size": 14,
    "text-field": "{name}",
    "text-max-width": 5,
    "text-rotation-alignment": "map",
    "symbol-placement": "line",
    "symbol-spacing": 350,
    "text-letter-spacing": 0.2
  }

@sfkeller
Copy link
Author

sfkeller commented Dec 3, 2017

Sometimes font's have properties saying they are regular/serif, bold, italic, etc.? If yes, you at least could map this property to the fonts installed in QGIS?

@mnboos
Copy link
Collaborator

mnboos commented Dec 4, 2017

Italic is now supported.

@mnboos mnboos closed this as completed Dec 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

4 participants