Using Selection by Geography

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

Questions

Consider a study area that mostly covers Deerfield Beach in Florida. The study area can be defined by a polygon bounded by the following coordinates (given in epsg:4326):

[2]:
Polygon([
    (-80.170862, 26.328588),
    (-80.170158, 26.273494),
    (-80.113007, 26.274882),
    (-80.104592, 26.293503),
    (-80.072967, 26.293790),
    (-80.070111, 26.329349)
])
[2]:
../_images/exercises_exercise-geo-selection_4_0.svg
  1. Use OSMnx to download the boundaries for Deerfield Beach, and generate an image that compares the city to the indicated study area polygon. Are there any areas in the city of Deerfield Beach that are outside the designated studay area, and if so, is this concerning? (Hint: use the ``add_basemap`` function from the ``transportation_tutorials.mapping`` package to add context to your map.)
  2. How many MAZs are there that are located completely inside the study area? Generate a static map of only these MAZ’s. (Hint: Please make sure to use appropriate Coordinate Reference Systems (CRS) in your analysis.)
  3. How many MAZs are at least partially inside the study area? Generate a static map of these MAZ’s, including the full area of any MAZ that is at least partially contained in the study area.

Data

To answer the questions, use the following file:

[3]:
maz = gpd.read_file(tt.data('SERPM8-MAZSHAPE'))
[4]:
maz.plot(figsize = (10,10));
../_images/exercises_exercise-geo-selection_9_0.png
[5]:
maz.head()
[5]:
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,...