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

边栏推荐
- G1 garbage collector of garbage collector
- [combinatorics] generating function (commutative property | derivative property | integral property)
- Introduction to PHP MySQL
- Prototype inheritance..
- 小程序 多tab 多swiper + 每个tab分页
- Should I be laid off at the age of 40? IBM is suspected of age discrimination, calling its old employees "dinosaurs" and planning to dismiss, but the employees can't refute it
- 网格图中递增路径的数目[dfs逆向路径+记忆dfs]
- Count the number of pixel values in the image
- Win32: dump file analysis of heap corruption
- Codeforces Round #803 (Div. 2) C. 3SUM Closure
猜你喜欢

Research Report on competitive strategy Outlook Analysis and investment strategic planning of China's smart home equipment industry, 2022-2028

Talk about the design and implementation logic of payment process

Talk about the design and implementation logic of payment process

Analysis report on production and marketing demand and investment forecast of China's PVC industry from 2021 to 2026

模块九作业

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

Redis core technology and practice - learning notes (VI) how to achieve data consistency between master and slave Libraries

The vscode code is automatically modified to a compliance code when it is formatted and saved

Win32: analyse du fichier dump pour la défaillance du tas

Class exercises
随机推荐
Have you learned the correct expression posture of programmers on Valentine's day?
Research Report on market demand and investment planning for the development of China's office chair industry, 2022-2028
Unsafe类的使用
Module 9 operation
[Godot] add menu button
Line by line explanation of yolox source code of anchor free series network (5) -- mosaic data enhancement and mathematical understanding
Three gradient descent methods and code implementation
English grammar_ Adjective / adverb Level 3 - multiple expression
Codeforces Round #803 (Div. 2) C. 3SUM Closure
Gear2021 monthly update - December
解决Zabbix用snmp监控网络流量不准的问题
Talk about the design and implementation logic of payment process
Win32: analyse du fichier dump pour la défaillance du tas
How do microservices aggregate API documents? This wave of operation is too good
WebView module manages the application window interface to realize the logical control and management operation of multiple windows (Part 1)
(9) Opencv Canny edge detection
[combinatorics] generating function (positive integer splitting | unordered | ordered | allowed repetition | not allowed repetition | unordered not repeated splitting | unordered repeated splitting)
[combinatorics] generating function (property summary | important generating function)*
Closure and closure function
Postfix tips and troubleshooting commands