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

gago-mapnik-mysql

v1.1.1

Published

Rendering vector tile as pbf from MySQL

Downloads

8

Readme

OVERVIEW

gago-mapnik-mysql 是用来支持 Mapnik + MySQL 渲染 pbf 的方案

USAGE

MapnikService.init({
client: client, // 其中 client 为初始化过的 DBClient,可以通过 DBClient.createClient 返回 (依赖 sakura-node-ts)
spatialReference: SpatialReference.WGS84,  // 暂时只支持 WGS84
mapboxVectorSourceLayerName: "street", // 需要和前端校对的名字,详情见注释
shapeColumnAlias: "geom"}); // 如果 geometry 列名要更改则需要修改此处
const pbf: Buffer = await MapnikService.queryTileAsPbf("lands", ["owner", "displayName"], 3, 7, 5);

将 GeoJSON 导入 MySQL

1.首先安装conda

2.安装 gdal - 运行 conda install gdal

3.将 GeoJSON 转为 CSV,其中 Geometry 使用 WKT 格式 - 运行 ogr2ogr -f "CSV" -lco GEOMETRY=AS_WKT -overwrite {输出的 csv 文件路径} {输入的 geojson 文件路径}

4.按照需求建临时表(因为最终要的是 geometry 类型,目前是 TEXT,内容是 WKT)

5.导入 csv - LOAD DATA LOCAL INFILE '/Users/FrankLin/Downloads/2_min.csv' INTO TABLE test_lands_1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (land_id,WKT)

6.将该表的 WKT 列转为 SHAPE 列,类型为 Geometry (正在编写转换器)

7.为 SHAPE 列构建索引 - CREATE SPATIAL INDEX g ON table (SHAPE);

运行环境

由于底层 gcc 的限制,目前测试过的环境为 Ubuntu,如果需要在其他环境上编译可能需要自己 build gcc,可以参考此处