Solving the pollution reporting problem
From what you have learned in this chapter, you can now solve the IoT pollution sensor data by congressional districts problem introduced earlier. Follow these general steps using either Python code or spatial query functions in a database such as PostGIS:
- Download a shapefile for U.S. Interstates such as the U.S. National Transportation Atlas Interstate Highways shapefile available from the University of Iowa (ftp://ftp.igsb.uiowa.edu/gis_library/USA/us_interstates.htm).
- Download a shapefile for US congressional districts such as the TIGER/Line Shapefile available from the US Census (https://www.census.gov/cgi-bin/geo/shapefiles/index.php?year=2016&layergroup=Congressional+Districts+%28115%29).
- Load the shapefiles into a geospatial database using
ogr2ogr
or into Python using the fiona package. - Add a 1 km buffer to the Interstates MultiLineString using the shapely package or
ST_Buffer
in PostGIS. - Use a mapping API such as Google Maps to geocode each...