{"id":19885547,"url":"https://github.com/grinat/leaflet-superclaster","last_synced_at":"2025-03-01T03:47:13.456Z","repository":{"id":35001421,"uuid":"194459478","full_name":"grinat/leaflet-superclaster","owner":"grinat","description":"Leaflet binding for supercluster","archived":false,"fork":false,"pushed_at":"2023-01-04T21:54:35.000Z","size":6540,"stargazers_count":1,"open_issues_count":21,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-17T10:01:32.344Z","etag":null,"topics":["leaflet"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grinat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-30T00:22:35.000Z","updated_at":"2024-03-27T11:41:03.000Z","dependencies_parsed_at":"2023-01-15T12:00:28.567Z","dependency_job_id":null,"html_url":"https://github.com/grinat/leaflet-superclaster","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grinat%2Fleaflet-superclaster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grinat%2Fleaflet-superclaster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grinat%2Fleaflet-superclaster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grinat%2Fleaflet-superclaster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grinat","download_url":"https://codeload.github.com/grinat/leaflet-superclaster/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241097506,"owners_count":19909156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["leaflet"],"created_at":"2024-11-12T17:34:51.677Z","updated_at":"2025-03-01T03:47:13.434Z","avatar_url":"https://github.com/grinat.png","language":"JavaScript","readme":"# leaflet-superclaster\n\n[![CircleCI](https://circleci.com/gh/grinat/leaflet-superclaster/tree/master.svg?style=svg)](https://circleci.com/gh/grinat/leaflet-superclaster/tree/master)\n\nLeaflet binding for [supercluster](https://github.com/mapbox/supercluster)\n\n| move         | static        |\n| -------------   |:-------------:|\n| ![](examples/move.gif) | ![](examples/static.gif)|\n| [example](https://grinat.github.io/leaflet-superclaster/examples/static.html) | [example](https://grinat.github.io/leaflet-superclaster/examples/move.html)  |\n\n\n```js\nimport * as L from 'leaflet'\n\nimport {SuperclusterGroup} from 'leaflet-superclaster'\nimport 'leaflet-superclaster/dist/supercluster.css'\n\nthis.superclusterGroup = new SuperclusterGroup().addTo(this.map)\nthis.superclusterGroup.on('point.click', function({parentLayer, layer, target}) {\n  let popup = layer.getPopup()\n  if (!popup) {\n    popup = L.popup({\n      autoClose: false,\n      closeOnClick: false,\n      autoPan: false\n    }).setContent(JSON.stringify(layer.feature.properties))\n    layer.bindPopup(popup).openPopup()\n  }\n})\n\nthis.superclusterGroup.on('layer.updated', function ({layer}) {\n  const popup = layer.getPopup()\n  if (popup \u0026\u0026 popup.isOpen()) {\n    popup.setContent(JSON.stringify(layer.feature.properties))\n  }\n})\n\nconst features = [{\n  properties: {\n    // !! id in properties are required\n    // used for redraw markers which changes the position\n    id: 1\n  },\n  type: \"Feature\",\n  geometry: {type: \"Point\", coordinates: [45, 66]}\n}]\nthis.superclusterGroup.loadGeoJsonData(features)\n```\n\n## Methods\n\n```\nloadGeoJsonData(features) - set markers positions\nkeepPoint(id) - Save point id for keep in view useful if appended popup with keepView optio\nunKeepPoint(id)\n```\n\n## Events\n\n\n| name            | params                     | desciption |\n| -------------   |:-------------:             | -----:|\n| point.click     | parentLayer, layer, target | Fired on click by point |\n| cluster.click     | parentLayer, layer, target | Fired on click by cluster |\n| layer.created   | layer, feature              | fired on marker(point or cluster) create |\n| layer.updated   | layer, target              | fired on layer position(lat, lng) was updated |\n| draw            | layer, target                      | fired after markers draw, return layers with markers |\n| end            |                       | all data in worker executed |\n| wait            |                      | data execution in worker |\n\n## Development\nRun webpack in dev mode and server with fixtures data\n```\nnpm run watch\n```\n\n## Tests\n```\nnpm run test:e2e\n```\n\n### Fallback\nFor use in ie 11 with webpack. Install copy-webpack-plugin and copy leaflet-superclaster.worker.js to root folder:\n```\nconst CopyPlugin = require('copy-webpack-plugin')\n\n...\nplugins: [\n  new CopyPlugin([\n    { from: 'node_modules/leaflet-superclaster/dist/leaflet-superclaster.worker.js', to: 'leaflet-superclaster.worker.js' }\n  ])\n]\n...\n\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrinat%2Fleaflet-superclaster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrinat%2Fleaflet-superclaster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrinat%2Fleaflet-superclaster/lists"}