Repository navigation
Trace a polygon's fill and outline on one line, closing edge included - #11
Merged
Merged
Conversation
The geodesic ring was densified with createInterpolatePoints, which only interpolates between neighbouring points. The closing edge (last vertex -> first) was left to the RHUMB fill as a single chord while the GEODESIC outline polyline curved, so fill and outline disagreed there. Use js-sdk-core's densifyGeodesicRing. geodesic=false is unchanged. Requires the js-sdk-core release that adds densifyGeodesicRing.
geodesic=false rings went through Planar.createInterpolatePoints, which only interpolates between neighbouring points, so the closing edge (last vertex -> first) was a single long segment: the RHUMB fill drew it as a loxodrome and the GEODESIC outline as a great circle, which visibly parted (Boston -> London -> Iceland: at 53.2W on Iceland -> Boston the outline passes 55.6N, the fill 51.6N). Densify every ring with js-sdk-core's densifyPolygonRing in both modes (it replaces the unreleased densifyGeodesicRing), and give the outline the fill's RHUMB arc type so the two take the same segment between the densified vertices. A test renders a polygon against a stubbed Cesium and checks that fill and outline share their vertices and arc type in both modes. Requires the js-sdk-core release that adds densifyPolygonRing.
This was referenced Nov 8, 2026
Merged
Merged
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.
なぜ
ポリゴンの点は開いたリング(末尾 ≠ 先頭)で渡されます。
WGS84Geodesic.createInterpolatePointsもPlanar.createInterpolatePointsも隣り合う点の間しか補間しないので、そのまま渡すと閉じる辺(末尾 → 先頭)だけが補間されず、描画側で閉じたときに 1 本の直線(弦)になっていました。一方、輪郭はリングを閉じてからポリラインとして密度化するので、閉じる辺も他の辺と同じ形になります。Boston (42.36N, 71.06W) → London (51.5N, 0.12W) → Iceland (64.1N, 21.9W) の三角形(閉じる辺は Iceland → Boston)での数値:
どの補間を正とするか(geodesic=false)
ポリラインの geodesic=false(全プロバイダで緯度経度の線形補間)と、既に閉じてから密度化している web の ArcGIS に合わせ、閉じる辺も含めて緯度経度で線形補間する方に統一しました。「密度化しない(メルカトルの直線)」に寄せると、ポリラインの false と形が変わり、ArcGIS・Cesium のように辺を測地線でつなぐ SDK では直線を表せないためです。
何を変えたか
densifyPolygonRingで閉じる辺まで密度化します(geodesic は 100 km、false は 10 km 刻み。従来どおり)。arcTypeを塗りと同じRHUMBにしました。以前は輪郭がGEODESIC、塗りがRHUMBで、閉じる辺のような長い 1 本の辺では両者が離れていました(三角形の Iceland → Boston の 53.2W で輪郭 55.6N、塗り 51.6N)。密度化した頂点の間では、どちらでも塗りと輪郭が同じ線になります。test/PolygonClosingEdge.test.mjsを追加しました。Cesium をスタブに差し替えてレンダラが作るグラフィックスを記録し、true / false とも塗りと輪郭が同じ頂点・同じ arcType で、閉じる辺が補間されていることを確かめます。関連 PR(同じ修正の一式)
fix/geodesic-polygon-fillは次の 16 リポジトリにまたがります。1. core(3 本は互いに独立。先にマージ・公開してください)
core だけで直るプロバイダ(共通パイプライン
buildPolygonRings/buildUnwrappedPolygonRingsを使うもの)には PR がありません: Android の MapLibre / Mapbox / Mappls / MapTiler / Longdo / OpenMobileMaps、iOS の MapLibre / Mapbox / Mappls / MapTiler / OpenMobileMaps、web の MapLibre / Mapbox / Mappls / MapTiler / TomTom / Longdo / Leaflet / OpenLayers / Azure Maps / deck.gl / MapKit JS / ArcGIS。2. Android プロバイダ(android-sdk-core の公開後。
densifyPolygonRingを使うのでそれまでビルドできません。ArcGIS だけは core に依存しません)3. iOS プロバイダ(ios-sdk-core の公開後。ArcGIS だけは core に依存しません)
4. web プロバイダ(js-sdk-core の新しい版を npm に公開し、依存(今は
^0.3.1)を引き上げてから。npm の公開はまだ行いません)マージの順番: core 3 本 → core の公開 → Android / iOS プロバイダ → js-sdk-core の npm 公開と依存の引き上げ → web プロバイダ。
見た目が変わるもの: ArcGIS(Android / iOS)の geodesic=false の閉じる辺は、以前は補間されず ArcGIS が測地線として描いていましたが、他の辺と同じ緯度経度の線形補間になります(web の react-for-arcgis と同じ形で、3 プラットフォームがそろう方向。承認済み)。ほかのプロバイダも geodesic=false の閉じる辺がわずかに曲がるようになります。
検証
npm test(7 本通過)。追加した 4 本は develop のレンダラでは落ちることを確かめました。tsc --noEmit通過。確認できていないもの
他の PR との関係