Repository navigation
Draw many polylines as tiles, with the Boston roads sample - #18
Merged
Merged
Conversation
…the map The overlay used to go two frames after the list was handed to the map, and the map then stayed empty while the SDK tiled the parcels (about 4.7 s on MapLibre and 4.6 s on Google, iPad). Each state now carries onAdded; the page counts the calls with a flag per building and a counter, ignores calls for a dataset it has since replaced, and drops the overlay when every shown state is on the map. "BOSTON added" is printed then. Bumps ios-sdk-core and the providers to feat/overlay-on-added.
The loading overlay never went for Downtown: the page waited for one onAdded per state, but the data lists three buildings twice and the map keeps one polygon per id, so 9,464 calls came for 9,467 states. Switching the area mid-load also stranded it: a building dropped from the list lost its flag, and the SDK calls onAdded again only for a polygon it saw leave -- not one whose list was replaced before it got there. Each call now records its id, and the count is redone against every list handed to the map; an id already on the map counts for the new list.
ios-for-maplibre, -mapbox, -maptiler and -mappls report tiled markers and polygon tiles once their tile layer is in a loaded style, not when it was handed over while the style was still loading.
The building ids (Overture's, 36 characters each) were most of every file, and the page is a polygon demo. MCPG v2 drops them: a polygon's id on the map is its index in the file. Counts and coordinates are zigzag varints of the same 1e-6 degree differences, a ring's closing vertex is not stored (the reader closes the ring again), and a header byte says which fields the file carries: height, land use (as an index), the downtown area, name. Same format as the React and Android samples. Downtown is now a v2 resource too (boston-downtown.bin, 0.25 MB, was 2.2 MB of JSON). The copied city files become boston-city-buildings.bin (2.1 MB, was 10.5) and boston-city-parcels.bin (4.0 MB, was 14.1). With unique ids the three downtown buildings listed twice (two parts each) are both drawn. The InfoBubble and the tap line show the area (outline less holes) where they showed the Overture id or the parcel id. The attribution stays. BostonDataTests (Benchmarks bundle, on device) decodes a fixture and the bundled file.
The city-wide buildings (2.1 MB) and parcels (1.9 MB) now ship in the app bundle (Resources) next to downtown; nothing has to be copied into Documents. The React sample's examples/basic/tools/boston/ builds them (see its README). MCPG v2 gains a header byte, digits: coordinates are integers of 10^-digits degree. Buildings and downtown stay at 1e-6; parcels are at 1e-5 with near-collinear vertices dropped (0.5 m). The decoding tests cover both units and check the bundled city files.
Points ios-sdk-core and the providers at their feat/overlay-on-added (feat/polygon-tiling for ios-for-longdo, which has no onAdded branch), each with feat/polygon-tiling and develop merged in.
A Polyline page like the Boston buildings one: Overture transportation segments (road subtype, cut at the city boundary; 54,645 polylines, 234,765 vertices, boston-city-roads.bin, 1.0 MB) coloured, widened and stacked by class, with a legend, the loading overlay counting onAdded up to every road, a tap that shows class, name and length in an InfoBubble at the closest point on the road, and a switch that turns polyline tiling off and loads again, timing the file to the last onAdded. A stacking check adds tiled polygons, a circle, a native (geodesic) polyline in a second Polylines and markers around Downtown Crossing. The MCPG v2 reader learns the road class (16) and lines (32) bits; the decoding test uses the fixture the React and Android tests share. Point ios-sdk-core and the providers at their polyline tiling commits.
…verlay-on-added Brings in the nine modules (template, geojson, heatmap, icons, icons-jp, icons-us, icons-weather, kml, marker-clustering) that polygon-tiling moved to the head of their develop.
This was referenced Nov 9, 2026
Contributor
Author
|
CI: Test と Public API Surface を workflow_dispatch で実行しました(https://github.com/MapConductor/ios-sdk/actions/runs/42699027311 、https://github.com/MapConductor/ios-sdk/actions/runs/42699032483 )。どちらも落ちますが、develop でも同じ落ち方です(https://github.com/MapConductor/ios-sdk/actions/runs/42699924247 、https://github.com/MapConductor/ios-sdk/actions/runs/42699931788 )。原因は ios-sdk-core/api/TOOLCHAIN が Xcode 27.2 を指定しているのにランナーに無いこと(API Surface もビルド段階で失敗)で、このブランチ由来ではありません。ios-sdk-core と ios-for-mapkit の PR の build は成功しています。 |
Contributor
Author
|
向け先を |
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.
なぜ
ポリゴンと同じように、ポリラインも数万本を渡せるようにするためです。ボストン市内の道路(54,645 本・234,765 頂点)をネイティブの線で描くと、iOS の Google で全 onAdded まで 114 秒・1.5 GB、Android の Google は Java ヒープが尽きて落ちます。ポリゴンのタイル化(
feat/polygon-tiling)と同じ仕組みで、多数のポリラインをラスタータイルとして描きます。設計の要点(web・Android・iOS で同じ)
Polylines(states):Polygonsと同じ形のまとめて渡す部品。そのインスタンスが足した id だけを足し引きするので、複数のPolylines/Polylineが同じ地図で共存できます(iOS は既存のPolylines(_:)のまま)。PolylineTilingOptions/PolylineTileSet/PolylineTiler/PolylineController.tiler: 名前と既定値(2,000 本以上または頂点 50,000 以上)はポリゴンと 1 対 1。レイヤー id はmc-polyline-tiles。ShapeTileSet/ShapeTiler/ShapeTileRendererに移し、Polygon*はその上の薄い層になりました。公開 API は追加のみです。polylineTilingOptions、Android は compose のPolylineTiling(options)、iOS はMapViewContent.polylineTilingOptions/PolylineTiling要素。このリポジトリで変えたこと
pages/polyline/boston/)。MCPG v2 の reader が種別(16)と lines(32)のビットを読む。読み込みの試験BostonRoadsDataTests。boston-city-roads.bin(1,019,811 B、gzip 597 KB): Overturetransportation/segment2026-10-21.0 の road を、Analyze Boston の市境で切ったもの。54,645 本・234,765 頂点(元 362,585)。1e-5°、直線上の頂点を 0.5 m で省く(両端は残す)。ID は持たず、種別(u8)と名前だけ。examples/basic/tools/boston/README.md。feat/polyline-tilingへ。feat/overlay-on-addedの追従で template・geojson・heatmap・icons 系・kml・clustering の 9 モジュールが develop の先頭へ進んでいます(polygon-tiling 側の変更)。検証(iOS、追従後の 4ea1d59)
scripts/api-surface.sh check): core と googlemaps 以外の 10 プロバイダ ok。core は +18 / -0(PolylineTiling・MapViewContent.polylineTilingOptions・PolylineTilingOptionsほか)、プロバイダは変化なし。時間とメモリ(ボストンの道路 54,645 本・234,765 頂点)
web(Chromium、Playwright。「全 onAdded / 次のフレーム」ms)
JS ヒープ(GC 後): MapLibre ⇄ Google をタイルで 4 往復 251.0 → 266.4 → 267.0 MB(2 往復目以降は横ばい)。ネイティブだと Google の時に 475 MB 前後。MapLibre ⇄ Leaflet は 251.1 → 253.2 MB。
Android(タブレット、MapLibre)
Google: タイル化ありで描画 0.87 s(録画)。ネイティブは OOM で落ちる(下記)。
メモリ: MapLibre ⇄ Google を 6 往復、PSS 899,652 K → 最大 1,060,426 K → 916,405 K、native heap 182,752 K → 181,524 K。増え続けません。
iOS(iPad、Release。「読み込み → 全 onAdded」と footprint)
ほかのプロバイダ(z16、タイル化あり): Mapbox 1,028 ms / 397 MB、MapTiler 914 / 310、Mappls 1,727 / 241、MapKit 1,021 / 393、ArcGIS 923 / 164、ArcGIS2D 943 / 370、HERE 1,175 / 483、TomTom 1,229 / 303、Longdo 2,499 / 144、OMM 895 / 394。
メモリ: MapLibre ⇄ Google を 8 往復、277 MB → 往復中 259〜396 MB → 260 MB。増え続けません。
挙動の変わる所
PolylineManager.find、タイルでもネイティブでも同じ)。許容距離 = 既存の指の大きさ(tapTolerance)+ 線幅 / 2。太い線は縁から指の大きさ以内であたります。複数あたれば最も近い線。外接矩形で先に候補を絞るので、5 万本でも毎タップ全点をなめません。返す位置(線上の最近点)は今までどおりです。OverlayStacking.rasterKey(styleLayerId:))。追加の順に関係なく、ポリラインのタイルがネイティブのポリラインの下に入ります。SDK の制約で重なり順を守れないもの
確認できていないもの
OutOfMemoryErrorで落ちます(GoogleMap.addPolyline→PolylineOptions.writeToParcel、Java ヒープが上限 512 MB に到達)。1 本ずつ Parcel に詰めて GMS に渡すためで、タイル化ありなら落ちません。このため Google のタイル化あり/なしの時間は並べられていません。OpenMobileMapsDriverConformanceTest1 件(develop のLog.isLoggableがモックされていない)、iOS ArcGIS・TomTom の単体テスト各 1 件、iOS Google のテストターゲットのビルド(GoogleMaps が iOS 17 を要求)。base について
ポリラインの差分だけをレビューできるように、base は
feat/overlay-on-added(feat/polygon-tiling+ onAdded + ボストンのサンプル。そのリポジトリに無い場合は develop)にしています。feat/polygon-tilingは develop にマージ済みなので、feat/overlay-on-addedが develop に入ったら、この PR の base を develop に付け替えてください。追従は rebase せず merge commit で行いました(
origin/feat/polygon-tiling→feat/overlay-on-added→feat/polyline-tiling)。マージの順番
feat/overlay-on-added(onAdded とボストンのサンプル)を develop へ。入ったら下の PR の base を develop に付け替えます。feat/overlay-on-added)feat/overlay-on-added)feat/overlay-on-added)feat/overlay-on-added)feat/overlay-on-added)feat/overlay-on-added)feat/overlay-on-added)feat/overlay-on-added)develop)feat/overlay-on-added)feat/overlay-on-added)feat/overlay-on-added)プロバイダは ios-sdk-core の
PolylineTiler/ 重なり順を使うので core が先です。どの PR もまだマージしていません。マージはレビューのうえで判断してください。