Reverse Geocoding for a Latitude and Longitude by Async.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 2 commits ahead, 2 commits behind zhso:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.babelrc
.eslintrc
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

reverse-geocoding

Reverse Geocoding for a Latitude and Longitude by Async.

NPMNPM

npm npm npm npm

bitHound Overall Score Inline docs Build Status Coverage Status

GitHub stars GitHub watchers

Caution

The 1.0 was ES6 Edition From 2.0 was ES5 Edition(for some early nodejs version)

Features

  • Custom Params
  • Custom Proxy
  • Google Maps & Baidu Maps Support

Installation

$ npm install reverse-geocoding

Examples

Basic

var geocoding = new require('reverse-geocoding');
var config = {
    'latitude': 40.00403611111111,
    'longitude': 116.48485555555555
};
geocoding.location(config, function (err, data){
	if(err){
		console.log(err);
	}else{
		console.log(data);
	}
});

Custom Proxy

var geocoding = new require('reverse-geocoding');
var config = {
    'latitude': 40.00403611111111,
    'longitude': 116.48485555555555,
    'options': {
        'host': 'proxy.zhso.net',
        'port': 8080,
        'protocol': 'http:',
        'method': 'GET',
        'headers': {
            'Proxy-Authorization': 'Basic ' + new Buffer('username:password').toString('base64')
        }
    }
};
geocoding.location(config, function (err, data){
	if(err){
		console.log(err);
	}else{
		console.log(data);
	}
});

Custom Params

var geocoding = new require('reverse-geocoding');
var config = {
    'latitude': 40.00403611111111,
    'longitude': 116.48485555555555,
    'language': 'zh-cn'
};
geocoding.location(config, (err, data) => {
	console.log(err ? err : data);
});

Callback Data Format Sample (Base By Google Maps or Baidu Maps API)

{
	"formattedAddress": "",
	"streetAddress": "",
	"route": "",
	"intersection": "",
	"political": "",
	"country": "",
	"administrativeAreaLevel1": "",
	"administrativeAreaLevel2": "",
	"administrativeAreaLevel3": "",
	"administrativeAreaLevel4": "",
	"administrativeAreaLevel5": "",
	"colloquialArea": "",
	"locality": "",
	"ward": "",
	"sublocality": "",
	"neighborhood": "",
	"premise": "",
	"subpremise": "",
	"postalCode": "",
	"naturalFeature": "",
	"airport": "",
	"park": "",
	"pointOfInterest": ""
}