Comments (8)
@yohanboniface thanks for raising this. The way I've imagined handling this is to have the client do two different symbolization/render passes on the layer, once for the actual geometries, and once for the labels. It seems that the underlying data is only needed once, but that different rendering rules should be applied to them at different times. (Of course, I'm unsure how compatible that is with current renderers, but this repo is also mean to focus more on forward-looking use cases for vector tiles and is itself a bit experimental.) Does this make sense?
from vector-datasource.
Yep, it makes sense, sure. :)
But in practice this prevent from using this repo as source for mapnik based rendering. AFAIK, it's not possible, at this stage at least, to have twice a given layer in the mapnik stylesheet (I may be wrong). For sure it's not possible within a CartoCSS toolchain.
So clearly, for performance, both server side and bandwidth side, not duplicating info would be much better. But in the meantime, my opinion is that Mapnik is the minimum target for a vector source, so unless there is a smarter option, I would go on splitting geometries and labels layers when it makes sense.
cc-ing @springmeyer that may have good lights on this.
from vector-datasource.
I admit it's been years since I mucked with Mapnik XML files, I'm all WebGL these days :) We should look further into the options, perhaps it's possible to duplicate the data source in Mapnik and just point it to the same source twice (the datasource element is replicated for each layer if I recall). Not sure about Carto...
from vector-datasource.
Separate layers for labeling are not a hard restriction in mapnik/cartocss/mapbox-studio, but rather a performance optimization common to a lot of sample projects and vtile sources.
For example, for fastest rendering and most reliable label placement it is ideal to use pre-calculated centroids for labeling polygons. Or for labeling lines you'll commonly want to filter out a reduced selection of lines that make sense to label in order to avoid clutter. Finally once you've decided that a custom layer for labels makes sense it then also makes sense to drop all attributes on the (non-label) layer containing all the geometries to save space. Doing all this at vtile production can produce better and faster rendering results with very little extra payload. Or in some cases your vtiles might even be smaller because attributes take up a lot of space. So, this is the reason you see a variety of custom label layers available in the vtile sources for Mapbox.
But again this is not a hard restriction at all. And generic vtile sources that try to be "one size fits all" are valid, quicker to produce, and can still be used with renderers like Mapnik. For example @yohanboniface if you want to use one linear layer to render both lines and labels you can simply render them in two passes using CartoCSS attachments (https://github.com/mapbox/mapbox-studio/blob/mb-pages/docs/0000-01-01-symbol-drawing-order.md#attachment-ordering). And if you want to render many different layers, many with labels, and maintain all the labels on top you can also do that. It's just more complicated that a single CartoCSS attachment. If using Studio you can use the {id}.{class}
syntax to refer to the same layer twice in whatever order you need: https://github.com/mapbox/mapbox-studio/blob/mb-pages/docs/0000-01-01-advanced-features.md#custom-layer-order. If not using Studio then it may be even easier - you just need to form up a Mapnik XML that refers to the same vtile layer twice by name.
from vector-datasource.
Thanks @springmeyer! All makes sense, I imagine we might add label layers at some point for all the reasons you mention, but I had always been assuming they could be rendered from one generic source like this in the meantime.
from vector-datasource.
Thanks @springmeyer :)
About attachment, my experience was that they allow to draw twice a same geometry, but the order they are drawn is still the order of the data layers, not the order they are defined in the stylesheets. What I mean is that an attachment is still drawn with the layer it belongs to. Am I wrong?
I was not aware about the syntax trick to have a given layer listed more than once in the project.yml file, and that really nice! As you may guess, I'm using Kosmtik, which doesn't know about that trick, but I know the guy who maintains it, so I may convince him to support this nice feature :)
Thanks again!
from vector-datasource.
It works, thanks a lot, Dane :)
So you and @bcamper deserve a Thank You Map :)
from vector-datasource.
Amazing :)
Closing this and will open an issue to consider label layers in the future.
from vector-datasource.
Related Issues (20)
- Consider applying grid thinning to more places zooms
- Remove road properties at zoom 14 and 15 HOT 1
- Excessive road names at zoom 15 HOT 1
- Landuse layer min_zooms too detailed and prevents merging
- Geometry shifts substantially between NE and OSM in boundaries layer
- French regions and province boundary lines show too early HOT 1
- Upgrade to NE v5.1.0 HOT 1
- Add top-level-countries DBF from Natural Earth HOT 5
- Add kind_detail for country places HOT 2
- Always x-check country labels against Natural Earth HOT 2
- Add TLC POV from Natural Earth HOT 1
- Export label x and y values from TLC and ISO country tables HOT 1
- Switch to NE for country labels
- High zoom kind=unrecognized country label bug HOT 1
- Road simplification
- For buildings, add root_id = id HOT 1
- Python 3 support
- Rename `disputed_relation_overpass_query.txt` to `disputed_relation_overpass_query.overpassql` HOT 6
- Add to Taginfo Projects
- Problem with min_zoom in Earth layer in v1.9.0 HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vector-datasource.