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 🙏

© 2026 – Pkg Stats / Ryan Hefner

geojson-help

v1.1.6

Published

node command line tool for geojson format && encode

Downloads

16

Readme

geojson-help

command line for the GeoJSON format and encode

node npm

安装

$ npm install geojson-help -g

使用

1. 格式转换

$ geo format  -i <input>
  • 默认将arcgis-json插件导出的json文件转换成标准geojson格式,后续扩展其它途径的转换
  • -i参数为需要被转换的json文件的路径,支持glob匹配
  • 默认输出转换后的文件到json_geo文件夹下,文件名保持不变

示例:

$ geo format -i "json/*.json"

注意:-i osx系统,参数值必须为双引号包裹的字符串,未加双引号路径会被预先解析,只能匹配到一个结果;windows下可加可不加,但是别使用单引号,匹配不到的。具体原因不明,有了解的麻烦告诉我。

2. 压缩

使用字符集编码转换和ZigZag算法压缩标准geosjon的几何数据,文件末尾用"UTF8Encoding": true作为标示。结果适用于echarts。也可结合decode解码方法,应用于支持geojson的地图,如leaflet

$ geo encode -i <input>
  • 参数说明同上
  • 转换后输出到json_geo_encode文件夹下

示例:

$ geo encode -i "json_geo/*.json"

3. 解码

针对2.的压缩结果做解码,还原成标准geojson数据。压缩-还原过程,会导致经纬度精度丢失,但一般不影响图层显示。

$ geo decode -i <input>

4.格式化&压缩

连续操作格式化和压缩,其它同上

$ geo transform -i <input>

API

也提供了api接口供运行环境使用

# 安装到项目
npm i geojson-help --save

示例:

import geo from 'geojson-help'
import arcgisjson from '../assets/arcgisjson.json'

var geojson = geo.format(arcgisjson)
var geojsonEncode = geo.encode(geojson)
var geojsonDecode = geo.decode(geojsonEncode)

测试demo

  1. clone 源码到本地, 到该目录执行npm run dev, 打开localhost:9090/demo/index.html, 修改index.htmlrender函数的geojson文件引用,可看结果。
  2. 将文件导入到mapshaper验证。

待扩展

  1. 压缩解码缩放参数
  2. 'format'精度控制,拐点抽稀,进一步提高压缩比。

欢迎提issue