Giter Site home page Giter Site logo

map-easygo's Introduction

个人博客网站:欢迎访问:https://liujiao111.github.io/

工具介绍:

该工具基于微信中的宜出行提供的数据接口进行爬取,能够爬取一定范围内的当前时间点的人流量数据。地址:https://liujiao111.github.io/

环境:

  • windows
  • python3+
  • 安装第三方包:缺啥安装啥

使用指南:

  • 申请多个qq号,并将qq号放入当前目录下的qqlist.py文件中,格式如下:
qq_list = 
[["11111111", "11111111"],
["11111111", "11111111"],
["11111111", "11111111"],
["11111111", "11111111"],
["11111111", "11111111"],
["11111111", "11111111"],
["11111111", "11111111"],
["11111111", "11111111"]]

根据你需要爬取的城市范围大小,适当申请多个qq号进行爬取(我试了下用6个号爬取来宾市的是没什么的),因为每个QQ号能爬取的数据量有限。将每个QQ号放入该文件中,并遵循已有的格式。

  • 确定需要爬取的城市矩形范围。使用百度地图提供的坐标拾取工具,确定城市的左上角、右上角、右下角、左下角四个点的坐标(大概组成一个矩形,不用太准确),并将拾取的四个坐标点依次填入setting.py文件中,并对应下面四个变量,示例:
city_bound_point_A = [114.286652,30.642638] #左上角点,x619
city_bound_point_D = [114.239273,30.580588] #左下角点,农场十一队
city_bound_point_B = [114.462433,30.574677] #右上角点,木妙
city_bound_point_C = [114.418488,30.479746] #右下角点,牛场右下角
  • 双击 run.bat文件,执行爬取程序,需要注意的是程序会自动打开谷歌浏览器并进行登陆操作,属于正常现象需要提前装好谷歌浏览器。

  • 等待一段时间后(具体不一定,大概10分钟),爬取后的结果存放到example文件夹中,里面txt文件就是爬取到的人流量数据,文件使用爬取的时间点进行命名,数据有四个字段 count,wgs_lng,wgs_lat,time,分别代表人流量,经度,纬度,时间点,后面可以使用该文件进行解析得到需要的数据,并进行可视化。

  • 这里提供了一个可以解析人流量txt数据文件,并生成用于百度地图热力图展示需要的数据的代码,见目录下的read_data_to_txt.py代码,需要修改代码中file_path的路径,修改为上面生成的example文件夹中txt格式的人流量数据所在文件路径,保存然后执行data2txt.bat,执行后会在当前目录下生成data_flow.xls和data.txt两个人流量数据文件。

  • 上面生成的txt文件可以拷贝内容到baidu_relitu.html文件中(文件内容有点多,请耐心等待),将html文件中第31行var points = 后面的内容替换为上面data.txt中的文本内容,并且将第27行的中心点坐标替换为31行中随意一个坐标点的坐标,保存后在浏览器打开该HTML文件,即可看到在地图上展示的热力图数据。

map-easygo's People

Contributors

liujiao111 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.