API for finding zipcode in Taiwan
This package is reference from mosky .
Installation
$ npm install addrtozip
Usage
####First you have to require the package.
var addrtozip = require('addrtozip');
Send an address to query zipcode.
addr
: Required. An address for finding zipcode
callback
: Required. Callback will return a json contain zipcode and address.
addrtozip.find(addr, callback);
Example
var addrtozip = require('addrtozip');
addrtozip.find('台北市信義區市府路45號', function (zipcode){
console.log(zipcode);
}
And you will get a json data, like this.
{ "zipcode": '11001', "addr": '台北市信義區市府路45號' }
Gradual
A legal address contain city(縣市), area(鄉鎮市區), street(路街巷弄號),
and exclude village(村里) and neighborhood(鄰).
We also can find informal zipcode gradually, but that will reduce the precision.
var addrtozip = require('addrtozip');
addrtozip.find('台北市', function (zipcode){
}
addrtozip.find('台北市信義區', function (zipcode){
}
addrtozip.find('台北市信義區市府路', function (zipcode){
}
addrtozip.find('台北市信義區市府路45號', function (zipcode){
}
Get city list
Just get city list
var addrtozip = require('addrtozip');
addrtozip.getCities(function (err, cities) {
})
Get cityareas list
Just get cityareas list
var addrtozip = require('addrtozip');
addrtozip.getAreas('台北市', function (err, areas) {
})
If any adress is legal, but return wrong zipcode.
Please let me know. Thanks.