当前位置:网站首页>Administrative division code acquisition
Administrative division code acquisition
2022-07-03 18:19:00 【wclwksn2019】
stay gis The development of , Administrative division data is often used , According to the national compilation , Each administrative division has a code , How to get the corresponding data , The National Bureau of statistics updates all provinces and cities in the country every year 、 District and county 、 Township information and code , The way to provide is html Web form , You can use code to crawl information .
Website of administrative divisions of the National Bureau of Statistics ( Calendar year ):
http://www.stats.gov.cn/tjsj/tjbz/tjyqhdmhcxhfdm/
Crawling way
First of all, analyze the webpage of administrative division information , Use chrome Or other browser developer tools , Check the source code of the web page , Provincial Information , There are links to web pages with names and subordinate administrative divisions , Here's the picture :
Municipal Information , It is also the name and administrative division code , Here's the picture :
Same principle , You can check districts and counties 、 Township 、 The name and link address of the community village .
Crawl use class library (nodejs)
Use nodejs When crawling the administrative division web page information , Use the following key class libraries :
axios Front end class library used to request web pages , Crawl the web information down ;
iconv-lite The page code is gb2312, Direct use axios Return string , There will be garbled code , It needs to be changed ;
cheerio Webpage dom Operation class library ,cheerio yes jquery A fast, flexible and concise implementation of core functions
Use axios according to url, With arraybuffer Request the web page in the form of , Use icon-lite With gb2312 Encoding for string conversion , Use cheerio Convert strings dom Form to operate .

边栏推荐
- 2022-2028 global petroleum pipe joint industry research and trend analysis report
- Classroom attendance system based on face recognition tkinter+openpyxl+face_ recognition
- Research on Swift
- English语法_名词 - 分类
- [combinatorics] generating function (positive integer splitting | repeated ordered splitting | non repeated ordered splitting | proof of the number of repeated ordered splitting schemes)
- Prototype inheritance..
- Research Report on investment trends and development planning of China's thermal insulation material industry, 2022-2028
- WebView module manages the application window interface to realize the logical control and management operation of multiple windows (Part 1)
- 企业级自定义表单引擎解决方案(十二)--表单规则引擎2
- Enterprise custom form engine solution (12) -- form rule engine 2
猜你喜欢

How to install PHP on Ubuntu 20.04
![AcWing 271. Teacher Yang's photographic arrangement [multidimensional DP]](/img/3d/6d61fefc62063596221f98999a863b.png)
AcWing 271. Teacher Yang's photographic arrangement [multidimensional DP]

一入“远程”终不悔,几人欢喜几人愁。| 社区征文

List的stream中Long对象与long判等问题记录

2022-2028 global aircraft head up display (HUD) industry research and trend analysis report

Redis cache avalanche, penetration, breakdown

Mature port AI ceaspectus leads the world in the application of AI in terminals, CIMC Feitong advanced products go global, smart terminals, intelligent ports, intelligent terminals

Valentine's day, send you a little red flower~

On Data Mining

English grammar_ Noun classification
随机推荐
Fedora 21 installs lamp host server
微服务组件Sentinel控制台调用
[Tongxin UOS] scanner device management driver installation
On Data Mining
BFS - topology sort
2022-2028 global aircraft head up display (HUD) industry research and trend analysis report
Talk about the design and implementation logic of payment process
[tutorial] build your first application on coreos
[combinatorics] generating function (generating function application scenario | using generating function to solve recursive equation)
Enterprise custom form engine solution (12) -- form rule engine 2
Supervisor monitors gearman tasks
How to draw non overlapping bubble chart in MATLAB
[combinatorics] generating function (positive integer splitting | basic model of positive integer splitting | disordered splitting with restrictions)
Analysis report on production and marketing demand and investment forecast of China's PVC industry from 2021 to 2026
Summary and Reflection on the third week of winter vacation
Postfix 技巧和故障排除命令
PHP MySQL order by keyword
[combinatorics] generating function (use generating function to solve the combination number of multiple sets R)
Micro service component sentinel console call
聊聊支付流程的设计与实现逻辑