Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[Core] Fix wrong maxzoom setting of tileSet when using URL source #15581

Merged
merged 5 commits into from
Sep 17, 2019

Conversation

zmiao
Copy link
Contributor

@zmiao zmiao commented Sep 6, 2019

Fix: #15501

The pre-condition is we try to download an offline pack from an URL source, and the source's maxzoom(let's say zoom level 17) is higher than the maxzoom(let's say zl12) we downloaded for the offline pack.
Next we try to use the offline pack from a style that having the same URL source plus a maxzoom option zl12, the final rendering result is different from JS.

The problem is the ignorance of maxZoom option in style, which leads to wrong setting of the zoomRange in tileSet, zl17 is set instead of zl12. If we need the map to be overscaled to zl14, the renderable TileID should be overscale Zoom 14 plus canonical Zoom12.

However, zl17 as the max zoom in zoomRange is higher than zl14, zl14 is not taken as overscaled. With offline database of maxzoom 12, there is no way to find tiles in zl14. it tries to check zl14's children, and apparently, with offline, there won’t be more children for zl14. Then it starts to down grade the overScaled zoom by 1, so from 13, then 12, until it found tiles with zl12. So the rendenrable TileId we finally created has oversacalZ 12 instead of 14.

It finally causes incorrect overscaledZ value is passed to symbolLayout, so the rendering result of symbols is different when comparing with JS.

@asheemmamoowala
Copy link
Contributor

@zmiao I don't understand how this PR addresses the issue in #15501. Specifically, how will the vector source be updated with maxZoom base don the offline region that was previously downloaded. And how will that be used when online vs offline?

There may be value in adding the functionality as proposed here, but it's not clear how that would be exposed in the SDKs.

@andrewharvey
Copy link
Contributor

@zmiao I don't understand how this PR addresses the issue in #15501.

@asheemmamoowala As I understand, the original description of #15501 was a side issue, ie. "While debugging an issue...". It looks like this PR fixes that original issue that #15501 refers too. @zmiao's description of this PR does seem to explain the issue I originally had and does as far as I can tell without testing it, appear it would fix the original issue.

@zmiao zmiao changed the title [Core] Fix wrong maxzoom setting of tileSet when using offline database [Core] Fix wrong maxzoom setting of tileSet when using URL source Sep 12, 2019
@zmiao
Copy link
Contributor Author

zmiao commented Sep 12, 2019

@asheemmamoowala, the pr will fix issue of #15501 and the customer issue.

The issue of #15501 is when using an URL source in online mode, even though in the style the maxzoom option is set to zl12, we are still be able to download tiles from zl17. This is because in core, we ignore the maxzoom option with URL source, the tileRange value of tileSet is directly set by the value fetched from the tileJSON requested by the URL, which is zl17, that's why tiles in zl17 is still available.

Then it was further pointed out in #15501 that there was sparse symbols rendered with offline pack, which is related to the customer's original issue.

The customer issue is that there was obvious differences of rendering appearance between JS and the core with offline pack. The root cause is the wrong maxzoom value in the tileRange downscaled the overZoomed tileID, which is what I explained in the description block.

Thanks to the comments, I realized the title and the description is kind of misleading.

@zmiao zmiao requested a review from 1ec5 as a code owner September 17, 2019 08:34
@zmiao zmiao requested a review from a team September 17, 2019 08:34
src/mbgl/style/conversion/source.cpp Outdated Show resolved Hide resolved
@zmiao zmiao merged commit 0a219d1 into master Sep 17, 2019
@zmiao zmiao deleted the zmiao-fix-maxzoom branch September 17, 2019 15:00
@julianrex julianrex added this to the release-ristretto milestone Sep 17, 2019
@andrewharvey
Copy link
Contributor

I tested out the SNAPSHOT release and as far as I can tell it fixes the issue!

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

Successfully merging this pull request may close these issues.

[core] maxZoom source option allows downloading tiles at higher zooms
5 participants