npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mapbox-glowworm

v1.1.3

Published

mapbox-gl地图的萤火虫打点效果

Downloads

36

Readme

mapbox-glowworm

适用于mapbox-gl的萤火虫打点效果

效果如下:

效果1

在线体验demo(请配置自己的mapbox token): open in codesandbox

example

  1. 初始化一个GlowwormMap实例并且添加一个萤火虫发光图层
import {GlowwormMap} from 'mapbox-glowworm';

// ...
const map = new mapboxgl.Map({
  ...
});
// ...
map.on('load', () => {
  const mapData = [
    {
      gps: [114.184921, 22.350617],
      level: '', // 点类型 自定义,后序点的颜色根据这个字段匹配
    }
  ]
  const glowworm = new GlowwormMap(map); // 传入mapbox实例
  glowworm.addGlowwormLayer(mapData, {
    glowwormLayerName: 'glowwormLayerName',
  });
});

addGlowwormLayer方法配置项以及参数说明

1. params data

data: MapDotBack[]

2. params options

options: GlowwormMapOptions

| GlowwormMapOptions | type | required | description | |------------------------|---------------------------------------|----------|------------------------------------------------------------------------------------------------| | mapColorList | string[] or number[] | false | 普通环形打点颜色列表 | | glowwormInnerColorList | string[] or number[] | false | 萤火虫打点内环颜色列表 | | glowwormOutColorList | string[] or number[] | false | 萤火虫打点外环颜色列表,内环比外环颜色应当更深一点 | | colorKey | string | false | 匹配颜色的自定义字段,不传则默认为keyStr | | dotSize | number[] | false | dotSize示例:[14.1, 3, 32, 9],根据不同zoom匹配不同的大小,circleRadius和dotSize只能二选一,传入circleRadius后则dotSize失效 | | circleBlur | number or StyleFunction or Expression | false | | | circleColor | string or StyleFunction or Expression | false | | | circleRadius | number or StyleFunction or Expression | false | | | circleStrokeWidth | number or StyleFunction or Expression | false | | | circleStrokeColor | string or StyleFunction or Expression | false | | | circleOpacity | number | false | |

全局types

interface MapDotBack {
  gps: number[];
  level?: string;
}
interface MapOptions {
  mapColorList?: (number | string) []; // 普通打点颜色列表
  glowwormInnerColorList?: (number | string) []; // 萤火虫打点内环颜色
  glowwormOutColorList?: (number | string) []; // 萤火虫打点外环颜色
  colorKey?: string; // 匹配颜色的自定义字段
  dotSize?: number[];
  circleBlur?: number | StyleFunction | Expression;
  circleColor?: string | StyleFunction | Expression;
  circleRadius?: number | StyleFunction | Expression;
  circleStrokeWidth?: number | StyleFunction | Expression;
  circleStrokeColor?: string | StyleFunction | Expression;
  circleOpacity?: number;
}