3.0.2 • Published 5 years ago

reverse-geocoding v3.0.2

Weekly downloads
379
License
MIT
Repository
github
Last release
5 years ago

reverse-geocoding

Reverse Geocoding for a Latitude and Longitude by Async.

bitHound Overall Score Inline docs Build Status Coverage Status

Features

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

Examples

Basic

var geocoding = new require('reverse-geocoding');
var config = {
    'latitude': 40.00403611111111,
    'longitude': 116.48485555555555
};
geocoding(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(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(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": ""
}
3.0.2

5 years ago

3.0.1

6 years ago

2.0.0

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago