Passing one point does not return any values
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.4k
- Forks
- 304
- PR merge metrics
- No merged PRs in 30d
Description
I assume since one point cannot be a cluster it just doesn't return it, but this breaks code for me. Could we return the point without a cluster_id or something?
Here is the example and code:
## Test Code
```json
POINTS: [
{
"id": "marker-7659",
"lat": "33.65",
"lng": "-86.68",
"address": {
"address": "PO Box 94520",
"city": "Birmingham",
"state": "AL",
"zip": "35220",
"country": "US"
},
"geometry": {
"coordinates": [
"-86.68",
"33.65"
]
}
}
]
BOUNDS: {
"ne": {
"lat": 33.65,
"lng": -86.68
},
"nw": {
"lat": 33.65,
"lng": -86.68
},
"se": {
"lat": 33.65,
"lng": -86.68
},
"sw": {
"lat": 33.65,
"lng": -86.68
}
}
ZOOM: 8
```
## Supercluster code
```js
const clusters = index
.load(points)
.getClusters(
[bounds.sw.lng, bounds.sw.lat, bounds.ne.lng, bounds.ne.lat],
zoom
)
.map(cluster =>
cluster.type === 'Feature'
? {
id: cluster.id,
lat: cluster.geometry.coordinates[1],
lng: cluster.geometry.coordinates[0],
point_count: cluster.properties.point_count,
cluster_id: cluster.properties.cluster_id,
// onclick to get correct zoom
getZoom: () =>
index.getClusterExpansionZoom(cluster.properties.cluster_id)
}
: cluster
)
```
This just returns and empty array
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 shown Supercluster entry points, especially load(points) and getClusters(bounds, zoom), using the single-point example as the reproduction case. Trace why that input produces an empty array and verify that the point is returned without a cluster_id when no cluster is formed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100