当前位置:网站首页>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 .

边栏推荐
- [Godot] add menu button
- Computer graduation design PHP makeup sales Beauty shopping mall
- Self executing function
- 2022-2028 global plasmid DNA cdmo industry research and trend analysis report
- Valentine's day, send you a little red flower~
- The number of incremental paths in the grid graph [dfs reverse path + memory dfs]
- Redis core technology and practice - learning notes (VI) how to achieve data consistency between master and slave Libraries
- PHP MySQL preprocessing statement
- Count the number of pixel values in the image
- 图像24位深度转8位深度
猜你喜欢

English语法_形容词/副词3级 - 倍数表达

The second largest gay dating website in the world was exposed, and the status of programmers in 2022

Global and Chinese pediatric palliative care drug market development research and investment planning recommendations report 2022-2028

2022-2028 global scar care product industry research and trend analysis report

Redis core technology and practice - learning notes (VIII) sentinel cluster: sentinel hung up

English grammar_ Noun classification

Module 9 operation

win32:堆破壞的dump文件分析

Codeforces Round #803 (Div. 2) C. 3SUM Closure

How do microservices aggregate API documents? This wave of operation is too good
随机推荐
Summary and Reflection on the third week of winter vacation
[combinatorics] generating function (use generating function to solve the number of solutions of indefinite equation)
Valentine's day, send you a little red flower~
Codeforces Round #803 (Div. 2) C. 3SUM Closure
Redis cache avalanche, penetration, breakdown
Redis core technology and practice - learning notes (11): why not just string
Talk about the design and implementation logic of payment process
Discussion sur la logique de conception et de mise en oeuvre du processus de paiement
English語法_名詞 - 分類
[combinatorics] generating function (positive integer splitting | repeated ordered splitting | non repeated ordered splitting | proof of the number of repeated ordered splitting schemes)
A. Odd Selection【BruteForce】
[untitled]
MySQL grouping query
Computer graduation design PHP campus address book telephone number inquiry system
[enumeration] annoying frogs always step on my rice fields: (who is the most hateful? (POJ hundred practice 2812)
Graduation summary
Naoqi robot summary 27
Line by line explanation of yolox source code of anchor free series network (6) -- mixup data enhancement
PHP MySQL inserts data
Change the single node of Postgres database into master-slave