mapbox / mapbox/supercluster

How to store the clustered values into file

Open
#134 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
2.4k
Forks
304
PR merge metrics
No merged PRs in 30d

Description

I have one question after cluster the values I want to store it in file.
after super cluster object initialize I am getting the following response
```
Supercluster {
options: { log: true, radius: 60, extent: 512, maxZoom: 16 },
trees:
[ KDBush {
nodeSize: 64,
points: [Array],
ids: [Uint16Array],
coords: [Float32Array] },
KDBush {
nodeSize: 64,
points: [Array],
ids: [Uint16Array],
coords: [Float32Array] },
points:
[ { type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] },
{ type: 'Feature', properties: [Object], geometry: [Object] } ] }
```

When I convert and write into a file. Format is changing
I am using Node js. Before writing into file i am `JSON.stringify`
After that stringify I am getting response like this

```
{
"options": {
"log": true,
"radius": 60,
"extent": 512,
"maxZoom": 16
},
"trees": [
{
"nodeSize": 64,
"points": [
{
"x": 0.24396358761574075,
"y": 0.38899943574185264,
"zoom": null,
"id": 1,
"parentId": -1,
"numPoints": 12,
"properties": null
},
{
"x": 0.7360923611111111,
"y": 0.4629351025691785,
"zoom": null,
"id": 33,
"parentId": -1,
"numPoints": 2,
"properties": null
}etc
```

supercluster name and KDBUSH also missed in that.
Please suggest something

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Supercluster and KDBush objects shown in the issue and check the library's documented entry points for persistence or reconstruction. The issue names no source file or test, so first determine whether serialization is intended to be supported; done should be a documented way to store and restore clustered values without relying on incidental object names.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.