Skip to content

Commit

Permalink
Reduce size of merged.gpx
Browse files Browse the repository at this point in the history
  • Loading branch information
Binnette committed Apr 3, 2024
1 parent b7ee66f commit 5742eb8
Show file tree
Hide file tree
Showing 7 changed files with 69,729 additions and 415,901 deletions.
2 changes: 2 additions & 0 deletions Scrapping/Scrapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ document.querySelectorAll("ul.w-full > li").forEach(eventElement => {
var dplusMatch = eventElement.textContent.match(/D\+: ([0-9]+)m/);
dplus = dplusMatch ? parseFloat(dplusMatch[1]) : '';
var albumTitle = title.replaceAll(":", " ").replaceAll(" ", " ").replaceAll(" ", "-").trim();
albumTitle = albumTitle.replaceAll("é", "e").replaceAll("è", "e").replaceAll("'", "");
albumTitle = albumTitle.replaceAll("(", "").replaceAll(")", "").replaceAll("-+-", "-");
var album = `${dateString}-${albumTitle}.html`;
events.unshift([`'${dateString}`, "", km, dplus, "", people, `"${title}"`, type, "", id, url, trails.join(";"), "", "", "", `"${album}"`, ""].join(","));
});
Expand Down
10 changes: 5 additions & 5 deletions Stats/9igf-gac.csv
Original file line number Diff line number Diff line change
Expand Up @@ -287,11 +287,11 @@ Date,Suffix,KM,Dplus,Top,People,Name,Type,Comment,id,EventLink,TrailShortLink,Tr
2024-01-28,,10.5,510,1136,4,"🥾🟢 Hike: Sainte-Agnès, a village between forest 🌲 and mountains ⛰️",Hike,,298820053,https://www.meetup.com/grenoble-adventure-club-english-french/events/298820053,https://s.42l.fr/vxvZ2C-J,"https://brouter.de/brouter-web/#map=15/45.2397/5.9378/1069&lonlats=5.921196,45.238118;5.914186,45.246295;5.925954,45.240652;5.958259,45.241218;5.962403,45.234311;5.950215,45.234542;5.937531,45.235028;5.933175,45.235673;5.921247,45.238093&profile=hiking-mountain",,,"2024-01-28-🥾🟢-Hike-Sainte-Agnes,-a-village-between-forest-🌲-and-mountains-⛰️.html",
2024-02-04,,9.7,948,1791,21,"🥾🔴 Hike: La Scia from St-Pierre-de-Chartreuse ⛄❄🛷",Hike,,298950788,https://www.meetup.com/grenoble-adventure-club-english-french/events/298950788,https://s.42l.fr/B-WDpxYh,"https://brouter.de/brouter-web/#map=15/45.3446/5.8344/OpenTopoMap&lonlats=5.814729,45.343138;5.820415,45.340261;5.838547,45.340956;5.850493,45.342247;5.850863,45.349318;5.846486,45.344892;5.823398,45.344922;5.814857,45.343334&profile=hiking-mountain",,,2024-02-04-🥾🔴-Hike-La-Scia-from-St-Pierre-de-Chartreuse-⛄❄🛷.html,
2024-02-18,,14,596,1709,25,"🥾🔵 Hike: Snow walk in Vercors ⛄🛷, loop around Charande 🗻",Hike,,299232900,https://www.meetup.com/grenoble-adventure-club-english-french/events/299232900,https://s.42l.fr/VcgCcNmM,"https://brouter.de/brouter-web/#map=13/45.1754/5.5895/standard&lonlats=5.597395,45.163769;5.592342,45.160313;5.5798,45.15148;5.578642,45.156439;5.583919,45.169848;5.588695,45.183942;5.591913,45.192078;5.592014,45.197934;5.594766,45.188616;5.594004,45.184481;5.586678,45.16824;5.597132,45.163911&profile=hiking-mountain",,,"2024-02-18-🥾🔵-Hike-Snow-walk-in-Vercors-⛄🛷,-loop-around-Charande-🗻.html",
2024-02-25,,14.1,442,432,11,"🥾🟢 Hike: Easy loop between Poliénas and l'Albenc 🏡🌲🌳🍃",Hike,,299388606,https://www.meetup.com/grenoble-adventure-club-english-french/events/299388606,https://s.42l.fr/QC34XrdR,"https://brouter.de/brouter-web/#map=14/45.2353/5.4575/OpenTopoMap&lonlats=5.471511,45.249437;5.466476,45.250959;5.468745,45.230763;5.459049,45.233942;5.448489,45.230204;5.446432,45.227233;5.441582,45.225782;5.441159,45.224785;5.441022,45.224767;5.440008,45.223627;5.439855,45.223221;5.442964,45.225776;5.449307,45.224663;5.463385,45.227082;5.469737,45.224632;5.470827,45.23318;5.470119,45.241717;5.466278,45.251012;5.471503,45.249294&straight=7&profile=hiking-mountain",,,2024-02-25-🥾🟢-Hike-Easy-loop-between-Poliénas-and-l'Albenc-🏡🌲🌳🍃.html,
2024-03-02,,12.5,374,1136,14,"🥾🟢 Hike: Easy loop around 'La Table' 🪑🏡🌞",Hike,,299514997,https://www.meetup.com/grenoble-adventure-club-english-french/events/299514997,https://s.42l.fr/tYOE_fwF,"https://brouter.de/brouter-web/#map=14/45.4936/6.1871/OpenTopoMap&lonlats=6.171457,45.479599;6.171591,45.482447;6.182792,45.492751;6.200709,45.503009;6.198611,45.499848;6.218986,45.504214;6.207191,45.493684;6.19895,45.493895;6.17318,45.477134;6.171565,45.479593&profile=hiking-mountain",,,2024-03-02-🥾🟢-Hike-Easy-loop-around-'La-Table'-🪑🏡🌞.html,
2024-02-25,,14.1,442,432,11,"🥾🟢 Hike: Easy loop between Poliénas and l'Albenc 🏡🌲🌳🍃",Hike,,299388606,https://www.meetup.com/grenoble-adventure-club-english-french/events/299388606,https://s.42l.fr/QC34XrdR,"https://brouter.de/brouter-web/#map=14/45.2353/5.4575/OpenTopoMap&lonlats=5.471511,45.249437;5.466476,45.250959;5.468745,45.230763;5.459049,45.233942;5.448489,45.230204;5.446432,45.227233;5.441582,45.225782;5.441159,45.224785;5.441022,45.224767;5.440008,45.223627;5.439855,45.223221;5.442964,45.225776;5.449307,45.224663;5.463385,45.227082;5.469737,45.224632;5.470827,45.23318;5.470119,45.241717;5.466278,45.251012;5.471503,45.249294&straight=7&profile=hiking-mountain",,,2024-02-25-🥾🟢-Hike-Easy-loop-between-Polienas-and-lAlbenc-🏡🌲🌳🍃.html,
2024-03-02,,12.5,374,1136,14,"🥾🟢 Hike: Easy loop around 'La Table' 🪑🏡🌞",Hike,,299514997,https://www.meetup.com/grenoble-adventure-club-english-french/events/299514997,https://s.42l.fr/tYOE_fwF,"https://brouter.de/brouter-web/#map=14/45.4936/6.1871/OpenTopoMap&lonlats=6.171457,45.479599;6.171591,45.482447;6.182792,45.492751;6.200709,45.503009;6.198611,45.499848;6.218986,45.504214;6.207191,45.493684;6.19895,45.493895;6.17318,45.477134;6.171565,45.479593&profile=hiking-mountain",,,2024-03-02-🥾🟢-Hike-Easy-loop-around-La-Table-🪑🏡🌞.html,
2024-03-09,,14.2,657,964,6,"🥾🔵 Hike: Revel 🏡 Round Tower and Mongiron Peak 🏰🗻",Hike,,299670915,https://www.meetup.com/grenoble-adventure-club-english-french/events/299670915,https://s.42l.fr/gSKPnOOY,"https://brouter.de/brouter-web/#map=14/45.1953/5.8693/OpenTopoMap&lonlats=5.867131,45.184986;5.868099,45.185478;5.870363,45.18533;5.87142,45.18727;5.85817,45.190067;5.844963,45.200334;5.866356,45.207566;5.876892,45.204636;5.87923,45.202723;5.867064,45.20007;5.878909,45.197084;5.885485,45.196831;5.889026,45.190366;5.886075,45.189628;5.882288,45.184842;5.876462,45.183001;5.871313,45.18364;5.86785,45.184642;5.867254,45.184839&profile=hiking-mountain",,,2024-03-09-🥾🔵-Hike-Revel-🏡-Round-Tower-and-Mongiron-Peak-🏰🗻.html,
2024-03-16,,10.9,1000,2214,9,"🥾🔴 Hike: Le Piquet de Nantes 2214m with snow on top? ⛄❄",Hike,,299814361,https://www.meetup.com/grenoble-adventure-club-english-french/events/299814361,https://s.42l.fr/5syFvTUI,"https://brouter.de/brouter-web/#map=14/44.9470/5.8442/OpenTopoMap&lonlats=5.847693,44.929576;5.846572,44.929929;5.845145,44.948543;5.847253,44.952514;5.844984,44.957238;5.844061,44.961731;5.840306,44.953395;5.840435,44.941655;5.847731,44.929604&profile=hiking-mountain",,,2024-03-16-🥾🔴-Hike-Le-Piquet-de-Nantes-2214m-with-snow-on-top?-⛄❄.html,
2024-03-23,,6.5,680,710,5,"Hike: back to the basics (Bastille, Mont Jalla, Mont Rachais) + games + fun",Hike,,299950014,https://www.meetup.com/grenoble-adventure-club-english-french/events/299950014,https://shorturl.at/mopsw,"https://graphhopper.com/maps/?point=45.193552,5.720191&point=45.198726,5.724526&point=45.200741,5.724916&point=45.201272,5.724536&point=45.203855,5.724226&point=45.208292,5.727072&point=45.20571,5.7281&point=45.199957,5.725168&point=45.197917,5.727329&point=45.197923,5.728089&point=45.197421,5.728368&point=45.196905,5.728486&point=45.197497,5.730549&point=45.197875,5.731272&profile=hike&layer=Omniscale",,,"2024-03-23-Hike-back-to-the-basics-(Bastille,-Mont-Jalla,-Mont-Rachais)-+-games-+-fun.html",
2024-03-24,,10.6,812,1966,11,"🥾🔵 Hike: Pic St-Michel 🌄 from Pré du Four 🌳🚙",Hike,,299951751,https://www.meetup.com/grenoble-adventure-club-english-french/events/299951751,https://s.42l.fr/jxQybEbw,"https://brouter.de/brouter-web/#map=15/45.0856/5.6270/OpenTopoMap&lonlats=5.642381,45.088703;5.630879,45.087918;5.614657,45.078974;5.619419,45.090492;5.63015,45.082609;5.645943,45.087793;5.643153,45.088664&profile=hiking-mountain",,,2024-03-24-🥾🔵-Hike-Pic-St-Michel-🌄-from-Pré-du-Four-🌳🚙.html,
2024-03-23,,6.5,680,710,5,"Hike: back to the basics (Bastille, Mont Jalla, Mont Rachais) + games + fun",Hike,,299950014,https://www.meetup.com/grenoble-adventure-club-english-french/events/299950014,https://shorturl.at/mopsw,"https://graphhopper.com/maps/?point=45.193552,5.720191&point=45.198726,5.724526&point=45.200741,5.724916&point=45.201272,5.724536&point=45.203855,5.724226&point=45.208292,5.727072&point=45.20571,5.7281&point=45.199957,5.725168&point=45.197917,5.727329&point=45.197923,5.728089&point=45.197421,5.728368&point=45.196905,5.728486&point=45.197497,5.730549&point=45.197875,5.731272&profile=hike&layer=Omniscale",,,"2024-03-23-Hike-back-to-the-basics-Bastille,-Mont-Jalla,-Mont-Rachais-games-fun.html",
2024-03-24,,10.6,812,1966,11,"🥾🔵 Hike: Pic St-Michel 🌄 from Pré du Four 🌳🚙",Hike,,299951751,https://www.meetup.com/grenoble-adventure-club-english-french/events/299951751,https://s.42l.fr/jxQybEbw,"https://brouter.de/brouter-web/#map=15/45.0856/5.6270/OpenTopoMap&lonlats=5.642381,45.088703;5.630879,45.087918;5.614657,45.078974;5.619419,45.090492;5.63015,45.082609;5.645943,45.087793;5.643153,45.088664&profile=hiking-mountain",,,2024-03-24-🥾🔵-Hike-Pic-St-Michel-🌄-from-Pre-du-Four-🌳🚙.html,
2024-03-30,,15.2,550,811,6,"🥾🟢 Hike: Montmayeur towers rainy rendez-vous 🏰🌧️",Hike,,300079128,https://www.meetup.com/grenoble-adventure-club-english-french/events/300079128,https://s.42l.fr/qJorejLn,"https://brouter.de/brouter-web/#map=13/45.4730/6.1007/OpenTopoMap&lonlats=6.075447,45.458052;6.096567,45.478918;6.096707,45.479445;6.131723,45.498763;6.123106,45.489357;6.073203,45.4524;6.075245,45.457965&profile=hiking-mountain",,,2024-03-30-🥾🟢-Hike-Montmayeur-towers-rainy-rendez-vous-🏰🌧️.html,
2024-03-31,,15.1,1215,1845,13,"🥾🔴 Hike: Rochers 'de Lorzier 1838m' ⛰️ and 'de Chalves' 1845m 🌄",Hike,,300101111,https://www.meetup.com/grenoble-adventure-club-english-french/events/300101111,https://s.42l.fr/F1inOPMf,"https://brouter.de/brouter-web/#map=13/45.2962/5.6947/OpenTopoMap&lonlats=5.679134,45.273395;5.685176,45.283858;5.681365,45.286135;5.694524,45.299639;5.701737,45.315225;5.696146,45.313348;5.698068,45.298217;5.684704,45.282886;5.67905,45.27339&profile=hiking-mountain",,,2024-03-31-🥾🔴-Hike-Rochers-'de-Lorzier-1838m'-⛰️-and-'de-Chalves'-1845m-🌄.html,
2024-03-31,,15.1,1215,1845,13,"🥾🔴 Hike: Rochers 'de Lorzier 1838m' ⛰️ and 'de Chalves' 1845m 🌄",Hike,,300101111,https://www.meetup.com/grenoble-adventure-club-english-french/events/300101111,https://s.42l.fr/F1inOPMf,"https://brouter.de/brouter-web/#map=13/45.2962/5.6947/OpenTopoMap&lonlats=5.679134,45.273395;5.685176,45.283858;5.681365,45.286135;5.694524,45.299639;5.701737,45.315225;5.696146,45.313348;5.698068,45.298217;5.684704,45.282886;5.67905,45.27339&profile=hiking-mountain",,,2024-03-31-🥾🔴-Hike-Rochers-de-Lorzier-1838m-⛰️-and-de-Chalves-1845m-🌄.html,
Binary file modified Stats/9igf-gac.ods
Binary file not shown.
17 changes: 15 additions & 2 deletions Stats/merge_gpx.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import gpxpy
from gpxpy.gpx import GPX
import re

def merge_gpx_files(directory, output_file):
gpx_files = [f for f in os.listdir(directory) if f.endswith('.gpx')]
Expand All @@ -10,12 +11,24 @@ def merge_gpx_files(directory, output_file):
with open(os.path.join(directory, gpx_file), 'r') as f:
gpx_data = gpxpy.parse(f)
for track in gpx_data.tracks:
for segment in track.segments:
# Keep only even-indexed points (0-based index)
segment.points = [point for i, point in enumerate(segment.points) if i % 2 == 0]
for point in segment.points:
point.elevation = None # This removes the <ele> tag
point.time = None # This removes the <time> tag
gpx.tracks.append(track)

# Generate the XML without pretty printing
xml_str = gpx.to_xml(prettyprint=False)

# Use regex to replace empty trkpt tags with self-closing ones
xml_str = re.sub(r'<trkpt lat="([0-9.-]+)" lon="([0-9.-]+)">\s*</trkpt>', r'<trkpt lat="\1" lon="\2"/>', xml_str)

with open(output_file, 'w') as f:
f.write(gpx.to_xml())
f.write(xml_str)

print(f'Merged {len(gpx_files)} gpx in file: {output_file}')
print(f'Merged {len(gpx_files)} gpx files into: {output_file}')

# Usage
merge_gpx_files('gpx', 'merged.gpx')
Loading

0 comments on commit 5742eb8

Please sign in to comment.