Skip to content

fix(carto): VectorTileLayer MVT tiles on GlobeView up to zoom 12 - #10869

Open
aaranadev wants to merge 1 commit into
visgl:masterfrom
aaranadev:fix/carto-vector-tile-layer-globe
Open

aaranadev wants to merge 1 commit into
visgl:masterfrom
aaranadev:fix/carto-vector-tile-layer-globe

Conversation

@aaranadev

@aaranadev aaranadev commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Closes #10867

Change List

  • VectorTileLayer: pass mvt.coordinates and mvt.tileIndex for MVT tiles, as MVTLayer does
  • VectorTileLayer: auto labels use the tile's geographic bbox for WGS84 MVT tiles
  • Unit tests, fail without the change
pr-10869-before-after

The repro from the issue at zoom 10. Left 9.4.0, right with this change applied.

Above zoom 12 MVT fills also need #10868. Seams along tile edges with translucent fills are #10716, as with MVTLayer.

VectorTileLayer overrides getTileData and does not pass the
`mvt.coordinates` and `mvt.tileIndex` load options MVTLayer passes, so
on a GlobeView viewport MVT tiles keep tile-relative coordinates and are
drawn as [lng, lat] near 0, 0. Pass them for MVT tiles, and compute
auto labels in the tile's geographic bounds when tiles are in WGS84.
@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] Adjusts how vector tiles render on globe versus flat maps.

Reloading cached tiles when switching coordinate frames should be fixed before merging.

Findings

  1. P1 Switching views moves cached features ▶

Summary

VectorTileLayer now requests WGS84 MVT coordinates for globe views and uses geographic bounds when creating polygon labels.

  • CARTO MVT tiles and polygon labels match the active viewport’s coordinates.

Reviews (1) · Last reviewed commit: "fix(carto): VectorTileLayer MVT tiles on..." · Reviewed by Greptile

Comment on lines +109 to +113
loadOptions = mergeLoadOptions(loadOptions, {
mvt: {
coordinates: this.context.viewport.resolution ? 'wgs84' : 'local',
tileIndex: tile.index
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Switching views moves cached features

Tiles loaded in GlobeView now cache WGS84 coordinates. If the app switches to MapView while keeping the same layer ID and data, those tiles are not reloaded. A later style change rebuilds their layers, and MVTLayer.renderSubLayers applies the tile-relative transform to the cached longitude and latitude values. Features then appear in the wrong places.

Reload cached tiles when the viewport changes coordinate frames, and rebuild their layers after the reload.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, but this isn't specific to this PR: MVTLayer behaves the same, since it also picks wgs84/local per request and never reloads when the viewport changes frame. With a plain MVTLayer on 9.4.0 and a MapLibre globe, zooming 11.6 → 12.4 and restyling drops the fills, and 12.4 → 11.6 misplaces features without any restyle. VectorTileLayer inherits updateState from MVTLayer, so the fix belongs there. I'll open a separate issue and PR and keep this one scoped.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That distinction is fair. The cache/frame transition is pre-existing in MVTLayer and inherited by VectorTileLayer, so it isn’t a regression introduced by this PR. Given the separate issue/PR you’re planning, I’ll withdraw this comment and keep the review scoped to the MVT loading and labeling changes here.

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

@aaranadev

Copy link
Copy Markdown
Contributor Author

Opened #10870 and #10871 for the tile reload when the viewport changes frame.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

[Bug] VectorTileLayer draws MVT tilesets at the wrong place on a globe up to zoom 12

1 participant