Eight-thousanders
R-bloggers 2025-11-01
[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Day 1 of 30DayMapChallenge: « Points ».
Mapping the peaks above 8000 m, also known as the eight-thousanders.
Config
library(httr)library(glue)library(dplyr)library(tidyr)library(purrr)library(tibble)library(stringr)library(sf)library(leaflet)
Data
Several non-trivial options for obtaining the data:
- english Wikipedia doesn’t have the geographic coordinates to scrape (although other language Wikipedias do);
- I can’t get a working SPARQL query on Wikidata (lack of knowledge from me) even with the help of SPINACH Wikidata Agent;
- there is no easy OpenStreetMap relation to import;
- so finally I resorted to make a direct Overpass API call, although {osmdata} should have also worked.
Using a Himalaya and Karakoram bounding box, we keep the summits above 8000 m having a prominence > 500 m (major peaks, otherwise we would get several secondary summits).
It should take about 1 minute…
overpass_query <- URLencode(r"([out:json][timeout:250];node ["natural"="peak"] (25,70,38,98) ["ele"] ["prominence"] (if:number(t["prominence"]) > 500 && number(t["ele"]) > 8000);out body;)", reserved = TRUE) summits <- GET(glue("https://overpass-api.de/api/interpreter?data={overpass_query}"))summits_sf <- content(summits) |> pluck("elements") |> map(unlist) |> map(enframe) |> map(pivot_wider) |> list_rbind() |> rename_with(\(x) str_replace(x, "^tags\\.", "")) |> st_as_sf(coords = c("lon", "lat"), crs = "EPSG:4326")Table 1: The eight-thousanders
Simple feature collection with 14 features and 2 fieldsGeometry type: POINTDimension: XYBounding box: xmin: 74.58954 ymin: 27.70301 xmax: 88.14748 ymax: 35.88168Geodetic CRS: WGS 84# A tibble: 14 × 3 name elevation geometry <chr> <chr> <POINT [°]> 1 Mount Everest 8848.86 (86.92521 27.98806) 2 K2 8611 (76.51333 35.88168) 3 Kangchenjunga 8586 (88.14748 27.70301) 4 Lhotse 8516 (86.9325 27.96199) 5 Mount Makalu 8485 (87.08844 27.89144) 6 Cho Oyu 8201 (86.65963 28.09675) 7 Dhaulagiri 8167 (83.48949 28.69761) 8 Manaslu 8163 (84.55973 28.54998) 9 Nanga Parbat 8126 (74.58954 35.23846)10 Annapurna I 8091 (83.81992 28.59581)11 Gasherbrum I 8080 (76.69762 35.72468)12 Broad Peak 8051 (76.56556 35.81369)13 Gasherbrum II 8034 (76.65327 35.75773)14 Shishapangma 8027 (85.78207 28.35176)
Map
summits_sf |> leaflet() |> addTiles(attribution = r"( <a href="https://r.iresmi.net/">r.iresmi.net</a>. data and map: <a href="https://www.openstreetmap.org/copyright/">OpenStreetMap</a>)") |> addCircleMarkers(popup = ~ glue("<b>{name}</b> ({`name:en`})<br /> {ele} m"), clusterOptions = markerClusterOptions())
{"x":{"options":{"crs":{"crsClass":"L.CRS.EPSG3857","code":null,"proj4def":null,"projectedBounds":null,"options":{}}},"calls":[{"method":"addTiles","args":["https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",null,null,{"minZoom":0,"maxZoom":18,"tileSize":256,"subdomains":"abc","errorTileUrl":"","tms":false,"noWrap":false,"zoomOffset":0,"zoomReverse":false,"opacity":1,"zIndex":1,"detectRetina":false,"attribution":"\n <a href=https://r.iresmi.net/posts/2025/eight-thousander/ rel="nofollow" target="_blank">r.iresmi.net<\/a>.\n data and map: <a href=https://r.iresmi.net/posts/2025/eight-thousander/ rel="nofollow" target="_blank">OpenStreetMap<\/a>"}]},{"method":"addCircleMarkers","args":[[27.9880614,35.8816822,35.7246797,28.3517601,28.0967465,28.5958063,35.2384621,27.9619855,28.6976088,27.8914385,28.5499829,35.8136914,35.7577323,27.7030109],[86.92521000000001,76.51333080000001,76.69762299999999,85.78206969999999,86.659634,83.8199199,74.5895446,86.93250449999999,83.4894884,87.0884403,84.5597284,76.5655569,76.6532687,88.14747749999999],10,null,null,{"interactive":true,"className":"","stroke":true,"color":"#03F","weight":5,"opacity":0.5,"fill":true,"fillColor":"#03F","fillOpacity":0.2},{"showCoverageOnHover":true,"zoomToBoundsOnClick":true,"spiderfyOnMaxZoom":true,"removeOutsideVisibleBounds":true,"spiderLegPolylineOptions":{"weight":1.5,"color":"#222","opacity":0.5},"freezeAtZoom":false},null,["<b>珠穆朗玛峰 ཇོ་མོ་གླང་མ། सगरमाथा<\/b> (Mount Everest)<br />\n8848.86 m","<b>乔戈里峰 کے ٹو<\/b> (K2)<br />\n8611 m","<b>加舒尔布鲁木第一峰 گاشر برم اول<\/b> (Gasherbrum I)<br />\n8080 m","<b>ཤིས་ས་སྤང་མ། 希夏邦马峰<\/b> (Shishapangma)<br />\n8027 m","<b>चोयु ཇོ་བོ་དབུ་ཡ 卓奥友峰<\/b> (Cho Oyu)<br />\n8201 m","<b>अन्नपूर्ण<\/b> (Annapurna I)<br />\n8091 m","<b>نانگا پربت<\/b> (Nanga Parbat)<br />\n8126 m","<b>洛子峰 ལྷོ་རྩེ ल्होत्से<\/b> (Lhotse)<br />\n8516 m","<b>Dhaulagiri<\/b> (Dhaulagiri)<br />\n8167 m","<b>मकालु 马卡鲁峰<\/b> (Mount Makalu)<br />\n8485 m","<b>मनास्लु<\/b> (Manaslu)<br />\n8163 m","<b>布洛阿特峰 بروڈ پیک<\/b> (Broad Peak)<br />\n8051 m","<b>加舒尔布鲁木第二峰 گاشر برم دوم<\/b> (Gasherbrum II)<br />\n8034 m","<b>Kangchenjunga<\/b> (Kangchenjunga)<br />\n8586 m"],null,null,{"interactive":false,"permanent":false,"direction":"auto","opacity":1,"offset":[0,0],"textsize":"10px","textOnly":false,"className":"","sticky":true},null]}],"limits":{"lat":[27.7030109,35.8816822],"lng":[74.5895446,88.14747749999999]}},"evals":[],"jsHooks":[]}
Figure 1: The eight-thousandersTo leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
