Using Dynamic Mapping

[1]:
import transportation_tutorials as tt
import geopandas as gpd
import pandas as pd
import matplotlib.pyplot as plt
import folium
from shapely.geometry import Polygon

Questions

Using folium, create a dynamic map and place markers on the centroids of the five MAZ’s with the highest population density MAZs. Use popup text on markers to show population density and total employment information for each of those MAZs. By clicking the markers, you should be able to answer the following questions:

  1. Where is the highest population density?
  2. What is the total employment in the MAZ that has the highest population density?

Data

To answer the questions, use the following files:

[2]:
maz = gpd.read_file(tt.data('SERPM8-MAZSHAPE'))
maz_data = pd.read_csv(tt.data('SERPM8-MAZDATA', '*.csv'))
[3]:
maz.head()
[3]:
OBJECTID MAZ SHAPE_LENG SHAPE_AREA ACRES POINT_X POINT_Y geometry
0 1 5347 8589.393674 3.111034e+06 71 953130 724165 POLYGON ((953970.4660769962 723936.0810402408,...
1 2 5348 11974.067469 7.628753e+06 175 907018 634551 POLYGON ((908505.2801046632 635081.7738410756,...
2 3 5349 9446.131753 4.007041e+06 92 923725 707062 POLYGON ((922736.6374686621 708387.6918614879,...
3 4 5350 21773.153739 2.487397e+07 571 908988 713484 POLYGON ((908334.2374677472 715692.2628822401,...
4 5 5351 17882.701416 1.963139e+07 451 909221 717493 POLYGON ((911883.0187559947 719309.3261861578,...
[4]:
#maz = maz.to_crs(epsg = 4326)
[5]:
maz.crs
[5]:
{'init': 'epsg:2236'}
[6]:
maz.plot()
[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a28780a20>
../_images/exercises_exercise-geo-dynamic-map_10_1.png
[7]:
maz_data.head()
[7]:
mgra TAZ HH POP emp_self emp_ag emp_const_non_bldg_prod emp_const_non_bldg_office emp_utilities_prod emp_utilities_office ... EmpDenBin DuDenBin POINT_X POINT_Y ACRES HotelRoomTotal mall_flag beachAcres geoSRate geoSRateNm
0 1 2901 43 169 0 0 0 0 0 0 ... 1 1 841743 586817 510 0 0 0 1 1
1 2 2902 9 21 0 1 1006 0 8 0 ... 1 1 855391 585688 5678 0 0 0 1 1
2 3 2903 403 1389 0 0 6 0 0 0 ... 1 1 858417 549492 85 0 0 0 1 1
3 4 2903 477 1659 0 0 3 0 0 0 ... 1 1 858468 552269 103 0 0 0 1 1
4 5 2903 374 1389 0 0 11 0 0 0 ... 1 1 859899 552161 72 0 0 0 1 1

5 rows × 76 columns