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 🙏

© 2025 – Pkg Stats / Ryan Hefner

leaflet-map-block

v1.0.2

Published

Leaflet map block component

Readme

Leaflet 地图分块渲染

English doc

功能概述

该模块封装了一个 Leaflet 的网格图层 LeafletMapBlockLayer,用于在地图上渲染带有网格和文字标记的瓦片。支持自定义网格线样式和网格文字显示。

接口定义

interface CanvasLayerOptions extends L.GridLayerOptions {
  // 线颜色
  strokeStyle?: string;
  // 线宽
  lineWidth?: number;
  // 线的虚线样式:[0,0] 为实线
  lineDash?: number[];
  // 是否显示网格文字
  showGridText?: boolean;
  // 网格文字颜色
  gridTextColor?: string;
  // 网格文字大小、字体等配置
  gridFont?: string;
}

默认配置

const defaultOptions = {
  strokeStyle: 'red',
  lineWidth: 2,
  lineDash: [5, 5],
  showGridText: true,
  gridTextColor: 'black',
  gridFont: '12px Arial'
};

安装&使用示例

安装

npm install leaflet-map-block

yarn add leaflet-map-block

使用示例

import {LeafletMapBlockLayer} from 'leaflet-map-block/dist/LeafletMapBlock';
// 在初始化地图之后添加该图层:new 该对象,并传入参数(可选)
map.addLayer(new LeafletMapBlockLayer({lineDash: [2, 2]}));

地图块异常排查

地图上每一块都是静态资源响应的img图片,并且加入了这个插件可以在每一块地图上看到他的x,y,z的值,其实就是对应的瓦片坐标,

瓦片的x,y,z值可以在地图的url中看到,比如:https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png

如果那一块地图展示异常了,能够快速的定位其静态路径