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

Mapbox not able to change the style of vector tiles at run time #6783

Closed
Amit-Gore opened this issue Jun 6, 2018 · 11 comments · Fixed by #6813
Closed

Mapbox not able to change the style of vector tiles at run time #6783

Amit-Gore opened this issue Jun 6, 2018 · 11 comments · Fixed by #6813
Labels

Comments

@Amit-Gore
Copy link

I am using tippecanoe command line utility to create my application vector tileset. This is creating a directory structure as per the z/x/y coordinates which is perfectly fine. I have a certain group of features(allocated with a layer) which do not need z to be up to 21 zoom level so it's creating the tiles up to zoom-level 14. It is critical in my case to not to waste the memory space by increasing the max-zoom to 21 for certain layer of features.

As per my understanding, mapbox gl-js queries for the vector tiles as per its coordinate space.

So during my zoom-in from 6 to 21, although zoom-level > 14 tile queries are responding with 404, gl-js is adopting the same tile which is available at 14.

The problem is,

If at zoom-level > 14, I trigger a style change by any mean upon current layer-tile it's not able to do that.

Is it trying to change the style of a tile which has responded with 404? Is it possible to make it change the available tile source obtained at zoom-level 14?

@jfirebaugh
Copy link
Contributor

If at zoom-level > 14, I trigger a style change by any mean upon current layer-tile it's not able to do that.

I'm having trouble understanding this. Can you explain in more detail what you're trying to do, what you expected to happen, and what happens instead? If you can create a small code example that shows it, that would be great.

@Amit-Gore
Copy link
Author

For example, If I click on any feature, I need that feature to be highlighted. I am doing it by filtering out the layers as :
//hiding the current layer
mapBox.setFilter(currentLayer, ["==",'gid', "_none_"]);

//showing only the clicked feature by filtering it out with a unique id it has
mapBox.setFilter(highlightedLayer, ["==",'gid', feature_gid]);

This works as expected for zoom < 14 but if zoom exceeds 14 (the max-zoom while tile creation) then it is not able to render the tile with applied layer style as it tries to fetch a tile which is not there on my server. So my question is if a source tile at particular zoom level is giving 404 then why not apply the layer style to whichever tile is available at zoom level 14 ?
at zoom < max-zoom used while tile creation
image
at zoom > max-zoom used while tile creation
image

@jfirebaugh
Copy link
Contributor

Okay, can you please create a minimal example that demonstrates the behavior so we can take a look?

@Amit-Gore
Copy link
Author

Ok. Sharing a fiddle link. I have created the feature tiles upto zoom level 9.

@jfirebaugh
Copy link
Contributor

Thanks, very clear now! I agree, it seems like a bug.

@Amit-Gore
Copy link
Author

Amit-Gore commented Jun 7, 2018

So if it is a bug, when can I expect the fix? Can you assist me in some right direction so that I can try to fix it myself ( if it takes more than few days to address it )?

@mb12
Copy link

mb12 commented Jun 7, 2018

@Amit-Gore There is a bug in the user code. Its adding a source with maxzoom=22. This means that the source is capable of serving tiles uptil zoom 22. If your source only has tiles uptil zoom 9, then the maxzoom value should be 9.

        map.addSource("compositeTiles",{
                "type": "vector",
                "tiles": ["https://vtiles-dev.farwide.com:1337/map_tiles/MO/Regulatory PG/{z}/{x}/{y}.pbf"],
                "minzoom": 0,
                "maxzoom": 22 <======This should be 9
        });


@stevage
Copy link
Contributor

stevage commented Jun 8, 2018

IMHO the documentation around the two meanings of maxzoom and minzoom could be clearer. I recently did some work in this area and it took quite a long time to really understand what's going on:

  • On a source (or in tilejson): "maxzoom: 14" means "tiles are available up to zoom 14"
  • On a layer: "maxzoom: 14" means "don't show this layer beyond zoom 14. If tiles are only available up to some zoom less than 14, then overzoom them as necessary".

Quite different meanings of maxzoom, easily confused.

@Amit-Gore
Copy link
Author

@mb12 Yes, that should resolve the problem for the scenario inside fiddle. But I have tiles created as per layer specific max zoom and I need to create a single source which joins all those layers tiles. In this case, I will have to provide a range of a zoom in which my source is available to provide tiles which in my case would be from 6 to 22. I think mapbox should implicitly be able to understand the source capability of serving tiles at runtime and should act accordingly.
@stevage true that.

@pathmapper
Copy link
Contributor

Maybe related? #5013

(Overzooming issues after merging tilesets with different maxzoom and buffer sizes in one single source.)

@Amit-Gore
Copy link
Author

@mollymerp is this issue has been resolved in the latest 0.46 release? I can still face this issue which has been demonstrated in fiddle link.

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

Successfully merging a pull request may close this issue.

5 participants