All Projects → wecatch → China_regions

wecatch / China_regions

Licence: apache-2.0
最全最新中国省,市,地区json及sql数据

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to China regions

Covid 19 Timeline
请关注端点星案和张展。// 以社会学年鉴模式体例规范地统编自2019年末起武汉新冠肺炎疫情进展的时间线(2019年12月1日-2020年4月24日)。感谢志愿者的辛劳操作。A sociology timeline (2019.12.1-2020.4.24) on how Wuhan Coronavirus break and spread, edited by anonymous volunteers.
Stars: ✭ 142 (-94.49%)
Mutual labels:  china
Id Card Of China
🆔一个基于「公民身份号码」规则获取身份证号码中包含的基础信息组件(PHP)
Stars: ✭ 167 (-93.52%)
Mutual labels:  china
Crawler illegal cases in china
Collection of China illegal cases about web crawler 本项目用来整理所有中国大陆爬虫开发者涉诉与违规相关的新闻、资料与法律法规。致力于帮助在中国大陆工作的爬虫行业从业者了解我国相关法律,避免触碰数据合规红线。 [AD]中文知识图谱门户
Stars: ✭ 2,448 (-4.97%)
Mutual labels:  china
Area Puppeteer
基于 puppeteer 的中国行政区域抓取爬虫
Stars: ✭ 144 (-94.41%)
Mutual labels:  china
Covid 19 Timeline
以 社会学年鉴模式体例规范地统编自2019年末起新冠肺炎疫情进展的时间线。
Stars: ✭ 1,887 (-26.75%)
Mutual labels:  china
Trojan R
轻量高效的 Trojan 代理,使用 Rust 实现
Stars: ✭ 174 (-93.25%)
Mutual labels:  china
Tinylist
Tiny version of gfwlist, focusing on common websites ONLY
Stars: ✭ 139 (-94.6%)
Mutual labels:  china
Awesome Quant
中国的Quant相关资源索引
Stars: ✭ 2,529 (-1.82%)
Mutual labels:  china
China Domain Allowlist
常用中国网站白名单,纯列表,用于 SwitchyOmega,控制不走代理的网站。
Stars: ✭ 166 (-93.56%)
Mutual labels:  china
China Geojson
最新中国地图json文件,可用d3开发中国地图
Stars: ✭ 181 (-92.97%)
Mutual labels:  china
Pci China
Policy Change Index for China (PCI-China)
Stars: ✭ 146 (-94.33%)
Mutual labels:  china
Potatso
Potatso is an iOS client that implements Shadowsocks proxy with the leverage of NetworkExtension framework. ***This project is unmaintained, try taking a look at this fork https://github.com/shadowcoel/shadowcoel instead.
Stars: ✭ 1,925 (-25.27%)
Mutual labels:  china
Leaflet Tilelayer Baidugaode
leaflet 加载百度瓦片地图图层 以及高德 、天地图等国内常用地图
Stars: ✭ 175 (-93.21%)
Mutual labels:  china
Crawler China Mainland Universities
中国大陆大学列表爬虫
Stars: ✭ 143 (-94.45%)
Mutual labels:  china
Wuhan2019
Lest we forget this pandemic, or at least I won't forget. This project keep an archive for the mainstream media's articles which covering on COVID-19 (2019.12-). Including those deleted by CCP. Update till April 24th, 2020. All rights reserved to the author and his/her organization. 声援陈玫、蔡伟和张展。如果有言论自由,也就不会有新冠疫情的大规模爆发
Stars: ✭ 186 (-92.78%)
Mutual labels:  china
Vcards
📡️ vCards 中国黄页 - 优化 iOS/Android 来电、信息界面体验
Stars: ✭ 1,934 (-24.92%)
Mutual labels:  china
Elixir China Companies
A list of companies of China currently using Elixir in production
Stars: ✭ 170 (-93.4%)
Mutual labels:  china
Insanelycheapelectronics
A compilation of links relating to electronics me and my friends have bought from China. It is online as a resource for others just starting out in electronics, and are looking for projects to do.
Stars: ✭ 202 (-92.16%)
Mutual labels:  china
City Geo
🌄 中国城市经纬度数据。
Stars: ✭ 196 (-92.39%)
Mutual labels:  china
Rust lang cn
China Community for Rust lang
Stars: ✭ 176 (-93.17%)
Mutual labels:  china

china_regions

最全最新中国省,市,地区 json 及 sql 数据,自动抓取国标 http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/ 数据,并且自动生成 JavaScript es6 module 以及 sql 数据。

最新国标行政区规划最低到居委会这一级别了,行政区代码代码也变长了,不包含港澳台信息,按需所需不同的版本,见 https://github.com/wecatch/china_regions/releases

演示地址

http://wecatch.me/china_regions/

如何使用

数据分 json、es6 module、sql 三种格式存储,es6 module 和 sql 是根据 json 自动生成,json 数据又是根据最新国标生成,

├── js              # js module 格式
├── json            # json 格式
├── mysql           # mysql sql 格式

直接拷贝 json 和 es6 文件可直接使用,也可以根据对应的语言生成不同的模块。

Village 数据文件特别大,默认不包含在仓库中,可以 clone 仓库,在 src 中解压 village 的压缩文件,然后执行 python makedata.py

如何更新到最新国标

仓库中的现在的数据是根据最新国标生成,如果在使用中发现国标有变动,可以手动进行更新,需要有 node8 或更高环境:

  1. git clone 本仓库
  2. yarn install 或者 npm install
  3. 移除 src 目录下的 json 文件:
    ├── city.json
    ├── country.json
    ├── province.json
    ├── source.json
    ├── town.json
    └── village.json
  1. 打开 main.js 文件,取消对 main 函数执行的注释,开始执行 node main.js,一般情况下可以顺利爬取到 province、 city、country 的信息
  2. 利用已经爬取的 province、city、country 开始同步其他行政区域的信息,注释掉 main 函数根据需要分别打开 pullTownDataSync、pullVillageDataSync 爬取其他行政区域的信息,注释事项见函数注释
  3. 最后执行 python makedata.py 生成各种格式文件

注意事项

根据 town 爬取的 village 数据非常大,默认情况下不会自动生成 village 的信息,可以根据自己的需要 clone 仓库之后自己生成

行政级别顺序是:province-> city --> country --> town --> village,对应的是:省->市(市辖区)->县(区、市)->镇(街道)->村(居委会)

爬取 village 时由于数据量特别大会导致 nodejs 出现内存泄漏的情况,所以每次增量更新文件时会自动进行文件备份,生成 src/village_backup.json 备份文件不进仓库,最后再手动干预偏移量

village 的数据文件是压缩过的解压执行 tar xvfz village.tar.gz .

默认情况下不生成 village 这个级别的数据,如果需要请执行 makedata.py

反馈

如果国标页面 html 结构发生变化,请提 issue。

更新记录

2021.2.23

更新到 http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/2020/index.html 2020 最新数据

2019.4.17

fix #17 针对东莞市 中山市 儋州市三个不设区的市单独处理, 这三个市没有区,直接到镇 town,镇的上一级就是市,开发者可以根据自己的情况特殊处理,详见 src/special_city.json,SQL 数据包含在 town.sql 中

2019.4.9

2019.3.10

  • 更新数据生成的方式
  • 校验数据生成是否准确 cat src/village.json | grep id | wc -l == wc -l mysql/village.sql

2019.2.11

  • 更新数据抓取方式,使用 nodejs 抓取
  • 更新数据到最新的 2018 国标
  • 移除对 sqlite 以及 postgresql 的
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].