Giter Site home page Giter Site logo

modood / administrative-divisions-of-china Goto Github PK

View Code? Open in Web Editor NEW
17.8K 383.0 7.0K 163.16 MB

中华人民共和国行政区划:省级(省份)、 地级(城市)、 县级(区县)、 乡级(乡镇街道)、 村级(村委会居委会) ,**省市区镇村二级三级四级五级联动地址数据。

License: Do What The F*ck You Want To Public License

JavaScript 91.00% Shell 9.00%
china administrative-divisions address json csv province city area street nodejs

administrative-divisions-of-china's Issues

国际化i18n

你好,请问怎样能拿到国际化的数据?

加入抓取时间等信息

因为数据需要不断抓取,建议在抓取文件里加入抓取时间等信息,方便了解数据的新旧程度,鉴于json没有comment,建议将日期直接以属性值的方式加入,譬如这种

{ "_comment" : "comment text goes here...", "address":[.......] }

pc开头的文件

弱弱的问下,这些文件是什么文件啊?
pc-code.json
pc.json
pca-code.json
pca.json
pcas-code.json ago
pcas.json
打开看了,貌似压缩版的省市县区文件?

/lib/crawler.js重试死循环 & 依赖包与OS兼容问题

  1. 如果/dist/保留原有2016版数据,拉取2017版数据,通过console出来的重试信息做简单的统计比对,会发现对于2017版中删去的地址,爬虫会进入死循环,建议在crawler.js中设定一个全局的retryLimit和计数器,限制重试次数

如:

if (err.message !== 'timeout') console.log(抓取地级(${cCode})的县级数据失败(${err}),正在重试...)
return exports.fetchAreas(cCode)

可考虑改为

if (err.message !== 'timeout') {
console.log(抓取地级(${cCode})的县级数据失败(${err}),正在重试...)
retry += 1
}
if (retry < retryLimit) {
return exports.fetchAreas(cCode)
} else {
retry = 0
}

  1. sqlite3依赖包只能在windows环境下安装,在mac或linux环境下安装会报错

数据准确性有问题

你这爬出来的数据已经跟真实的不一样了;有些县升级成地市了;没有特殊处理;有些地市code、名字都变化了;那个统计的网站没更新;不过发了通知;导致没同步到最新的行政信息

webpack build

ERROR in .//china-division/index.js
Module not found: Error: Cannot resolve module 'fs' in /Users/xxx/Code/xxx/node_modules/china-division
@ ./
/china-division/index.js 3:9-22

省直辖县级行政区划不在pc.json里

我只需要用“省份、城市” 二级联动数据 pc.json来选择省份和城市,但是里面没有省直辖县级行政区。

比如如果我生活在河南省济源市,用pc.json就找不到这个地方。

pca-code.json部分数据错误

在pca-code.json三级数据中,部分数据有误,出现了乡级地区的数据,如code为4604的儋州市,它的children为乡级行政区,看了一下国家民政部的网站,它没有县(区)级行政区,所以我认为把三级的children改为460400儋州市会更合理。
同理类似的还有4419东莞等其他没有县级行政区的市级行政区

增加 path 依赖

var path = require('path'), 需要在 package.json 里面依赖 path 模块

强烈建议将输出数组结构调整下,便于索引

原来的结构:

{"code":"11","name":"北京市","childs":[{"code":"1101","name":"市辖区",......}]}

应调整为:
[
11=>{name:"北京市", "childs":[1101":{"name":"市辖区",'childs'......}}

这样的结构会更易于使用,能够很方便地进行数据查询

运行build出错

"build": "npm run csv && npm run json && npm run format",当我
build
运行npm run build时会报.不是内部命令

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.