coa-tencent-lbs
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

coa-tencent-lbs

GitHub license npm version npm downloads PRs Welcome

轻量的腾讯位置服务 SDK for Node.js

根据日常实际项目使用进行简单封装

快速开始

安装

yarn add coa-tencent-lbs

使用

import { CoaTencentLbsBin, CoaTencentLbsService } from 'coa-tencent-lbs'

// 初始化bin实例(依赖一个redisCache实例)
const bin = new CoaTencentLbsBin('XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX', redisCache)

// 根据bin实例创建服务实例
const service = new CoaTencentLbsService(bin)

// 逆地址解析(坐标位置描述)提供由经纬度到文字地址及相关位置信息的转换能力
// 详见 https://lbs.qq.com/service/webService/webServiceGuide/webServiceGcoder
await service.location2address('131.00,22.22')

// 地址解析(地址转坐标)提供由文字地址到经纬度的转换能力,并同时提供结构化的省市区地址信息
// 详见 https://lbs.qq.com/service/webService/webServiceGuide/webServiceGeocoder
await service.address2location('上海市徐汇区桂箐路')

// IP定位,通过终端设备IP地址获取其当前所在地理位置,精确到市级
// 详见 https://lbs.qq.com/service/webService/webServiceGuide/webServiceIp
await service.ipLocation('192.168.1.0')

// 行政区划,提供中国标准行政区划数据
// 详见 https://lbs.qq.com/service/webService/webServiceGuide/webServiceDistrict
await service.districtList()

Dependents (0)

Package Sidebar

Install

npm i coa-tencent-lbs

Weekly Downloads

5

Version

1.1.0

License

MIT

Unpacked Size

18.5 kB

Total Files

11

Last publish

Collaborators

  • adaex