{"id":13675269,"url":"https://github.com/maptalks/maptalks.markercluster","last_synced_at":"2025-04-12T00:10:49.046Z","repository":{"id":9415291,"uuid":"62043536","full_name":"maptalks/maptalks.markercluster","owner":"maptalks","description":"A layer of maptalks to cluster markers.","archived":false,"fork":false,"pushed_at":"2024-03-17T02:58:53.000Z","size":985,"stargazers_count":49,"open_issues_count":21,"forks_count":18,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-12-12T14:12:02.366Z","etag":null,"topics":["clustered-markers","map","mapping","maptalks","maptalks-layer","maptalks-plugins"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maptalks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-27T09:32:10.000Z","updated_at":"2024-08-12T20:12:19.000Z","dependencies_parsed_at":"2024-06-18T18:38:39.587Z","dependency_job_id":"cf72379f-edf1-4874-bd4c-596a6f282689","html_url":"https://github.com/maptalks/maptalks.markercluster","commit_stats":{"total_commits":99,"total_committers":6,"mean_commits":16.5,"dds":0.06060606060606055,"last_synced_commit":"d8e439faf0685388489f75f14184427b47d33760"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maptalks%2Fmaptalks.markercluster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maptalks%2Fmaptalks.markercluster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maptalks%2Fmaptalks.markercluster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maptalks%2Fmaptalks.markercluster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maptalks","download_url":"https://codeload.github.com/maptalks/maptalks.markercluster/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237111680,"owners_count":19257389,"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":["clustered-markers","map","mapping","maptalks","maptalks-layer","maptalks-plugins"],"created_at":"2024-08-02T12:00:37.116Z","updated_at":"2025-02-04T12:05:10.963Z","avatar_url":"https://github.com/maptalks.png","language":"JavaScript","readme":"# maptalks.markercluster\n\n[![CircleCI](https://circleci.com/gh/maptalks/maptalks.markercluster.svg?style=shield)](https://circleci.com/gh/MapTalks/maptalks.markercluster)\n[![NPM Version](https://img.shields.io/npm/v/maptalks.markercluster.svg)](https://github.com/maptalks/maptalks.markercluster)\n\nA plugin of [maptalks.js](https://github.com/maptalks/maptalks.js) to draw markers as clusters.\n\n![screenshot](https://cloud.githubusercontent.com/assets/13678919/25312742/3036acb0-2853-11e7-8e9b-baf58e318a9b.jpg)\n\n## Examples\n\n* marker clusters of [50000 points](https://maptalks.github.io/maptalks.markercluster/demo/). (data from [Leaflet.Heat](https://github.com/Leaflet/Leaflet.heat))\n\n## Install\n  \n* Install with npm: ```npm install maptalks.markercluster```. \n* Download from [dist directory](https://github.com/maptalks/maptalks.markercluster/tree/gh-pages/dist).\n* Use unpkg CDN: ```https://unpkg.com/maptalks.markercluster/dist/maptalks.markercluster.min.js```\n\n## Usage\n\nAs a plugin, ```maptalks.markercluster``` must be loaded after ```maptalks.js``` in browsers.\n```html\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/maptalks/dist/maptalks.min.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"https://unpkg.com/maptalks.markercluster/dist/maptalks.markercluster.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\nvar data = [marker1, marker2, marker3];\nvar clusterLayer = new maptalks.ClusterLayer('cluster', data).addTo(map);\n\u003c/script\u003e\n```\n\n## Supported Browsers\n\nIE 9-11, Chrome, Firefox, other modern and mobile browsers.\n\n## API Reference\n\n```ClusterLayer``` is a subclass of [maptalks.VectorLayer](https://maptalks.github.io/docs/api/VectorLayer.html) and inherits all the methods of its parent.\n\n### `Constructor`\n\n```javascript\nnew maptalks.ClusterLayer(id, data, options)\n```\n\n* id **String** layer id\n* data **Marker[]** layer data, an array of maptalks.Marker\n* options **Object** options\n    * maxClusterRadius **Number** max cluster radius (160 by default) \n    * symbol **Object** symbol of clusters\n    * textSymbol **Object**  symbol of cluster texts\n    * drawClusterText **Boolean** whether to draw cluster texts (true by default)\n    * textSumProperty **String**  property name to sum up to display as the cluster text\n    * maxClusterZoom **Number** the max zoom to draw as clusters (null by default)\n    * animation **Boolean** whether animate the clusters when zooming (true by default)\n    * animationDuration **Number** the animation duration\n    * noClusterWithOneMarker **Boolean** whether display cluster with only one marker (false by default)\n    * Other options defined in [maptalks.VectorLayer](https://maptalks.org/maptalks.js/api/0.x/VectorLayer.html)\n\n### `config(key, value)`\n\nconfig layer's options and redraw the layer if necessary\n\n```javascript\nclusterLayer.config('maxClusterRadius', 100);\nclusterLayer.config({\n    'textSymbol' : {\n        'textFaceName'      : 'monospace',\n        'textSize'          : 16\n    }\n});\n```\n\n**Returns** `this`\n\n### `addMarker(marker)`\n\nadd more markers\n\n* marker **Marker[]** markers to add\n\n**Returns** `this`\n\n### `toJSON()`\n\nexport the layer's JSON.\n\n```javascript\nvar json = clusterLayer.toJSON();\n```\n\n**Returns** `Object`\n\n## Contributing\n\nWe welcome any kind of contributions including issue reportings, pull requests, documentation corrections, feature requests and any other helps.\n\n## Develop\n\nThe only source file is ```index.js```.\n\nIt is written in ES6, transpiled by [babel](https://babeljs.io/) and tested with [mocha](https://mochajs.org) and [expect.js](https://github.com/Automattic/expect.js).\n\n### Scripts\n\n* Install dependencies\n```shell\n$ npm install\n```\n\n* Watch source changes and generate runnable bundle repeatedly\n```shell\n$ gulp watch\n```\n\n* Tests\n```shell\n$ npm test\n```\n\n* Watch source changes and run tests repeatedly\n```shell\n$ gulp tdd\n```\n\n* Package and generate minified bundles to dist directory\n```shell\n$ gulp minify\n```\n\n* Lint\n```shell\n$ npm run lint\n```\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaptalks%2Fmaptalks.markercluster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaptalks%2Fmaptalks.markercluster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaptalks%2Fmaptalks.markercluster/lists"}