当前位置:网站首页>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 .
边栏推荐
- Postfix 技巧和故障排除命令
- PHP MySQL preprocessing statement
- Sensor 调试流程
- How to expand the capacity of golang slice slice
- Bidding procurement scheme management of Oracle project management system
- WebView module manages the application window interface to realize the logical control and management operation of multiple windows (Part 1)
- 2022-2028 global scar care product industry research and trend analysis report
- (8) HS corner detection
- [combinatorics] generating function (positive integer splitting | unordered | ordered | allowed repetition | not allowed repetition | unordered not repeated splitting | unordered repeated splitting)
- [combinatorics] generating function (use generating function to solve the number of solutions of indefinite equation)
猜你喜欢
What London Silver Trading software supports multiple languages
Investigation on the operation prospect of the global and Chinese Anti enkephalinase market and analysis report on the investment strategy of the 14th five year plan 2022-2028
Win 11 major updates, new features love love.
English grammar_ Adjective / adverb Level 3 - multiple expression
Have you learned the correct expression posture of programmers on Valentine's day?
PHP MySQL inserts multiple pieces of data
Redis core technology and practice - learning notes (11): why not just string
English语法_形容词/副词3级 - 倍数表达
How to analyze the rising and falling rules of London gold trend chart
Research on Swift
随机推荐
Classroom attendance system based on face recognition tkinter+openpyxl+face_ recognition
Win32: analyse du fichier dump pour la défaillance du tas
Redis core technology and practice - learning notes (VII) sentinel mechanism
2022-2028 global sepsis treatment drug industry research and trend analysis report
Computer graduation design PHP campus address book telephone number inquiry system
English grammar_ Noun classification
Golang string (string) and byte array ([]byte) are converted to each other
Kotlin's collaboration: Context
Nodejs (01) - introductory tutorial
Market demand survey and marketing strategy analysis report of global and Chinese pet milk substitutes 2022-2028
模块九作业
聊聊支付流程的设计与实现逻辑
ES7 - Optimization of promise
The gbase 8A database does not support the DB2 function value (column_name, 0) cluster syntax
[combinatorics] generating function (positive integer splitting | unordered | ordered | allowed repetition | not allowed repetition | unordered not repeated splitting | unordered repeated splitting)
Summary and Reflection on the third week of winter vacation
How do microservices aggregate API documents? This wave of operation is too good
Codeforces Round #803 (Div. 2) C. 3SUM Closure
统计图像中各像素值的数量
A. Berland Poker & 1000 [simple mathematical thinking]