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

gdapitogeojson

v1.1.0

Published

高德API 鼠标工具 多边形编辑器 得出新的边界数据 转换为 GeoJSON

Readme

GdApiToGeojson / gdapitogeojson

高德地图 API 数据转换工具,支持将高德地图的路径数据转换为 GeoJSON 和 WKT 格式。

功能特性

将高德地图 PolygonEditor mouseTool 得出的边界路径数据转换为标准 GeoJSON 坐标格式

使用

npm i gdapitogeojson

import amapPathToWkt from 'gdapitogeojson'

var map = new AMap.Map("container", {
    center: [116.434381, 39.898515],
    zoom: 14
});

// 高德地图 通过多边形编辑器 调整多边形 得出 路径数据

var path = [[116.475334, 39.997534], [116.476627, 39.998315], [116.478603, 39.99879], [116.478529, 40.000296], [116.475082, 40.000151], [116.473421, 39.998717]]

var polygon1 = new AMap.Polygon({
    path: path
})
map.add([polygon1]);
map.setFitView();
    
let polyEditor = new AMap.PolygonEditor(map);
polyEditor.setTarget(polygon1);
polyEditor.open();
polyEditor.on('add', function (data) {
    console.log(data);
    let polygon = data.target;
    let wkt = amapPathToWkt(polygon.getPath())
    console.log(wkt)
})


// 高德地图 通过鼠标工具 绘制多边形 得出路径数据

var mouseTool = new AMap.MouseTool(map)
function drawPolygon () {
    mouseTool.polygon({
    strokeColor: "#FF33FF", 
    strokeOpacity: 1,
    strokeWeight: 6,
    strokeOpacity: 0.2,
    fillColor: '#1791fc',
    fillOpacity: 0.4,
    // 线样式还支持 'dashed'
    strokeStyle: "solid",
    // strokeStyle是dashed时有效
    // strokeDasharray: [30,10],
    })
}
mouseTool.on('draw', function(event) {
    // event.obj 为绘制出来的覆盖物对象
    let polygon = event.obj;
    let wkt = amapPathToWkt(polygon.getPath())
    console.log(wkt)
})

安装

# 克隆项目到本地
git clone https://github.com/fuzexu/GdApiToGeojson.git

致谢

本项目部分代码参考/使用了以下开源项目:

特别感谢这些项目的贡献者们。