Skip to content

Draw large polygon sets as raster tiles (PolygonTiler) - #17

Merged
wf9a5m75 merged 5 commits into
developfrom
feat/polygon-tiling
Nov 9, 2026
Merged

wf9a5m75 merged 5 commits into
developfrom
feat/polygon-tiling

Conversation

@wf9a5m75

@wf9a5m75 wf9a5m75 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

何をするか

多数のポリゴン(既定: 2,000 個以上または頂点 50,000 以上)を、ネイティブの図形ではなくラスタータイルとして描きます(PolygonTilingOptions / PolygonTiler)。web・Android・iOS で同じ設計です。

  • タイルは SDK のタイルサーバー(web はサービスワーカー、ネイティブは LocalTileServer)で描きます。ズームごとに画素格子へ丸めて簡略化し、外周と穴の巻きを逆にそろえて nonzero で塗ります。
  • タップ判定は従来どおり PolygonManager が元の形で行います(InfoBubble などは今までどおり)。
  • タイルにできなくなった変更(geodesic にする、経度幅 180° 以上、3 点未満)が入ったポリゴンは、その場でネイティブ描画へ戻ります。
  • ボストン全域の区画(98,815 件・穴あり)と建物(105,599 件)で確認しています。

このリポジトリで変えたこと

  • ポリゴンタイルをラスターレイヤーとして表示(upsert / removeById 相当。アプリのラスターを消さない)。
  • develop で conductor が消え、core の PolygonController を継承する Controller になったので、conductor 側のタイル化は捨てました(core が受け持ちます)。塗りの描き直しから、タイルで描くポリゴン(polygon が null)を除きます。
  • ポリゴンタイルを POLYGON_TILE(ポリゴンの帯の一番下)に置きます。

develop の取り込み

このブランチは push 済みだったので、rebase せず origin/develop を merge commit で取り込みました。

  • 親 android-sdk(feat/polygon-tiling)で core / compose / kml / geojson / icons と各プロバイダの testDebugUnitTest: core 350 件ほか全部 pass(OMM は develop から引き継いだ 1 件の失敗のみ。android.util.Log.isLoggable がテストでモックされていない)。apiCheck: 全モジュール ok(増えた API はベースラインに追加)。
  • タブレット実機(MapLibre / Google / Mapbox)でボストンの区画 98,815 件: タイルで描かれ、街区(穴)が正しく、タップで InfoBubble。重なり順は GroundImage < ポリゴンタイル < サークル < ポリライン < マーカー(MapLibre / Google)。MapLibre で頂点ドラッグの追従。Google ↔ MapLibre の切り替え 10 往復で Native Heap が頭打ち(89〜96 MB。スクラッチ Bitmap のプール化の前は 156 MB まで増え続けた)。

マージの順番

この機能は複数のリポジトリにまたがります。android-sdk-core → android-sdk-compose(feat/polygons)→ 各 android-for- → android-sdk(親)* の順にマージが要ります。

この PR は大きな機能なので、マージするかはレビューのうえで判断してください。

The polygon controller gets a PolygonTiler, whose tiles are shown through
the raster layer path the marker tiles use (upsert / removeById, outside
the app's RasterLayer composition). Tiled polygons stay registered for taps
and give the map SDK nothing.

The polygon tile layer goes where the SDK's polygon layers do: over the
basemap, under polylines and markers.
core's PolygonController.destroy() releases its tiler (02369fa), but this
provider's own polygon conductor does not extend it and its destroy() was
empty, so the tile server kept every destroyed map's tiled polygons.
…change makes it untileable

Setting geodesic on a tiled polygon in place, or giving it points that span
half the world or fewer than three, kept it in the tiles. update() now checks
canTile and, when it fails, takes the polygon out of the tiles and draws it
natively. It stays on the map, so this is not an add.
develop replaced the polygon conductor with a controller that extends core's
PolygonController, which already routes polygons through the tiler, moves an
untileable one to native drawing, and disposes the tiler on destroy. The
conductor's tiling is dropped with it; the fill renderer now leaves out the
tiled entities (no features) when it redraws.

The polygon tiles are stacked with OverlayStacking: at the bottom of the
polygon band (over raster layers and ground images, under circles, polylines
and markers), where the anchor list used to put them.
Additions only: the polygon tiles' stacking key, and declarations develop
added without running apiDump (TILE_REFRESH_COALESCE, and on ArcGIS the
marker controller's constructor that takes a boolean).
@wf9a5m75
wf9a5m75 merged commit 5544ec9 into develop Nov 9, 2026
2 checks passed
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.

1 participant