Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deyihu-maptalks.tileclusterlayer

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deyihu-maptalks.tileclusterlayer

marker cluster by tile

  • 0.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

maptalks.tileclusterlayer

markers cluster by tile

how to use?

  • by cdn
<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/maptalks/dist/maptalks.css"
/>
<script
  type="text/javascript"
  src="https://cdn.jsdelivr.net/npm/maptalks/dist/maptalks.min.js"
></script>
<script
  type="text/javascript"
  src="https://cdn.jsdelivr.net/npm/maptalks.tileclusterlayer@latest/dist/maptalks.tileclusterlayer.min.js"
></script>
  • by npm
  npm i maptalks.tileclusterlayer
#   or
  yarn add maptalks.tileclusterlayer
  • demo online
  • million markers cluster
function getClusterMarkerSymbol(count) {
  const symbol = {
    markerType: "ellipse",
    markerWidth: 65,
    markerHeight: 65,
    markerFill: "#fff",
    markerLineWidth: 0,
    markerFillOpacity: 1,
    markerOpacity: 1,
    textSize: 15,
    textName: count,
    textHaloFill: "#000",
    textHaloRadius: 1.2,
    textFill: "#fff",
  };
  if (count > 5000) {
    symbol.markerFill = "red";
  } else if (count > 1000) {
    symbol.markerFill = "yellow";
  }
  return symbol;
}

const tileClusterLayer = new maptalks.TileClusterLayer("tileClusterLayer", {
  maxClusterZoom: 18,
  //when cluster marker mouseover will show children markers
  clusterDispersion: true,
  // show cluster marker children max count
  dispersionCount: 500,
  //get cluster marker symbol
  clusterMarkerSymbol: getClusterMarkerSymbol,
  // cluster marker,marker events
  markerEvents: {
    click: function (e) {
      console.log(e);
      if(e.target.getProperties().isCluster){
          console.log('is cluster marker');
      }
    },
  },
});
tileClusterLayer.addTo(map);

const geojson={
     type: 'FeatureCollection',
    features: [
                ...
            ]
};
tileClusterLayer.setData(geojson);

//use in ESM

import * as maptalks from 'maptalks';
import {TileClusterLayer} from 'maptalks.tileclusterlayer';
const tileClusterLayer = new TileClusterLayer("tileClusterLayer",{
  ...
});

Keywords

FAQs

Package last updated on 23 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc