<jupyter_start><jupyter_text>**Problem 1: Visualize a static map*****Travel times to Jumbo shopping center by car***<jupyter_code>import pandas as pd
import geopandas as gpd
from pyproj import CRS
import matplotlib.pyplot as plt

# Read files
grid = gpd.read_file('/home/jovyan/work/exercise-4-taigako/data/MetropAccess_YKR_grid_EurefFIN.shp')

data = pd.read_csv('/home/jovyan/work/exercise-4-taigako/data/TravelTimes_to_5878070_Jumbo.txt', 
                   sep=';', usecols=['car_r_t', 'from_id', 'to_id']
                   )

roads = gpd.read_file('/home/jovyan/work/autogis/notebooks/L5/data/roads.shp')

shops = gpd.read_file('/home/jovyan/work/autogis/exercises/exercise-3-taigako/shopping_centers.shp')
# Choose Jumbo shopping center
jumbo = shops.iloc[[4]]

# Rename 'from_id' column to 'YKR_ID'
data = data.rename(columns={'from_id':'YKR_ID'})

# Merge the travel times DataFrame to grid
data_geo = grid.merge(data, on='YKR_ID')

# GeoDataFrames reprojected to ETRS89 / TM35FIN based on crs of data_geo
roads = roads.to_crs(crs=data_geo.crs)
jumbo = jumbo.to_crs(crs=data_geo.crs)
# Replace -1 values with nan and remove rows containing nan
data_geo[data_geo == -1] = float('nan')
data_geo = data_geo.dropna()
# Aggregate data_geo by car travel times 
jumbo_car = data_geo.dissolve(by='car_r_t')
jumbo_car.reset_index(inplace=True)

# Select useful columns
jumbo_car = jumbo_car[['car_r_t', 'geometry']]

# Create subplots
fig, ax = plt.subplots(figsize=(6,4))

# Plotting
jumbo_car.plot(ax=ax, column = "car_r_t",
          linewidth=0.03, 
          cmap="Spectral",  
          legend=True, 
          legend_kwds={'label': "Travel time (min)"}
          )

jumbo.plot(ax=ax, color='black', markersize=10)

roads.plot(ax=ax, color="grey", linewidth=1)

# Set title and legend to plot
ax.set_title('Jumbo - Travel times by car')
plt.legend(['Jumbo'])

# Remove empty whitespace around the plots
plt.tight_layout()

# Define output filename for the figure
output_fig1 = "docs/jumbo_accessibility_car.png"

# Save the figure into disk
plt.savefig(output_fig1)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13035204567078973, 'fraction_numerical': 0.01379638439581351, 'mean_word_length': 4.593085106382978, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '484735', 'license': 'MIT', 'n_tokens_mistral': 851, 'n_tokens_neox': 791, 'n_words': 164, 'path': 'Ex-5-problem-1.ipynb', 'repo_name': 'AutoGIS-2020/exercise-5-taigako', 'size': '2102'}