Skip to content
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.

render min-tile-zoom & max-tile-zoom #65

Closed
mourner opened this issue Jun 24, 2014 · 17 comments
Closed

render min-tile-zoom & max-tile-zoom #65

mourner opened this issue Jun 24, 2014 · 17 comments
Milestone

Comments

@mourner
Copy link
Member

mourner commented Jun 24, 2014

We need to be able to define the zoom range of tiles a feature appears/gets processed on (in render options).

Currently we hide features when when not needed with opacity = 0, but it's not a good practice (since transparent features still get processed, placed, etc., wasting CPU time).

Should we call this min-tile-zoom? Or just min-zoom? Or have it prefixed, like icon-min-zoom?

@mourner mourner added the v3 label Jun 24, 2014
@kkaefer
Copy link
Member

kkaefer commented Jun 24, 2014

We discussed this too and decided to leave it out for now. In most instances where we show/hide features based on zoom level, the vector tile doesn't actually contain any data for zoom levels where we want to hide the data, so this seems like no big issue. Are you seeing instances of data where this is not the case?

@mourner
Copy link
Member Author

mourner commented Jun 24, 2014

@kkaefer one particular example is POIs which get loaded on zoom 15 but are too dense on this level and usually appear later in styles (e.g. starting z16.5 in outdoors).

@nickidlugash
Copy link
Contributor

In most instances where we show/hide features based on zoom level, the vector tile doesn't actually contain any data for zoom levels where we want to hide the data, so this seems like no big issue. Are you seeing instances of data where this is not the case?

I think this assumes that the style being created is very similar to the Mapbox Streets style. If you want to create something very different, this is often not the case. There's variability across styles on when a lot of features first show up: buildings, roads/bridges/tunnels of various classes and lengths, minor features such as barriers and aeroways, many labels, and more.

Also, I chatted with @yhahn last night about a couple examples of where min/max zooms would be helpful for switching render properties of features at certain zoom levels. E.g.:

Switching from "text-field": "{{ref}}" to "text-field": "{{name}}" for airports:

z13
airport-z13

z14
airport-z14

Switching from a marker on a point + translated text to non-translated text on a point:

z7
city-z7

z8
city-z8

^ This particular example also has "text-transform": "uppercase" starting at z8.

@mourner
Copy link
Member Author

mourner commented Jun 24, 2014

We agreed to implement this now, as it's a low hanging fruit.

@nickidlugash
Copy link
Contributor

I think this was stated in chat, but just to confirm: for styles involving render property switches, implementing this would allow us to create two different layers for the same feature, and set the max zoom for layer1 equal to the min zoom of layer2?

@kkaefer
Copy link
Member

kkaefer commented Jun 24, 2014

@nickidlugash Yes. However, you have to specify exclusive ranges like this:

  • feature 1 as max-tile-zoom: 14
  • feature 2 as min-tile-zoom: 15

to ensure that feature 1 and 2 are never visible at the same time.

@nickidlugash
Copy link
Contributor

@kkaefer in your example, what happens between zoom 14 and 15? Does feature 1 remain enabled?

@kkaefer
Copy link
Member

kkaefer commented Jun 25, 2014

in this example, a number always covers [ N, N +1 [, e.g. from 14 = 14.00 to 14.999. In other words, the number refers to the tile's zoom level.

@mourner
Copy link
Member Author

mourner commented Jun 25, 2014

Holding on this until we have #67 and #68 settled.

@mourner
Copy link
Member Author

mourner commented Jul 8, 2014

@ansis says that it might make a lot of sense to move out those properties to the layer level, out of render (similar to type moving out suggestion #80), and thinking about it, I agree — it would look better there, because it affects both the render step and the drawing step, having kind of a special meaning compared to render properties.

@mourner mourner modified the milestones: v4, v3 Jul 8, 2014
@mourner mourner closed this as completed in 8b2bec5 Jul 8, 2014
mourner added a commit to mapbox/mapbox-gl-js that referenced this issue Jul 8, 2014
@kkaefer kkaefer mentioned this issue Jul 9, 2014
@kkaefer
Copy link
Member

kkaefer commented Jul 17, 2014

Is this property going to be inherited with ref? Or should the style parser change the shared buckets so that the min/max range includes that of all layers?

@kkaefer
Copy link
Member

kkaefer commented Jul 17, 2014

@kkaefer
Copy link
Member

kkaefer commented Jul 17, 2014

How does this work when overzooming? E.g. you specify a min-zoom of 15, but the vector tile of z14 doesn't create the bucket.

@mourner
Copy link
Member Author

mourner commented Jul 17, 2014

@kkaefer layer min-zoom is enforced on bucket level only when it is less than source maxZoom (which is now passed to the worker) https://github.com/mapbox/mapbox-gl-js/blob/dev-pages/js/worker/workertile.js#L202

@kkaefer
Copy link
Member

kkaefer commented Jul 17, 2014

The source's maxZoom?

@mourner
Copy link
Member Author

mourner commented Jul 17, 2014

@kkaefer yeah, the one that is grabbed from tileJson, e.g. 14 in this case. This assumes that when you overzoom, a new tile will get loaded unless it's a zoom after vector tile's maxZoom. If you see a better approach to this, let me know — this could probably be improved.

@mourner
Copy link
Member Author

mourner commented Jul 17, 2014

In other words, the only minor issue with this approach is that e.g. when a layer has minZoom = 12 and you zoom in past 12, the layer still won't appear until a new tile is loaded (and corresponding buckets parsed). But this looks like an expected behavior.

kkaefer added a commit to mapbox/mapbox-gl-native that referenced this issue Jul 17, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants