Repository navigation
Conversation
The user decided one stacking order for every provider on every platform, bottom to top: raster layers < ground images < polygons (native and polygon tiles) < circles < polylines < markers (native and marker tiles). zIndex orders within a band; equal keys keep the order they were handed over in. Providers had drifted (TomTom rasters on top of polygons, ground images jumping above polygons after a re-send, circles under polygons on GL providers and ArcGIS). OverlayStacking carries the band order and two tools, one per kind of native API: flatZIndex() for SDKs that compare one number across kinds (Google Maps), and insertBefore()/OverlayLayerStack for SDKs that keep an ordered list of style layers (MapLibre, Mapbox, Mappls). The layer position is computed from the style's current list each time, so it does not depend on add order, re-sends or style reloads. CircleController.zIndex goes from 3 (same as polygons) to 4. Nothing reads the controller zIndex; it is aligned with the band order so it does not say otherwise. OverlayStackingTest pins the band order, that flatZIndex never crosses a band for any Int zIndex, and that insertBefore produces the same order whatever order layers are added in. Public API: additions only.
This was referenced Nov 8, 2026
Open
Open
Open
Open
Open
Open
Open
Open
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
なぜ
利用者の決定で、すべてのプロバイダ・3 プラットフォームで、オーバーレイを下から次の順に重ねます。
追加した順・送り直した順(clearOverlays の後など)・デザイン変更の後に左右されません。帯の中は zIndex、同じ zIndex なら渡された順です。
プロバイダごとに重なり順がばらばらでした(TomTom のラスターがポリゴンを覆う、送り直した GroundImage がポリゴンより上に来る、GL 系でサークルがポリゴンの下になる、など)。
何を変えたか
OverlayStackingを足しました。帯の順と、ネイティブ API の種類ごとの道具を持ちます。flatZIndex(): 種類をまたいで 1 つの数で比べる SDK(Google Maps)向け。帯ごとに区間を分け、zIndex がどんな Int でも帯をまたぎません。insertBefore()/OverlayLayerStack: スタイルのレイヤー一覧を持つ SDK(MapLibre・Mapbox・Mappls など)向け。差し込む位置を毎回スタイルの今の一覧から求めるので、追加の順・送り直し・スタイルの読み直しに左右されません。CircleController.zIndexを 3(ポリゴンと同じ)から 4 にしました。読む箇所はありませんが、帯の順と食い違わないように揃えています。OverlayStackingTest: 帯の順、flatZIndexが帯をまたがないこと、insertBeforeが追加の順に依らず同じ並びになることを固定しています。公開 API は追加のみ(apiCheck)。直す前と後(このプラットフォームのプロバイダ)
SDK の制約で守れないもの
地図のラベルとの関係(今のまま)
今のままにしています。MapLibre・Mapbox・Mappls・Longdo はラスターをベースマップの最初のラベルの下、ほかのオーバーレイはラベルの上です。Mapbox Standard はベースマップが import なので POI などのラベルは図形の上に出ます。Google はラベルを図形の上に描きます。MapTiler はベースマップのレイヤー一覧が取れないので、ラスターもラベルの上です(制約)。
検証
2026-11-08 に develop(fix/mapview-teardown、fix/geodesic-polygon-fill、fix/clear-followups、refactor/polygon-controller などのマージ後)の上に載せ直してから確かめています。
OverlayStackingTestを含む。落ちたのは develop でも落ちる 2 つだけ)。apiCheck: この PR の.apiの差分は追加のみ。*OverlayStackingを通っています。stacking の外でaddLayer*を呼ぶ箇所はありません)。fix/clear-strategy+ この PR 一式 + MapTiler の restore を合わせた APK)で、普通に追加・逆の順・clearOverlays → 送り直し・デザイン変更 を撮り直しました。確認できていないもの
.apiの取り残し)。関連 PR(
fix/overlay-stacking-orderの一式)マージの順番:
fix/clear-strategyの一式(先に入れる想定。衝突はしないことをgit merge-treeで確認済み)fix/maptiler-overlay-restoreの上に載せています(同じ削除処理を両方が書き換えたため)。先に restore の PR(Remove style layers and sources by object so they can come back android-for-maptiler#17)を入れてください。