Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Same cluster is returned from two tiles

オープン
#254 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
javascript
領域
data

調査の方向性

提供された Supercluster の再現から始め、getTile(1, 0, 0) と getTile(1, 1, 0) の結果を調べてください。同じ cluster が両方のタイルに現れる理由を特定し、そのうえで、期待されるタイルのカバレッジを維持しながら cluster が 1 回だけ出力されることを確認してください。

索引モデルが issue の本文から書いたものです。

説明

bug

I'm guessing this is related to a precision issue, but I wanted to report this anyway to make sure that's the root cause.
In the following example a cluster is requested from two different tiles and is returned from both of them.
This creates a duplication of the cluster (although one can filter by unique ID).
Let me know if you need more information in order to look into it.
This was originally reported here:

I just removed most of the code around it that maplibre/mapbox uses.

<!DOCTYPE html>
<html lang="en">
  <head>
    <script src="https://unpkg.com/[email protected]/dist/supercluster.min.js"></script>
  </head>
  <body>
    <script>
      const mountains = [
        {
            "name": "Ben More",
            "height": 966,
            "longitude": -6.0152005136723,
            "latitude": 56.424106997002,
            "description": ""
        },
        {
            "name": "A' Chioch",
            "height": 868,
            "longitude": -5.9993112842696,
            "latitude": 56.427318748488,
            "description": ""
        },
    ];

    const mountainFeatures = mountains.reduce(
        (acc, mountain) => {
            acc.features.push({
                type: "Feature",
                geometry: {
                    type: "Point",
                    coordinates: [mountain.longitude, mountain.latitude],
                },
                properties: {
                    name: mountain.name,
                    description: mountain.description,
                    height: mountain.height,
                },
            });
            return acc;
        },
        {
            type: "FeatureCollection",
            features: [],
        }
    );
      try {
        const index = new Supercluster({
          clusterRadius: 27
        });
        index.load(mountainFeatures.features);
        const a = index.getTile(1, 0, 0);
        const b = index.getTile(1, 1, 0);
        console.log(a.features.length + (b != null ? b.features.length : 0));
      } catch (ex) {
        console.log(ex.message);
      }
    </script>
  </body>
</html>
主要言語
JavaScript
スター
2.4k
フォーク
303
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mapbox/supercluster のほかの issue

mapbox/supercluster の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。