Find all OpenStreetMap edits by @dhimmel of the Long Trail

This notebook produces data for the blog post at https://blog.dhimmel.com/long-trail-maps.

First use osm-get-user-changeset-metadata to download all changesets by user dhimmel:

In [1]:
! ./osm_get_user_changeset_metadata.sh dhimmel
User 'dhimmel' (9376583)
Account Created: 2019-01-22T00:17:27Z
Changesets: 407
Downloading Changesets between: 2019-01-22T00:17:27Z and now.
100 / 407
Downloading Changesets between: 2019-01-22T00:17:27Z and 2021-01-21T17:57:25Z.
200 / 407
Downloading Changesets between: 2019-01-22T00:17:27Z and 2020-08-31T01:05:41Z.
300 / 407
Downloading Changesets between: 2019-01-22T00:17:27Z and 2020-07-30T00:56:44Z.
400 / 407
Downloading Changesets between: 2019-01-22T00:17:27Z and 2019-01-30T21:54:23Z.
407 / 407
Downloading Changesets between: 2019-01-22T00:17:27Z and 2019-01-22T00:40:26Z.
407 / 407
In [2]:
from pathlib import Path
import xml.etree.ElementTree as ET
import pandas as pd
In [3]:
paths = sorted(Path(".").glob("9376583/[0-9]*.xml"))
list(paths)
Out[3]:
[PosixPath('9376583/1.xml'),
 PosixPath('9376583/2.xml'),
 PosixPath('9376583/3.xml'),
 PosixPath('9376583/4.xml'),
 PosixPath('9376583/5.xml'),
 PosixPath('9376583/6.xml')]
In [4]:
changesets = []
for path in paths:
    tree = ET.parse(path)
    changesets.extend(tree.findall("changeset"))
len(changesets)
Out[4]:
407
In [5]:
def process_changeset(changeset: ET.Element) -> dict:
    return {
        "id": changeset.get("id"),
        "created_at": changeset.get("created_at"),
        "comment": changeset.find("tag[@k='comment']").get("v"),
    }

changeset_df = pd.DataFrame([process_changeset(changeset) for changeset in changesets])
changeset_df = changeset_df.sort_values("created_at")
changeset_df.head()
Out[5]:
id created_at comment
406 66522566 2019-01-22T00:40:26Z Add house for 8 Grant Rd, Hanover NH
405 66522610 2019-01-22T00:44:50Z Add house for 11 Hemlock Rd, Hanover NH
404 66524017 2019-01-22T02:34:45Z Add Woods Lake in the High Sierra
403 66524337 2019-01-22T02:56:14Z Add Sawmill Lake in the High Sierra
402 66542853 2019-01-22T16:21:11Z Add water bodies along Sawmill pass
In [6]:
long_trail_df = changeset_df[changeset_df.comment.str.contains("Long Trail", case=False)]
long_trail_df.head(2)
Out[6]:
id created_at comment
168 91547642 2020-09-26T11:16:27Z Long Trail: journey's end
167 91551975 2020-09-26T13:37:07Z Long Trail: canada to jay peak
In [7]:
len(long_trail_df)
Out[7]:
34
In [9]:
pd.set_option('display.max_colwidth', None)
long_trail_df
Out[9]:
id created_at comment
168 91547642 2020-09-26T11:16:27Z Long Trail: journey's end
167 91551975 2020-09-26T13:37:07Z Long Trail: canada to jay peak
166 91552168 2020-09-26T13:42:32Z Long Trail: jay loop & jay camp
164 91559451 2020-09-26T17:36:14Z Long Trail: Belvidere Fire Tower & side trails
163 91562394 2020-09-26T19:49:14Z Long Trail: Johnson businesses
162 91589327 2020-09-27T16:10:29Z Long Trail: Plot Road to Route 15 in Johnson
161 91589801 2020-09-27T16:25:25Z Long Trail: Plot Road crossing
160 91591083 2020-09-27T17:02:55Z Long Trail: Madonna Peak and Sterling Pond
159 91591421 2020-09-27T17:14:39Z Long Trail: Elephant’s Head Spur
158 91592239 2020-09-27T17:43:22Z Long Trail: Smugglers Notch to Mansfield
157 91594936 2020-09-27T19:16:35Z Long Trail: Appalachian Gap
156 91598205 2020-09-27T21:24:53Z Long Trail: Maine Junction to Mill River
155 91598849 2020-09-27T22:04:03Z Long Trail: Griffith Lake area
154 91598901 2020-09-27T22:07:43Z Long Trail: mad tom notch to bromley
153 91600526 2020-09-28T00:07:00Z Long Trail: prospect rocks
152 91601694 2020-09-28T01:05:42Z Long Trail: stratton pond
150 91602478 2020-09-28T01:41:47Z Long Trail: southern terminus to Harmon Hill
148 91602726 2020-09-28T01:53:48Z Long Trail: Glastenbury Fire Tower
146 91669993 2020-09-29T00:00:42Z Long Trail: near Cowles Cove Shelter
145 91671117 2020-09-29T01:17:08Z Long Trail: Camel's Hump to Bolton Mountain & Old Long Trail
144 91671324 2020-09-29T01:30:26Z Long Trail: Puffer Shelter
143 91671479 2020-09-29T01:41:02Z Long Trail: Mansfield Nose
142 91671893 2020-09-29T02:02:02Z Long Trail: Belvidere Road
141 91708726 2020-09-29T12:41:43Z Long Trail: Barnes Camp Visitor Center
140 91708957 2020-09-29T12:46:13Z Long Trail: Barnes Camp Bridge
139 91733004 2020-09-29T23:53:44Z Long Trail: Stratton Mountain
138 91733374 2020-09-30T00:21:53Z Long Trail: Kid Gore Shelter
137 91733492 2020-09-30T00:33:37Z Long Trail: alignment tweaks nearGlastenbury
135 91734991 2020-09-30T02:20:20Z Long Trail: Melville Nauheim Shelter
134 91792552 2020-10-01T01:21:24Z Long Trail: Little Rock Pond
133 91793315 2020-10-01T02:11:55Z Long Trail: Bloodroot Area
125 92074705 2020-10-07T01:50:04Z Long Trail: VT11, Corridor 7, fix overlapping ways
123 92075055 2020-10-07T02:12:27Z Long Trail: reorder route relation, NoBo sequential
122 92111912 2020-10-07T12:14:46Z Long Trail: relation tags as per https://wiki.openstreetmap.org/w/index.php?title=United_States/Long_distance_trails&oldid=1996282