Instantly share code, notes, and snippets.
Created
June 7, 2025 11:47
-
Star
0
(0)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save zbycz/05895772588052c8743ce6f32da7c1c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs' | |
// [out:json][timeout:25]; | |
// nwr["climbing"="route_bottom"]; | |
// out geom; | |
const filename = '/Users/pavel/Library/Application Support/JetBrains/WebStorm2024.3/scratches/scratch_84.json' | |
const content = fs.readFileSync(filename, 'utf8'); | |
const json = JSON.parse(content); | |
const tagsCount = {} // tag -> count | |
json.elements.forEach(element => { | |
Object.keys(element.tags).forEach(key => { | |
tagsCount[key] = (tagsCount[key] || 0) + 1; | |
}) | |
}) | |
// sort by count DESC | |
const sortedTags = Object.entries(tagsCount).sort((a, b) => b[1] - a[1]) | |
console.table(Object.fromEntries(sortedTags)) | |
/** | |
┌───────────────────────────────────────┬────────┐ | |
│ (index) │ Values │ | |
├───────────────────────────────────────┼────────┤ | |
│ climbing │ 15582 │ | |
│ name │ 15069 │ | |
│ sport │ 14537 │ | |
│ climbing:grade:uiaa │ 12631 │ | |
│ website │ 8866 │ | |
│ author │ 2332 │ | |
│ climbing:length │ 2323 │ | |
│ wikimedia_commons │ 1662 │ | |
│ climbing:sport │ 1661 │ | |
│ wikimedia_commons:path │ 1453 │ | |
│ climbing:trad │ 1007 │ | |
│ climbing:grade:french │ 911 │ | |
│ climbing:grade:saxon │ 757 │ | |
│ wikimedia_commons:2 │ 752 │ | |
│ climbing:bolts │ 723 │ | |
│ wikimedia_commons:2:path │ 722 │ | |
│ ele │ 548 │ | |
│ type │ 288 │ | |
│ description │ 284 │ | |
│ site │ 266 │ | |
│ climbing:bolted │ 262 │ | |
│ climbing:pitches │ 261 │ | |
│ climbing:multipitch │ 215 │ | |
│ climbing:boulder │ 206 │ | |
│ climbing:style │ 200 │ | |
│ climbing:restriction │ 183 │ | |
│ length │ 167 │ | |
│ climbing:toprope │ 166 │ | |
│ climbing:grade:yds_class │ 145 │ | |
│ leisure │ 118 │ | |
│ climbing:rock │ 99 │ | |
│ natural │ 96 │ | |
│ url │ 72 │ | |
│ source │ 63 │ | |
│ wikimedia_commons:3 │ 59 │ | |
│ wikimedia_commons:3:path │ 57 │ | |
│ climbing:grade:uiaa:max │ 50 │ | |
│ climbing:grade:uiaa:min │ 46 │ | |
│ fixme │ 34 │ | |
│ climbing:orientation │ 31 │ | |
│ climbing:restriction:time_description │ 28 │ | |
│ climbing:grade:french:max │ 22 │ | |
│ climbing:grade:french:min │ 22 │ | |
│ site_name │ 22 │ | |
│ climbing:ice │ 20 │ | |
│ outdoor │ 16 │ | |
│ climbing:mixed │ 16 │ | |
│ climbing:url:thecrag │ 15 │ | |
│ climbing:grade:hueco │ 15 │ | |
│ climbing:grade:saxon:mean │ 14 │ | |
│ climbing:traditional │ 13 │ | |
│ climbing:url:openbeta │ 12 │ | |
│ climbing:deepwater │ 9 │ | |
│ fee │ 9 │ | |
│ climbing:grade:saxon:min │ 8 │ | |
│ note │ 8 │ | |
│ climbing:grade:uiaa:mean │ 8 │ | |
│ climbing:url:mountainproject │ 6 │ | |
│ access │ 6 │ | |
│ review:website │ 6 │ | |
│ climbing:grade:saxon:max │ 5 │ | |
│ climbing:topo │ 4 │ | |
│ climbing:summit_log │ 3 │ | |
│ alt_name │ 3 │ | |
│ climbing:grade:fb │ 3 │ | |
│ tourism │ 3 │ | |
│ wikimedia_commons:4 │ 3 │ | |
│ wikimedia_commons:4:path │ 3 │ | |
│ bicycle │ 2 │ | |
│ foot │ 2 │ | |
│ name:ca │ 2 │ | |
│ climbing:area │ 2 │ | |
│ climbing:grade:fontainebleau │ 2 │ | |
│ climbing:length:max │ 2 │ | |
│ climbing:route_bottom │ 2 │ | |
│ surface │ 2 │ | |
│ height │ 2 │ | |
│ description:en │ 2 │ | |
│ climbing:grade:french:mean │ 2 │ | |
│ panoramax │ 2 │ | |
│ panoramax:0 │ 2 │ | |
│ description:cs │ 2 │ | |
│ name:cs │ 1 │ | |
│ opening_hours │ 1 │ | |
│ mountain_pass │ 1 │ | |
│ wikidata │ 1 │ | |
│ ref:camptocamp │ 1 │ | |
│ place │ 1 │ | |
│ board_type │ 1 │ | |
│ information │ 1 │ | |
│ description:de │ 1 │ | |
│ rungs │ 1 │ | |
│ sac_scale │ 1 │ | |
│ name:en │ 1 │ | |
│ backcountry │ 1 │ | |
│ climbing:url:8a │ 1 │ | |
│ direction │ 1 │ | |
│ notes │ 1 │ | |
│ undefined │ 1 │ | |
│ climbing:quality │ 1 │ | |
│ comment │ 1 │ | |
└───────────────────────────────────────┴────────┘ | |
* */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment