<jupyter_start><jupyter_text>URLhttps://knoxgis.maps.arcgis.com/home/item.html?id=5c1c99f1e6f94e60aec8325646473ab3 DescriptionPublic-access, multi-use trails within Knox County provided by City ofKnoxville, Knox County, Town of Farragut and other entities such asLegacy Parks and TWRA. This dataset contains paved greenways, foottrails and shared use trails that may permit walking or biking. UrbanWilderness trails are included.Data for the City of Knoxville and Knox County is consideredauthoritative and is reflects the best-available information aboutfacilities operated by these entities.<jupyter_code>import json
import tempfile

import requests
import geopandas as gpd

# gpd read_file reqires a file not url so this is a hack...

## arcgis provides download links that are dynamic... why? So we will save file and use lfs to download
# response = requests.get('https://ago-item-storage.s3-external-1.amazonaws.com/5c1c99f1e6f94e60aec8325646473ab3/Greenways_And_Trails_-_GeoJSON.geojson?X-Amz-Security-Token=<PASSWORD>%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDAnPG2wjbvb5zP%2FFGyK3A%2FcxxrclaLCI6AjV1%2BATfnWEq%2F%2Bx687lwFa6SsKdX0%2FSUP58Cej%2Fad87YpmGaOn9o9SqsUXclzGmbUaIGLvnR0K3pDmVXD9EfUA2VH%2BPAiSMVlki2Eq34YKksKe0r3GqemohDTUcEfCAeZr0xjAFJuQcb0MFtsltzMvRPlhlGhpKYAE%2BB6hU1WnsFLmEFT%2BU8tjgNHwaCKSW8pwBdJKEGzCwsj91BqjdUNn%2BnBlFrXq4%2BT2J%2B%2BWNVQr8IixiLBKiysoZUzwBDsvIWDZYWmou%2FSCLKNDNezsc5GfnMq5%2BGlMysXqhfj7vNw16uw2fV0q29d5ginY6FxHXusi70SN92a74YXYiw5eotu1V10oiWyh640khuY%2FrOe58lZ7BwoUT3oJ%2F%2BLnVAjPagVVls70C5evG1DuYBvkEBM0VV7MTDf4VsCGhuVP5qETOB6mVmjGz3yChKw7m5bUxU%2BCvmYwedxBNewPVXw1MVO4GLdQMjDcDH97zqpA8jxRnEyYcpgBzxagpM3VtPypWJPc4bGvVhwK1yAj%2B5M1kSpoX6deNWKAP5ukIGK4Ot1lWIXDdJJkjaD7kP5R246Io7afY2QU%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20180629T125225Z&X-Amz-SignedHeaders=host&X-Amz-Expires=300&X-Amz-Credential=ASIAIMGGXGVGKVX646JA%2F20180629%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=90b4b58346b8aa3a75b572585c8c4912a304598b9afabade6a4e7f3fde65e6cf')
# with open('../data/trails/trails.geojson', 'wb') as f:
#     f.write(response.content)
# trails = gpd.read_file('../data/trails/trails.geojson')

response = requests.get('https://gitlab.com/costrouc/knoxville-opendata-notebooks/raw/master/data/trails/trails.geojson')
with tempfile.NamedTemporaryFile() as f:
    f.write(response.content)
    trails = gpd.read_file(f.name)

# knoxville_bnd = gpd.GeoDataFrame.from_file('../data/knoxville_boundary.geojson')
response = requests.get('https://gitlab.com/costrouc/knoxville-opendata-notebooks/raw/master/data/knoxville_boundary.geojson')
with tempfile.NamedTemporaryFile() as f:
    f.write(response.content)
    knoxville_bnd = gpd.read_file(f.name)
base = knoxville_bnd.plot(color='white', edgecolor='black', figsize=(20, 10))
trails.plot(ax=base, color='darkgreen', markersize=5)
trails.info()
trails.sample(5)
trails.SURFACE.unique()
trails.TYPOLOGY.unique()
trails.WIDTHDESCRIPTION.unique()<jupyter_output><empty_output><jupyter_text>How many miles of single track dirt bike tracks exist?<jupyter_code>condition = (trails['TYPOLOGY'] == 'Shared Use Trail') & \
            (trails['SURFACE'] == 'Dirt') & \
            ((trails['WIDTHDESCRIPTION'] == 'Single track') | (trails['WIDTHDESCRIPTION'] == 'Single Track'))
trails[condition].info()
# Change projectection so that we can use regular units (miles, kilometers, meters etc.)
ECKERT_IV_PROJ_STRING = "+proj=eck4 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs"
trails_eckert = trails.to_crs(ECKERT_IV_PROJ_STRING)
print('miles of single track dirt trails in knoxville', trails_eckert[condition].geometry.length.sum() / 1000 * 0.6213712, 'miles')<jupyter_output>miles of single track dirt trails in knoxville 67.26849534971771 miles
{'fraction_non_alphanumeric': 0.10554513795874632, 'fraction_numerical': 0.07822126975622823, 'mean_word_length': 7.765258215962441, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '538680', 'license': 'MIT', 'n_tokens_mistral': 1754, 'n_tokens_neox': 1628, 'n_words': 213, 'path': 'notebooks/trails.ipynb', 'repo_name': 'knoxdata/knoxville-opendata-notebooks', 'size': '3734'}