node-gecoding

1.1.4 • Public • Published

node-gecoding

This is a node module for gecoding.Using this module,we can gecoding a lot of address to GPS.The input could be csv File or txt File,which contains a lot of lines like "UESTC,ChengDu".

Install

$ npm install node-gecoding

Useage

  1. 这是一个基于百度地图和腾地图API的批量GECODING模块,使用首先需要获取百度地图or腾讯地图的API-KEY.(前一个版本使用百度地图车联网API,每天调用次数限制为5000次,今天更新后,百度地图调用无时间限制,每个key每天总共调用100万次,腾讯地图调用时间限制为10次/秒,每天每个key总共10万次.)
- [百度地图LBS](http://api.map.baidu.com/lbsapi/cloud/webservice.htm )
- [腾讯地图LBS](http://lbs.qq.com/webservice_v1/guide-geocoder.html)
  1. 把申请到的key填入setting.js里(也可以在程序里配置,见测试代码),ps:目前只实现了结果输出到redis数据库的多线程

    module.exports = {
      	bd_maptoken:'baidu-apikey',
      	tx_maptoken:'tengxun-apikey',
      	//redis:'localhost',
      	//post:6379,
      	//channel:'gecoding'
    }
  2. 格式化输入文件,逗号分割地址与城市[CSV,TXT]

电子科技大学,成都 \n  
四川大学,成都 \n  
西南财经大学,成都 \n  
四川师范大学,成都 \n  
西南交通大学,成都 \n  
  1. 输出文件为逗号分割的txt文件,可以方便转csv文件,与输入文件同目
  2. 测试代码如下
    var gcoding=require('node-gecoding');
    //参数:文件路径,选择的api
    var argument=['./data/hello.txt','tx','./data/hello.csv','bd'];
    var cfg = {	//与setting配置效果相同
    	bd_maptoken:'baidu-map-apikey',
    	tx_maptoken:'tengxun-map-apikey'
    }
    gcoding.config(cfg);
    gcoding.gecoding_aync(argument);

Package Sidebar

Install

npm i node-gecoding

Weekly Downloads

1

Version

1.1.4

License

ISC

Last publish

Collaborators

  • xujiawen5566