Same cluster is returned from two tiles
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.4k
- Forks
- 304
- PR merge metrics
- No merged PRs in 30d
Description
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:
- https://github.com/maplibre/maplibre-gl-js/issues/5907
I just removed most of the code around it that maplibre/mapbox uses.
```html
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);
}
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Supercluster reproduction and inspect the getTile(1, 0, 0) and getTile(1, 1, 0) results. Determine why the same cluster appears in both tiles, then verify that the cluster is emitted only once while preserving expected tile coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100