Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find accurate length of trail #23

Open
kylebarron opened this issue Nov 27, 2019 · 1 comment
Open

Find accurate length of trail #23

kylebarron opened this issue Nov 27, 2019 · 1 comment

Comments

@kylebarron
Copy link
Member

Figure out why current tracks are shorter than the "known" length of the trail (2653mi or 2662mi to Manning Park). The distances I'm getting are 2D: 2592 mi, 3D: 2607.9 mi.

Reproduce

hm = Halfmile()
trail = hm.trail_full(alternates=False)
merged = linemerge([*trail.geometry])
projected = reproject(merged, geom.WGS84, geom.CA_ALBERS)

Projected 2D length

projected.length
# 4171048.0624210313 m

Haversine

from haversine import haversine
dists = []
for a, b in zip(merged.coords, merged.coords[1:]):
    dist = haversine((a[1], a[0]), (b[1], b[0]))
    dists.append(dist)

sum(dists)
# 4171.3919978317 km

Projected 3D length

dists = []
for a, b in zip(projected.coords, projected.coords[1:]):
    x = b[0] - a[0]
    y = b[1] - a[1]
    z = b[2] - a[2]
    dist_m = sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2))
    dists.append(dist_m)

sum(dists)
# 4196977.125911263 m
@kylebarron
Copy link
Member Author

I'm getting smaller distances because the data on Halfmile's site is simplified:

In the next step, we reduce the horizontal point count so that all sections stay within Garmin’s 10K track point limit. We do this by applying the Ramer-Douglas-Peucker algorithm with a 1.9 meter sigma overall and, in more accurate sections, a 1.25 meter sigma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant