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

Handling duplicately named vtile source layers / Ability to filter features on source #20

Closed
springmeyer opened this issue Jul 26, 2013 · 4 comments

Comments

@springmeyer
Copy link
Contributor

Compositing vtiles requires a decision on how to handle layer names within and across vtiles that might clash or be duplicates. The current plan is to allow duplicate names / render everything, but allow calling applications to differentiate (say for styling) the features that come from mapnik::vector::tile_datasource.

So, two vtiles composted together that both have a buildings layer but come from difference tile sources could be differentiated like:

#buildings {
  [source='data-virginia'] {
     polygon-fill:red;
  }
  [source='data-DC'] {
     polygon-fill:blue;
  }
}

Where source or some other magic attribute keyword would report the name of the vtile as originally passed to the compositing code:

var sources = [{name:'data-virginia',source:vtA},{name:'data-DC',source:vtB}
@ccarse
Copy link

ccarse commented Aug 1, 2013

Could something like this work?

#buildings {
     polygon-opacity:0.5;
}
#data-virginia.buildings {
     polygon-fill:red;
}
#data-DC.buildings {
     polygon-fill:blue;
}

To me this is more logical. Just seems backwards specifying source inside layer. Of course I'm looking at this with very ignorant eyes so feel free to tell me why this is an idiotic suggestion :)

@gravitystorm
Copy link

@ccarse I'd prefer avoiding repurposing labels like that. If #buildings means "a layer called buildings" then #data-virginia should be a layer called data-virginia, rather than a datasource. Similarly, the .buildings would mean a selection of layers with class .building, rather than having that name.

@springmeyer yes, since layer names are (typically) not under the cartographers control, there's going to be conflicts. If there's another magic attribute keyword then we need to be careful about confusions with attributes of that layer (e.g. if the layer has name,population,source attributes)

Is there some CSS-ish way to approach it, using descendant selectors? For example, something like this:

div.nav ul {font-size:1.1em;}

could become

sources#data-virginia #buildings { polygon-fill:red; }

It's of course stretching things slightly, since ids are supposed to be unique and don't need such scoping, but it could also open up more complex behaviour like attaching classes to sources.

@nyurik
Copy link

nyurik commented Aug 11, 2015

Here's the scenario we ran into with kartotherian - we pre-generate vector tiles as PBFZs, but sometimes our map designer changes one or two layers (SQL queries), so instead of re-running ~15 SQL queries for all layers, we want to run just the changed ones, merge them with the existing tile -- overriding the changed layers, or deleting them if there was no result), and saving the new tile. The result tile source (unfinished, not tested) uses the method I described in the GIS stackexchange post -- copying one layer at a time via JSON to a new tile:

newVectorTile.addGeoJSON(vectorTile.toGeoJSON('water'), 'water');

@flippmoke
Copy link
Member

This has been changed as part of the v2 specification (https://github.com/mapbox/vector-tile-spec/). It is now no longer valid to have two layers of the same name within a vector tile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants