Skip to content

geoHeil/unnecessary-activity-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unnecessary-activity-tracker

A tool to identify and visualize necessary and unnecessary movement of people using positional data(e. g. anonymized cell phone data)

This project was made in 48h hours from 20.3 to 22.3.20 during the #WirVsVirus -Hackathon, to contribute in finding solutions to the ongoing corona-crisis. Also see the corresponding devpost-page(in German). Feel free to pull request and help continue the development of this tool!

Dependencies

You'll need Python3.x and the following modules: overpy, numpy, pandas, geopandas, rtree You can install them using pip or anaconda!

Generating the Infrastructure

A Shape File of the grid(the .shp, .dbf, .shx files), and a Table with tagweights. (You could also use a single .geojson files in all commands instead of .shp files)

With the files in the same folder you may generate the infrastructure score for all grids by running

python3 grid_infra_score_gen.py GRID.shp TAG_WEIGHTS.csv INFRA_SCORES.shp

Keep in mind that this generates 5 filetypes: .cpg, .dbf, .prj, .shp, .shx If you set this Tool up on a server, you might consider running this very rarely, because the infra_score won't change much over time.

Generating the Shape File

If you got your files(especially the .shp and .shx) you can generate the final scores by executing

python3 main.py INFRA_SCORES.shp POINTS.shp POINTS_BACKGROUND.shp SCORES_FINAL.shp

Where POINTS.shp is the Shape File for the Location-Data, and POINTS_BACKGROUND.shp is the background noise of given Point distribution.(e. g. at night) SCORES_FINAL.shp is the output Shape File. This generates 5 filetypes(.cpg, .dbf, .prj, .shp, .shx) for the Shape file with values

  • geometry The Grids geometries to display in any compatible program
  • val The calculated value of unnecessary-movement calculated with val(pop, infra)= pop^infra + pop
  • pop The calculated value of movement
  • infra The generated values for the surrounding infra structure By specifying a different file extension for the output file to .geojson, a .geojson with the given data ready to display with web-frontend APIs(e. g. Leaflet, OpenLayers)

No files? We have example data

We ran the analysis for Heidelberg, Germany. You can use the grid and point files found in data-samples.

Feel also free to use the hand-crafted tagweights.csv. You can try it out yourself! Just run

python3 grid_infra_score_gen.py data-samples/grid/grid.shp tagweights.csv infra_score.shp

and after that

python3 main.py infra_score.shp data-samples/points/points.shp data-samples/t0_points/t0_points.shp final_score.shp

You should now be able to open the generated Shape File in any compatible editor.(e. g QGis) Alternatively you can see the result for Heidelberg here.

Built With

  • Overpass - The API used to access OSM
  • overpy - Python Wrapper to access the Overpass-API
  • geopandas - Mapping Python Library build on pandas to create and import Shape Files
  • QGis - Used to display Shape Files
  • qgis2web - Used to generate the example page
  • OpenLayers - Used by qgis2web to display the map

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages