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

map-adapter

v0.0.14

Published

map adapter

Downloads

58

Readme

map-adapter

介绍

地图适配器封装主流地图 SDK,提供统一调用接口,支持高德、百度、腾讯、OpenLayers 及图盟(MapABC) 等平台。

使用说明

  1. 安装
npm install map-adapter
  1. 初始化
// 第一步 获取适配器(全局)
const adapter = mapAdapter({
    type: 'baidu',   // 类型:百度
    version: '3.0',
    ak: '*******'  // 密钥
})
// 第二步 创建 地图包装对象(mapWrapper),mapWrapper为核心对接,后续使用mapWrapper调用下面接口
var myDiv = document.getElementById('app');
adapter.init(myDiv).then((mapWrapper) => {
    console.log(mapWrapper) // 此对象为地图包装对象
})
  1. 接口说明

----打单点:

方法名:addPoint
参数:
   1.经纬度数组(必填); [180.12, 23.1245]
   2.图层名(默认defaultlayer):''
   3.其他参数对象(选填,不填则使用默认值): {
                     imgUrl: '',  图片地址
                     size: [30, 30], 图片大小,宽和高
                     text: '显示文字',   //显示文字
                     textStyle: {},   //显示文字的css样式,
                     textOffset: [-30, -10],  // 显示文字的偏移
                     offset: [-30, -10],   //偏移距离(单位像素)
                     animation: 'bounce',  // 动画 bounce: 跳动 drop: 坠落
                 }
   4.事件对象: {
         		'click': function(a, b, c){}   //事件类型:回调函数,类型从自定义对象 Constants中选择, 
         										 //a表示数据,b表示事件本身(dom事件e),c表示覆盖物本身
     		}
   5.数据data : {
         title: ''  //标题,鼠标移动上面会显示
         titleWidth: ,  //标题宽度(有默认值)
         titleHeight: 20, // 标题高度 (默认20)
         titleStyle: {}  //标题css 样式(有默认值)
         extendWidth: 0,  //扩充宽度
   }
   6.扩展参数{}
返回:覆盖物(单点)对象id,可通过 getOverLayById 获取覆盖物

----添加窗口:

方法名:addWindowInfo
参数:1.经纬度数组 
     2.内容 html字符 或 dom元素  
     3.参数 {
            size: [width, height] , 宽和高
            offset: [-30, -10],   //偏移距离(单位像素)
        }
     4.events 事件对象 {
            'close': function(){}
        }
     5.扩展参数 {} 具体见代码里面
返回:信息窗口对象

----添加 html:

方法名:addHtml html的事件可在 绑定在 html dom 本身
参数:1.经纬度数组 
     2.内容 dom元素
     3.参数 {
            size: [width, height] , 宽和高
            offset: [-30, -10],   //偏移距离(单位像素)
        }
     4.扩展参数 {} 具体见代码里面
返回:信息窗口对象

开发说明

  1. nodejs版本:22.14.0
  2. 初始化环境:npm run i
  3. xxxx