Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Same cluster is returned from two tiles

Đang mở
#254 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
data

Hướng nghiên cứu

Bắt đầu với bản tái hiện Supercluster được cung cấp và kiểm tra kết quả của getTile(1, 0, 0) và getTile(1, 1, 0). Xác định lý do cùng một cluster xuất hiện trong cả hai tile, sau đó xác minh rằng cluster chỉ được phát ra một lần trong khi vẫn duy trì phạm vi bao phủ tile như mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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>
Ngôn ngữ chính
JavaScript
Star
2.4k
Fork
303
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của mapbox/supercluster

Tất cả issue của mapbox/supercluster

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.