712 lines
446 KiB
HTML
712 lines
446 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="da" xml:lang="da"><head>
|
||
|
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="generator" content="quarto-1.3.361">
|
||
|
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
|
||
|
|
||
|
<meta name="author" content="Andreas">
|
||
|
<meta name="description" content="Lidt om vores campertur.">
|
||
|
|
||
|
<title>Familien G Damsbo - Canada i camper</title>
|
||
|
<style>
|
||
|
code{white-space: pre-wrap;}
|
||
|
span.smallcaps{font-variant: small-caps;}
|
||
|
div.columns{display: flex; gap: min(4vw, 1.5em);}
|
||
|
div.column{flex: auto; overflow-x: auto;}
|
||
|
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||
|
ul.task-list{list-style: none;}
|
||
|
ul.task-list li input[type="checkbox"] {
|
||
|
width: 0.8em;
|
||
|
margin: 0 0.8em 0.2em -1em; /* quarto-specific, see https://github.com/quarto-dev/quarto-cli/issues/4556 */
|
||
|
vertical-align: middle;
|
||
|
}
|
||
|
/* CSS for syntax highlighting */
|
||
|
pre > code.sourceCode { white-space: pre; position: relative; }
|
||
|
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
||
|
pre > code.sourceCode > span:empty { height: 1.2em; }
|
||
|
.sourceCode { overflow: visible; }
|
||
|
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
||
|
div.sourceCode { margin: 1em 0; }
|
||
|
pre.sourceCode { margin: 0; }
|
||
|
@media screen {
|
||
|
div.sourceCode { overflow: auto; }
|
||
|
}
|
||
|
@media print {
|
||
|
pre > code.sourceCode { white-space: pre-wrap; }
|
||
|
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
|
||
|
}
|
||
|
pre.numberSource code
|
||
|
{ counter-reset: source-line 0; }
|
||
|
pre.numberSource code > span
|
||
|
{ position: relative; left: -4em; counter-increment: source-line; }
|
||
|
pre.numberSource code > span > a:first-child::before
|
||
|
{ content: counter(source-line);
|
||
|
position: relative; left: -1em; text-align: right; vertical-align: baseline;
|
||
|
border: none; display: inline-block;
|
||
|
-webkit-touch-callout: none; -webkit-user-select: none;
|
||
|
-khtml-user-select: none; -moz-user-select: none;
|
||
|
-ms-user-select: none; user-select: none;
|
||
|
padding: 0 4px; width: 4em;
|
||
|
}
|
||
|
pre.numberSource { margin-left: 3em; padding-left: 4px; }
|
||
|
div.sourceCode
|
||
|
{ }
|
||
|
@media screen {
|
||
|
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
|
||
|
<script src="../site_libs/quarto-nav/quarto-nav.js"></script>
|
||
|
<script src="../site_libs/quarto-nav/headroom.min.js"></script>
|
||
|
<script src="../site_libs/clipboard/clipboard.min.js"></script>
|
||
|
<script src="../site_libs/quarto-search/autocomplete.umd.js"></script>
|
||
|
<script src="../site_libs/quarto-search/fuse.min.js"></script>
|
||
|
<script src="../site_libs/quarto-search/quarto-search.js"></script>
|
||
|
<meta name="quarto:offset" content="../">
|
||
|
<script src="../site_libs/quarto-html/quarto.js"></script>
|
||
|
<script src="../site_libs/quarto-html/popper.min.js"></script>
|
||
|
<script src="../site_libs/quarto-html/tippy.umd.min.js"></script>
|
||
|
<script src="../site_libs/quarto-html/anchor.min.js"></script>
|
||
|
<link href="../site_libs/quarto-html/tippy.css" rel="stylesheet">
|
||
|
<link href="../site_libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-text-highlighting-styles">
|
||
|
<link href="../site_libs/quarto-html/quarto-syntax-highlighting-dark.css" rel="stylesheet" class="quarto-color-scheme quarto-color-alternate" id="quarto-text-highlighting-styles">
|
||
|
<script src="../site_libs/bootstrap/bootstrap.min.js"></script>
|
||
|
<link href="../site_libs/bootstrap/bootstrap-icons.css" rel="stylesheet">
|
||
|
<link href="../site_libs/bootstrap/bootstrap.min.css" rel="stylesheet" class="quarto-color-scheme" id="quarto-bootstrap" data-mode="light">
|
||
|
<link href="../site_libs/bootstrap/bootstrap-dark.min.css" rel="stylesheet" class="quarto-color-scheme quarto-color-alternate" id="quarto-bootstrap" data-mode="dark">
|
||
|
<script id="quarto-search-options" type="application/json">{
|
||
|
"location": "navbar",
|
||
|
"copy-button": false,
|
||
|
"collapse-after": 3,
|
||
|
"panel-placement": "end",
|
||
|
"type": "overlay",
|
||
|
"limit": 20,
|
||
|
"language": {
|
||
|
"search-no-results-text": "Ingen resultater",
|
||
|
"search-matching-documents-text": "Matchende dokumenter",
|
||
|
"search-copy-link-title": "Kopier link for at søge",
|
||
|
"search-hide-matches-text": "Skjul yderligere resultater",
|
||
|
"search-more-match-text": "andet resultat i dette dokument",
|
||
|
"search-more-matches-text": "andre resultater i dette dokument",
|
||
|
"search-clear-button-title": "Ryd",
|
||
|
"search-detached-cancel-button-title": "Fortryd",
|
||
|
"search-submit-button-title": "Indsend",
|
||
|
"search-label": "Søg"
|
||
|
}
|
||
|
}</script>
|
||
|
<script async="" src="https://stats.nikohuru.dk/script.js" data-website-id="a4d92881-2a72-4d85-ac3c-6864e87b9881"></script>
|
||
|
<script src="../site_libs/htmlwidgets-1.6.2/htmlwidgets.js"></script>
|
||
|
<script src="../site_libs/jquery-1.12.4/jquery.min.js"></script>
|
||
|
<link href="../site_libs/leaflet-1.3.1/leaflet.css" rel="stylesheet">
|
||
|
<script src="../site_libs/leaflet-1.3.1/leaflet.js"></script>
|
||
|
<link href="../site_libs/leafletfix-1.0.0/leafletfix.css" rel="stylesheet">
|
||
|
<script src="../site_libs/proj4-2.6.2/proj4.min.js"></script>
|
||
|
<script src="../site_libs/Proj4Leaflet-1.0.1/proj4leaflet.js"></script>
|
||
|
<link href="../site_libs/rstudio_leaflet-1.3.1/rstudio_leaflet.css" rel="stylesheet">
|
||
|
<script src="../site_libs/leaflet-binding-2.1.2/leaflet.js"></script>
|
||
|
<script src="../site_libs/leaflet-providers-1.9.0/leaflet-providers_1.9.0.js"></script>
|
||
|
<script src="../site_libs/leaflet-providers-plugin-2.1.2/leaflet-providers-plugin.js"></script>
|
||
|
|
||
|
|
||
|
<link rel="stylesheet" href="../styles.css">
|
||
|
</head>
|
||
|
|
||
|
<body class="nav-fixed">
|
||
|
|
||
|
<div id="quarto-search-results"></div>
|
||
|
<header id="quarto-header" class="headroom fixed-top">
|
||
|
<nav class="navbar navbar-expand-lg navbar-dark ">
|
||
|
<div class="navbar-container container-fluid">
|
||
|
<div class="navbar-brand-container">
|
||
|
<a class="navbar-brand" href="../index.html">
|
||
|
<span class="navbar-title">Familien G Damsbo</span>
|
||
|
</a>
|
||
|
</div>
|
||
|
<div id="quarto-search" class="" title="Søg"></div>
|
||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Skift navigation" onclick="if (window.quartoToggleHeadroom) { window.quartoToggleHeadroom(); }">
|
||
|
<span class="navbar-toggler-icon"></span>
|
||
|
</button>
|
||
|
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||
|
<ul class="navbar-nav navbar-nav-scroll me-auto">
|
||
|
<li class="nav-item">
|
||
|
<a class="nav-link" href="../index.html" rel="" target="">
|
||
|
<span class="menu-text">Start</span></a>
|
||
|
</li>
|
||
|
<li class="nav-item">
|
||
|
<a class="nav-link" href="../food.html" rel="" target="">
|
||
|
<span class="menu-text">Opskrifter</span></a>
|
||
|
</li>
|
||
|
<li class="nav-item">
|
||
|
<a class="nav-link" href="../blog.html" rel="" target="">
|
||
|
<span class="menu-text">Blog</span></a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<ul class="navbar-nav navbar-nav-scroll ms-auto">
|
||
|
<li class="nav-item">
|
||
|
<a class="nav-link" href="https://github.com/agdamsbo/familien.gdamsbo" rel="" target="">
|
||
|
<span class="menu-text">Kildekode</span></a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
<div class="quarto-navbar-tools">
|
||
|
<a href="" class="quarto-color-scheme-toggle quarto-navigation-tool px-1" onclick="window.quartoToggleColorScheme(); return false;" title="Skift mørk tilstand"><i class="bi"></i></a>
|
||
|
</div>
|
||
|
</div> <!-- /navcollapse -->
|
||
|
</div> <!-- /container-fluid -->
|
||
|
</nav>
|
||
|
</header>
|
||
|
<!-- content -->
|
||
|
<div id="quarto-content" class="quarto-container page-columns page-rows-contents page-layout-article page-navbar">
|
||
|
<!-- sidebar -->
|
||
|
<!-- margin-sidebar -->
|
||
|
<div id="quarto-margin-sidebar" class="sidebar margin-sidebar">
|
||
|
<nav id="TOC" role="doc-toc" class="toc-active">
|
||
|
<h2 id="toc-title">På denne side</h2>
|
||
|
|
||
|
<ul>
|
||
|
<li><a href="#kode" id="toc-kode" class="nav-link active" data-scroll-target="#kode">Kode</a></li>
|
||
|
<li><a href="#forklaring" id="toc-forklaring" class="nav-link" data-scroll-target="#forklaring">Forklaring</a>
|
||
|
<ul class="collapse">
|
||
|
<li><a href="#kommentarer" id="toc-kommentarer" class="nav-link" data-scroll-target="#kommentarer">Kommentarer</a></li>
|
||
|
</ul></li>
|
||
|
</ul>
|
||
|
</nav>
|
||
|
</div>
|
||
|
<!-- main -->
|
||
|
<main class="content" id="quarto-document-content">
|
||
|
|
||
|
<header id="title-block-header" class="quarto-title-block default">
|
||
|
<div class="quarto-title">
|
||
|
<h1 class="title">Canada i camper</h1>
|
||
|
<div class="quarto-categories">
|
||
|
<div class="quarto-category">Canada</div>
|
||
|
<div class="quarto-category">Rejse</div>
|
||
|
<div class="quarto-category">Børn</div>
|
||
|
<div class="quarto-category">R</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div>
|
||
|
<div class="description">
|
||
|
Lidt om vores campertur.
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="quarto-title-meta">
|
||
|
|
||
|
<div>
|
||
|
<div class="quarto-title-meta-heading">Forfatter</div>
|
||
|
<div class="quarto-title-meta-contents">
|
||
|
<p>Andreas </p>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div>
|
||
|
<div class="quarto-title-meta-heading">Udgivet</div>
|
||
|
<div class="quarto-title-meta-contents">
|
||
|
<p class="date">28. juni 2023</p>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
</header>
|
||
|
|
||
|
<section id="kode" class="level1">
|
||
|
<h1>Kode</h1>
|
||
|
<div class="cell">
|
||
|
<details>
|
||
|
<summary>Kode til oversigtskort</summary>
|
||
|
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co"># Original export from plotting in OsmAnd on phone</span></span>
|
||
|
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="co"># bookmarks <- gpx::read_gpx(file = "data/favorites_canada_2023.gpx")</span></span>
|
||
|
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="co"># Udtræk til .csv, herefter manuelt tilpasset, sorteret og tilføjet yderligere data.</span></span>
|
||
|
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="co"># write.csv(bookmarks$waypoints,"data/camper_points.csv")</span></span>
|
||
|
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(dplyr)</span>
|
||
|
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a>camper <span class="ot"><-</span> <span class="fu">read.csv</span>(<span class="st">"data/camper_points.csv"</span>,)[<span class="sc">-</span><span class="dv">1</span>] <span class="sc">|></span> <span class="fu">arrange</span>(Order)</span>
|
||
|
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a><span class="co"># Alternative source from RVParky export</span></span>
|
||
|
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a><span class="co"># RVParky er fed, men fornyligt er det blevet en betalingstjeneste. Hvorfor er den ikke integreret i OSM?</span></span>
|
||
|
<span id="cb1-13"><a href="#cb1-13" aria-hidden="true" tabindex="-1"></a><span class="co"># vnc <- gpx::read_gpx(file = "data/vancouver-trip.gpx")</span></span>
|
||
|
<span id="cb1-14"><a href="#cb1-14" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-15"><a href="#cb1-15" aria-hidden="true" tabindex="-1"></a><span class="do">## Iconer</span></span>
|
||
|
<span id="cb1-16"><a href="#cb1-16" aria-hidden="true" tabindex="-1"></a>matching <span class="ot"><-</span> <span class="fu">c</span>(<span class="at">car=</span><span class="st">"images/key.png"</span>, </span>
|
||
|
<span id="cb1-17"><a href="#cb1-17" aria-hidden="true" tabindex="-1"></a> <span class="at">bed=</span><span class="st">"images/rv.png"</span>, </span>
|
||
|
<span id="cb1-18"><a href="#cb1-18" aria-hidden="true" tabindex="-1"></a> <span class="at">house=</span><span class="st">"images/house.png"</span>)</span>
|
||
|
<span id="cb1-19"><a href="#cb1-19" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-20"><a href="#cb1-20" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(leaflet)</span>
|
||
|
<span id="cb1-21"><a href="#cb1-21" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-22"><a href="#cb1-22" aria-hidden="true" tabindex="-1"></a>icons_list <span class="ot"><-</span> <span class="fu">icons</span>(</span>
|
||
|
<span id="cb1-23"><a href="#cb1-23" aria-hidden="true" tabindex="-1"></a> <span class="at">iconUrl =</span> matching[<span class="fu">match</span>(camper<span class="sc">$</span>Icon,<span class="fu">names</span>(matching))],</span>
|
||
|
<span id="cb1-24"><a href="#cb1-24" aria-hidden="true" tabindex="-1"></a> <span class="at">iconWidth =</span> <span class="fu">c</span>(<span class="dv">40</span>),</span>
|
||
|
<span id="cb1-25"><a href="#cb1-25" aria-hidden="true" tabindex="-1"></a> <span class="at">iconHeight =</span> <span class="fu">c</span>(<span class="dv">40</span>)</span>
|
||
|
<span id="cb1-26"><a href="#cb1-26" aria-hidden="true" tabindex="-1"></a>)</span>
|
||
|
<span id="cb1-27"><a href="#cb1-27" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-28"><a href="#cb1-28" aria-hidden="true" tabindex="-1"></a><span class="do">## Så er det tid til at bruge Open Street Routing Machine</span></span>
|
||
|
<span id="cb1-29"><a href="#cb1-29" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-30"><a href="#cb1-30" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(osrm)</span>
|
||
|
<span id="cb1-31"><a href="#cb1-31" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-32"><a href="#cb1-32" aria-hidden="true" tabindex="-1"></a><span class="co"># osrmTable(loc = camper |> transmute(lon=Longitude,lat=Latitude))</span></span>
|
||
|
<span id="cb1-33"><a href="#cb1-33" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-34"><a href="#cb1-34" aria-hidden="true" tabindex="-1"></a>trips <span class="ot"><-</span> <span class="fu">osrmTrip</span>(<span class="at">loc =</span> camper <span class="sc">|></span> <span class="fu">transmute</span>(<span class="at">lon=</span>Longitude,<span class="at">lat=</span>Latitude), <span class="at">overview =</span> <span class="st">"full"</span>,</span>
|
||
|
<span id="cb1-35"><a href="#cb1-35" aria-hidden="true" tabindex="-1"></a> <span class="at">osrm.profile =</span> <span class="st">"car"</span>)</span>
|
||
|
<span id="cb1-36"><a href="#cb1-36" aria-hidden="true" tabindex="-1"></a>trip <span class="ot"><-</span> trips[[<span class="dv">1</span>]]<span class="sc">$</span>trip</span>
|
||
|
<span id="cb1-37"><a href="#cb1-37" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-38"><a href="#cb1-38" aria-hidden="true" tabindex="-1"></a><span class="co"># There exists a lua filter for truck, put I can't figure how to implement.</span></span>
|
||
|
<span id="cb1-39"><a href="#cb1-39" aria-hidden="true" tabindex="-1"></a><span class="co"># I suppose I would have to run a local OSRM instance...</span></span>
|
||
|
<span id="cb1-40"><a href="#cb1-40" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-41"><a href="#cb1-41" aria-hidden="true" tabindex="-1"></a><span class="do">## HTML labels til kortet</span></span>
|
||
|
<span id="cb1-42"><a href="#cb1-42" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-43"><a href="#cb1-43" aria-hidden="true" tabindex="-1"></a><span class="fu">invisible</span>(<span class="fu">Sys.setlocale</span>(<span class="st">"LC_TIME"</span>, <span class="st">"da_DK"</span>))</span>
|
||
|
<span id="cb1-44"><a href="#cb1-44" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-45"><a href="#cb1-45" aria-hidden="true" tabindex="-1"></a>content <span class="ot"><-</span> <span class="fu">paste0</span>(</span>
|
||
|
<span id="cb1-46"><a href="#cb1-46" aria-hidden="true" tabindex="-1"></a> <span class="fu">ifelse</span>(<span class="fu">substr</span>(camper<span class="sc">$</span>Description,<span class="dv">1</span>,<span class="dv">4</span>)<span class="sc">!=</span><span class="st">"http"</span><span class="sc">|</span><span class="fu">is.na</span>(camper<span class="sc">$</span>Description),<span class="fu">paste0</span>(<span class="st">"<br/>"</span>,camper<span class="sc">$</span>Name),<span class="fu">paste0</span>(<span class="st">"<b><a href='"</span>,camper<span class="sc">$</span>Description,<span class="st">"'>"</span>,camper<span class="sc">$</span>Name,<span class="st">"</a></b>"</span>)),</span>
|
||
|
<span id="cb1-47"><a href="#cb1-47" aria-hidden="true" tabindex="-1"></a> <span class="st">"<br/>"</span>,<span class="fu">paste</span>(<span class="st">"Ankomst:"</span>,<span class="fu">tolower</span>(<span class="fu">format</span>(<span class="fu">as.Date</span>(camper<span class="sc">$</span>Arrival),<span class="st">"%d. %B"</span>))),</span>
|
||
|
<span id="cb1-48"><a href="#cb1-48" aria-hidden="true" tabindex="-1"></a> <span class="st">"<br/>"</span>,<span class="fu">paste</span>(<span class="st">"Nætter:"</span>,camper<span class="sc">$</span>Nights),</span>
|
||
|
<span id="cb1-49"><a href="#cb1-49" aria-hidden="true" tabindex="-1"></a> <span class="st">"<br/>"</span>,<span class="fu">paste</span>(<span class="st">"Tid til næste:"</span>,<span class="fu">round</span>(trips[[<span class="dv">1</span>]]<span class="sc">$</span>trip<span class="sc">$</span>duration,<span class="dv">1</span>),<span class="st">"min"</span>),</span>
|
||
|
<span id="cb1-50"><a href="#cb1-50" aria-hidden="true" tabindex="-1"></a> <span class="st">"<br/>"</span>,<span class="fu">paste</span>(<span class="st">"Afstand til næste:"</span>,<span class="fu">round</span>(trips[[<span class="dv">1</span>]]<span class="sc">$</span>trip<span class="sc">$</span>distance,<span class="dv">1</span>),<span class="st">"km"</span>),</span>
|
||
|
<span id="cb1-51"><a href="#cb1-51" aria-hidden="true" tabindex="-1"></a> <span class="fu">ifelse</span>(camper<span class="sc">$</span>Notes<span class="sc">!=</span><span class="st">""</span>,<span class="fu">paste0</span>(<span class="st">"<br/>"</span>,<span class="fu">paste</span>(<span class="st">"Noter:"</span>,camper<span class="sc">$</span>Notes)),<span class="st">""</span>)</span>
|
||
|
<span id="cb1-52"><a href="#cb1-52" aria-hidden="true" tabindex="-1"></a>)</span>
|
||
|
<span id="cb1-53"><a href="#cb1-53" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-54"><a href="#cb1-54" aria-hidden="true" tabindex="-1"></a><span class="do">## Interaktivt kort med `leaflet`</span></span>
|
||
|
<span id="cb1-55"><a href="#cb1-55" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-56"><a href="#cb1-56" aria-hidden="true" tabindex="-1"></a>map <span class="ot"><-</span> <span class="fu">leaflet</span>(trip) <span class="sc">%>%</span></span>
|
||
|
<span id="cb1-57"><a href="#cb1-57" aria-hidden="true" tabindex="-1"></a> <span class="fu">addTiles</span>(<span class="at">group =</span> <span class="st">"OSM (standard)"</span>) <span class="sc">%>%</span></span>
|
||
|
<span id="cb1-58"><a href="#cb1-58" aria-hidden="true" tabindex="-1"></a> <span class="fu">addProviderTiles</span>(providers<span class="sc">$</span>OpenTopoMap,</span>
|
||
|
<span id="cb1-59"><a href="#cb1-59" aria-hidden="true" tabindex="-1"></a> <span class="at">group =</span> <span class="st">"Topografisk"</span>) <span class="sc">%>%</span></span>
|
||
|
<span id="cb1-60"><a href="#cb1-60" aria-hidden="true" tabindex="-1"></a> <span class="co"># addProviderTiles(providers$HERE.satelliteDay,</span></span>
|
||
|
<span id="cb1-61"><a href="#cb1-61" aria-hidden="true" tabindex="-1"></a> <span class="co"># group = "Satelit") %>%</span></span>
|
||
|
<span id="cb1-62"><a href="#cb1-62" aria-hidden="true" tabindex="-1"></a> <span class="fu">setView</span>(<span class="at">lng =</span> <span class="fu">median</span>(camper<span class="sc">$</span>Longitude), <span class="at">lat =</span> <span class="fu">median</span>(camper<span class="sc">$</span>Latitude), <span class="at">zoom =</span> <span class="dv">7</span>) <span class="sc">%>%</span></span>
|
||
|
<span id="cb1-63"><a href="#cb1-63" aria-hidden="true" tabindex="-1"></a> <span class="fu">addPolylines</span>(<span class="at">group =</span> <span class="st">"Estimated route"</span>) <span class="sc">%>%</span></span>
|
||
|
<span id="cb1-64"><a href="#cb1-64" aria-hidden="true" tabindex="-1"></a> <span class="fu">addMarkers</span>(<span class="at">data =</span> camper[<span class="sc">-</span><span class="fu">nrow</span>(camper),],</span>
|
||
|
<span id="cb1-65"><a href="#cb1-65" aria-hidden="true" tabindex="-1"></a> <span class="at">icon =</span> icons_list,</span>
|
||
|
<span id="cb1-66"><a href="#cb1-66" aria-hidden="true" tabindex="-1"></a> <span class="at">popup =</span> content[<span class="sc">-</span><span class="fu">nrow</span>(camper)], </span>
|
||
|
<span id="cb1-67"><a href="#cb1-67" aria-hidden="true" tabindex="-1"></a> <span class="at">label =</span> <span class="sc">~</span>Name, </span>
|
||
|
<span id="cb1-68"><a href="#cb1-68" aria-hidden="true" tabindex="-1"></a> <span class="at">group =</span> <span class="st">"Points"</span>) <span class="sc">|></span> </span>
|
||
|
<span id="cb1-69"><a href="#cb1-69" aria-hidden="true" tabindex="-1"></a> <span class="fu">addLayersControl</span>(</span>
|
||
|
<span id="cb1-70"><a href="#cb1-70" aria-hidden="true" tabindex="-1"></a> <span class="at">baseGroups =</span> <span class="fu">c</span>(<span class="st">"OSM (standard)"</span>, <span class="st">"Topografisk"</span>),</span>
|
||
|
<span id="cb1-71"><a href="#cb1-71" aria-hidden="true" tabindex="-1"></a> <span class="at">overlayGroups =</span> <span class="fu">c</span>(<span class="st">"Estimated route"</span>, <span class="st">"Points"</span>),</span>
|
||
|
<span id="cb1-72"><a href="#cb1-72" aria-hidden="true" tabindex="-1"></a> <span class="at">options =</span> <span class="fu">layersControlOptions</span>(<span class="at">collapsed =</span> <span class="cn">FALSE</span>)</span>
|
||
|
<span id="cb1-73"><a href="#cb1-73" aria-hidden="true" tabindex="-1"></a> )</span>
|
||
|
<span id="cb1-74"><a href="#cb1-74" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-75"><a href="#cb1-75" aria-hidden="true" tabindex="-1"></a><span class="co"># Hjælp til lige at komme det sidste stykke med at tegne ruten på:</span></span>
|
||
|
<span id="cb1-76"><a href="#cb1-76" aria-hidden="true" tabindex="-1"></a><span class="co"># https://stackoverflow.com/a/60940696/21019325</span></span>
|
||
|
<span id="cb1-77"><a href="#cb1-77" aria-hidden="true" tabindex="-1"></a></span>
|
||
|
<span id="cb1-78"><a href="#cb1-78" aria-hidden="true" tabindex="-1"></a><span class="co"># Vejledning til at opsætte en lokal server med mulighed for modificeret profil.</span></span>
|
||
|
<span id="cb1-79"><a href="#cb1-79" aria-hidden="true" tabindex="-1"></a><span class="co"># https://www.r-bloggers.com/2017/09/building-a-local-osrm-instance/</span></span>
|
||
|
<span id="cb1-80"><a href="#cb1-80" aria-hidden="true" tabindex="-1"></a><span class="co"># Download specifikke områder: http://download.geofabrik.de/</span></span>
|
||
|
<span id="cb1-81"><a href="#cb1-81" aria-hidden="true" tabindex="-1"></a><span class="co"># </span></span>
|
||
|
<span id="cb1-82"><a href="#cb1-82" aria-hidden="true" tabindex="-1"></a><span class="co"># Lastbil profil (den minder vel mere om en camper?): https://github.com/Project-OSRM/osrm-profiles-contrib/blob/master/5/27/truck-soft/car.lua</span></span></code><button title="Kopier til udklipsholder" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||
|
</details>
|
||
|
</div>
|
||
|
<p>Her er ikke tale om en overspringshandling.</p>
|
||
|
</section>
|
||
|
<section id="forklaring" class="level1">
|
||
|
<h1>Forklaring</h1>
|
||
|
<p>Lige om lidt tager vi til Canada i tre måneder som led i min PhD-uddannelse.</p>
|
||
|
<p>Først holder vi lidt ferie. På dag 2 kører vi afsted i en lejet camper og har 14 dage i den, hvor vi skal udforske den sydvestlige del af British Colombia.</p>
|
||
|
<p>Vores rute er tegnet in på kortet herunder.</p>
|
||
|
<div class="cell">
|
||
|
<details>
|
||
|
<summary>Print kort</summary>
|
||
|
<div class="sourceCode cell-code" id="cb2"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>map</span></code><button title="Kopier til udklipsholder" class="code-copy-button"><i class="bi"></i></button></pre></div>
|
||
|
</details>
|
||
|
<div class="cell-output-display">
|
||
|
<div class="leaflet html-widget html-fill-item-overflow-hidden html-fill-item" id="htmlwidget-f5842b6ce0ced49c81dd" style="width:100%;height:464px;"></div>
|
||
|
<script type="application/json" data-for="htmlwidget-f5842b6ce0ced49c81dd">{"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,"OSM (standard)",{"minZoom":0,"maxZoom":18,"tileSize":256,"subdomains":"abc","errorTileUrl":"","tms":false,"noWrap":false,"zoomOffset":0,"zoomReverse":false,"opacity":1,"zIndex":1,"detectRetina":false,"attribution":"© <a href=\"https://openstreetmap.org\">OpenStreetMap<\/a> contributors, <a href=\"https://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA<\/a>"}]},{"method":"addProviderTiles","args":["OpenTopoMap",null,"Topografisk",{"errorTileUrl":"","noWrap":false,"detectRetina":false}]},{"method":"addPolylines","args":[[[[{"lng":[-122.968432,-122.96843,-122.968426,-122.968426,-122.968424,-122.968422,-122.968422,-122.968421,-122.968345,-122.968297,-122.968222,-122.968125,-122.967999,-122.967578,-122.967463,-122.966829,-122.966021,-122.964904,-122.964008,-122.963836,-122.963568,-122.963108,-122.962697,-122.962006,-122.961416,-122.960953,-122.960628,-122.960275,-122.959577,-122.958942,-122.958381,-122.958107,-122.957688,-122.957235,-122.956674,-122.956341,-122.956213,-122.956129,-122.955811,-122.955215,-122.954911,-122.954531,-122.954375,-122.954208,-122.953521,-122.953348,-122.953133,-122.953055,-122.95301,-122.952972,-122.952929,-122.952894,-122.952879,-122.952823,-122.95282,-122.952777,-122.952703,-122.952603,-122.952179,-122.952014,-122.951901,-122.951773,-122.951689,-122.951647,-122.951621,-122.951599,-122.95159,-122.951592,-122.951599,-122.951618,-122.951656,-122.951928,-122.95195,-122.952047,-122.952159,-122.952263,-122.952363,-122.952634,-122.952821,-122.953005,-122.953124,-122.953317,-122.953404,-122.953955,-122.95459,-122.954872,-122.95514,-122.955388,-122.955584,-122.955738,-122.955841,-122.955909,-122.955954,-122.955952,-122.955918,-122.955849,-122.95579,-122.955738,-122.955642,-122.95552,-122.955325,-122.955114,-122.954888,-122.954767,-122.954566,-122.954339,-122.954139,-122.953904,-122.953697,-122.953415,-122.952948,-122.952739,-122.952578,-122.952397,-122.952224,-122.951832,-122.951312,-122.950897,-122.950578,-122.950218,-122.949963,-122.949757,-122.949528,-122.949282,-122.949049,-122.948792,-122.94844,-122.948096,-122.947836,-122.947465,-122.94708,-122.946793,-122.946232,-122.945726,-122.945262,-122.944766,-122.944238,-122.943908,-122.943436,-122.943052,-122.942756,-122.942554,-122.942341,-122.942184,-122.941999,-122.941686,-122.941451,-122.941231,-122.940978,-122.94047,-122.940254,-122.940094,-122.939924,-122.939732,-122.939499,-122.939327,-122.938941,-122.93867,-122.93853,-122.93838,-122.938264,-122.938156,-122.938043,-122.937933,-122.937829,-122.9377,-122.937507,-122.937315,-122.937094,-122.93691,-122.936675,-122.93645,-122.93615,-122.935941,-122.935654,-122.935477,-122.935267,-122.935131,-122.934996,-122.934832,-122.934687,-122.934533,-122.934403,-122.93426,-122.934162,-122.934084,-122.934033,-122.934009,-122.934003,-122.934023,-122.934065,-122.934143,-122.934276,-122.934441,-122.934667,-122.934883,-122.935065,-122.93524,-122.935414,-122.935581,-122.935718,-122.935887,-122.935984,-122.936084,-122.936209,-122.936749,-122.936856,-122.937167,-122.93784,-122.938054,-122.938118,-122.945099,-122.945197,-122.945297,-122.945405,-122.945523,-122.945648,-122.945786,-122.945932,-122.946105,-122.946278,-122.946456,-122.946659,-122.946859,-122.947056,-122.947266,-122.947507,-122.947761,-122.948044,-122.949469,-122.950782,-122.951576,-122.952835,-122.953413,-122.953743,-122.954014,-122.954254,-122.95445,-122.95456,-122.954647,-122.954717,-122.95477,-122.954846,-122.954877,-122.954935,-122.954976,-122.955057,-122.955219,-122.9554,-122.955657,-122.955937,-122.95614,-122.95631,-122.956766,-122.957235,-122.957536,-122.958106,-122.95884,-122.95927,-122.959727,-122.960197,-122.960589,-122.960951,-122.961271,-122.961533,-122.96171,-122.961837,-122.961925,-122.961878,-122.961617,-122.961377,-122.961084,-122.960735,-122.960232,-122.95
|
||
|
</div>
|
||
|
</div>
|
||
|
<section id="kommentarer" class="level2">
|
||
|
<h2 class="anchored" data-anchor-id="kommentarer">Kommentarer</h2>
|
||
|
<p>Kortet er et lille forsøg på at binde forskelligt indhold sammen og visualisere det på en let tilgængelig og interaktiv måde.</p>
|
||
|
|
||
|
|
||
|
</section>
|
||
|
</section>
|
||
|
|
||
|
</main> <!-- /main -->
|
||
|
<script id="quarto-html-after-body" type="application/javascript">
|
||
|
window.document.addEventListener("DOMContentLoaded", function (event) {
|
||
|
const toggleBodyColorMode = (bsSheetEl) => {
|
||
|
const mode = bsSheetEl.getAttribute("data-mode");
|
||
|
const bodyEl = window.document.querySelector("body");
|
||
|
if (mode === "dark") {
|
||
|
bodyEl.classList.add("quarto-dark");
|
||
|
bodyEl.classList.remove("quarto-light");
|
||
|
} else {
|
||
|
bodyEl.classList.add("quarto-light");
|
||
|
bodyEl.classList.remove("quarto-dark");
|
||
|
}
|
||
|
}
|
||
|
const toggleBodyColorPrimary = () => {
|
||
|
const bsSheetEl = window.document.querySelector("link#quarto-bootstrap");
|
||
|
if (bsSheetEl) {
|
||
|
toggleBodyColorMode(bsSheetEl);
|
||
|
}
|
||
|
}
|
||
|
toggleBodyColorPrimary();
|
||
|
const disableStylesheet = (stylesheets) => {
|
||
|
for (let i=0; i < stylesheets.length; i++) {
|
||
|
const stylesheet = stylesheets[i];
|
||
|
stylesheet.rel = 'prefetch';
|
||
|
}
|
||
|
}
|
||
|
const enableStylesheet = (stylesheets) => {
|
||
|
for (let i=0; i < stylesheets.length; i++) {
|
||
|
const stylesheet = stylesheets[i];
|
||
|
stylesheet.rel = 'stylesheet';
|
||
|
}
|
||
|
}
|
||
|
const manageTransitions = (selector, allowTransitions) => {
|
||
|
const els = window.document.querySelectorAll(selector);
|
||
|
for (let i=0; i < els.length; i++) {
|
||
|
const el = els[i];
|
||
|
if (allowTransitions) {
|
||
|
el.classList.remove('notransition');
|
||
|
} else {
|
||
|
el.classList.add('notransition');
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
const toggleColorMode = (alternate) => {
|
||
|
// Switch the stylesheets
|
||
|
const alternateStylesheets = window.document.querySelectorAll('link.quarto-color-scheme.quarto-color-alternate');
|
||
|
manageTransitions('#quarto-margin-sidebar .nav-link', false);
|
||
|
if (alternate) {
|
||
|
enableStylesheet(alternateStylesheets);
|
||
|
for (const sheetNode of alternateStylesheets) {
|
||
|
if (sheetNode.id === "quarto-bootstrap") {
|
||
|
toggleBodyColorMode(sheetNode);
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
|
disableStylesheet(alternateStylesheets);
|
||
|
toggleBodyColorPrimary();
|
||
|
}
|
||
|
manageTransitions('#quarto-margin-sidebar .nav-link', true);
|
||
|
// Switch the toggles
|
||
|
const toggles = window.document.querySelectorAll('.quarto-color-scheme-toggle');
|
||
|
for (let i=0; i < toggles.length; i++) {
|
||
|
const toggle = toggles[i];
|
||
|
if (toggle) {
|
||
|
if (alternate) {
|
||
|
toggle.classList.add("alternate");
|
||
|
} else {
|
||
|
toggle.classList.remove("alternate");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
// Hack to workaround the fact that safari doesn't
|
||
|
// properly recolor the scrollbar when toggling (#1455)
|
||
|
if (navigator.userAgent.indexOf('Safari') > 0 && navigator.userAgent.indexOf('Chrome') == -1) {
|
||
|
manageTransitions("body", false);
|
||
|
window.scrollTo(0, 1);
|
||
|
setTimeout(() => {
|
||
|
window.scrollTo(0, 0);
|
||
|
manageTransitions("body", true);
|
||
|
}, 40);
|
||
|
}
|
||
|
}
|
||
|
const isFileUrl = () => {
|
||
|
return window.location.protocol === 'file:';
|
||
|
}
|
||
|
const hasAlternateSentinel = () => {
|
||
|
let styleSentinel = getColorSchemeSentinel();
|
||
|
if (styleSentinel !== null) {
|
||
|
return styleSentinel === "alternate";
|
||
|
} else {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
const setStyleSentinel = (alternate) => {
|
||
|
const value = alternate ? "alternate" : "default";
|
||
|
if (!isFileUrl()) {
|
||
|
window.localStorage.setItem("quarto-color-scheme", value);
|
||
|
} else {
|
||
|
localAlternateSentinel = value;
|
||
|
}
|
||
|
}
|
||
|
const getColorSchemeSentinel = () => {
|
||
|
if (!isFileUrl()) {
|
||
|
const storageValue = window.localStorage.getItem("quarto-color-scheme");
|
||
|
return storageValue != null ? storageValue : localAlternateSentinel;
|
||
|
} else {
|
||
|
return localAlternateSentinel;
|
||
|
}
|
||
|
}
|
||
|
let localAlternateSentinel = 'alternate';
|
||
|
// Dark / light mode switch
|
||
|
window.quartoToggleColorScheme = () => {
|
||
|
// Read the current dark / light value
|
||
|
let toAlternate = !hasAlternateSentinel();
|
||
|
toggleColorMode(toAlternate);
|
||
|
setStyleSentinel(toAlternate);
|
||
|
};
|
||
|
// Ensure there is a toggle, if there isn't float one in the top right
|
||
|
if (window.document.querySelector('.quarto-color-scheme-toggle') === null) {
|
||
|
const a = window.document.createElement('a');
|
||
|
a.classList.add('top-right');
|
||
|
a.classList.add('quarto-color-scheme-toggle');
|
||
|
a.href = "";
|
||
|
a.onclick = function() { try { window.quartoToggleColorScheme(); } catch {} return false; };
|
||
|
const i = window.document.createElement("i");
|
||
|
i.classList.add('bi');
|
||
|
a.appendChild(i);
|
||
|
window.document.body.appendChild(a);
|
||
|
}
|
||
|
// Switch to dark mode if need be
|
||
|
if (hasAlternateSentinel()) {
|
||
|
toggleColorMode(true);
|
||
|
} else {
|
||
|
toggleColorMode(false);
|
||
|
}
|
||
|
const icon = "";
|
||
|
const anchorJS = new window.AnchorJS();
|
||
|
anchorJS.options = {
|
||
|
placement: 'right',
|
||
|
icon: icon
|
||
|
};
|
||
|
anchorJS.add('.anchored');
|
||
|
const isCodeAnnotation = (el) => {
|
||
|
for (const clz of el.classList) {
|
||
|
if (clz.startsWith('code-annotation-')) {
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
const clipboard = new window.ClipboardJS('.code-copy-button', {
|
||
|
text: function(trigger) {
|
||
|
const codeEl = trigger.previousElementSibling.cloneNode(true);
|
||
|
for (const childEl of codeEl.children) {
|
||
|
if (isCodeAnnotation(childEl)) {
|
||
|
childEl.remove();
|
||
|
}
|
||
|
}
|
||
|
return codeEl.innerText;
|
||
|
}
|
||
|
});
|
||
|
clipboard.on('success', function(e) {
|
||
|
// button target
|
||
|
const button = e.trigger;
|
||
|
// don't keep focus
|
||
|
button.blur();
|
||
|
// flash "checked"
|
||
|
button.classList.add('code-copy-button-checked');
|
||
|
var currentTitle = button.getAttribute("title");
|
||
|
button.setAttribute("title", "Kopieret!");
|
||
|
let tooltip;
|
||
|
if (window.bootstrap) {
|
||
|
button.setAttribute("data-bs-toggle", "tooltip");
|
||
|
button.setAttribute("data-bs-placement", "left");
|
||
|
button.setAttribute("data-bs-title", "Kopieret!");
|
||
|
tooltip = new bootstrap.Tooltip(button,
|
||
|
{ trigger: "manual",
|
||
|
customClass: "code-copy-button-tooltip",
|
||
|
offset: [0, -8]});
|
||
|
tooltip.show();
|
||
|
}
|
||
|
setTimeout(function() {
|
||
|
if (tooltip) {
|
||
|
tooltip.hide();
|
||
|
button.removeAttribute("data-bs-title");
|
||
|
button.removeAttribute("data-bs-toggle");
|
||
|
button.removeAttribute("data-bs-placement");
|
||
|
}
|
||
|
button.setAttribute("title", currentTitle);
|
||
|
button.classList.remove('code-copy-button-checked');
|
||
|
}, 1000);
|
||
|
// clear code selection
|
||
|
e.clearSelection();
|
||
|
});
|
||
|
function tippyHover(el, contentFn) {
|
||
|
const config = {
|
||
|
allowHTML: true,
|
||
|
content: contentFn,
|
||
|
maxWidth: 500,
|
||
|
delay: 100,
|
||
|
arrow: false,
|
||
|
appendTo: function(el) {
|
||
|
return el.parentElement;
|
||
|
},
|
||
|
interactive: true,
|
||
|
interactiveBorder: 10,
|
||
|
theme: 'quarto',
|
||
|
placement: 'bottom-start'
|
||
|
};
|
||
|
window.tippy(el, config);
|
||
|
}
|
||
|
const noterefs = window.document.querySelectorAll('a[role="doc-noteref"]');
|
||
|
for (var i=0; i<noterefs.length; i++) {
|
||
|
const ref = noterefs[i];
|
||
|
tippyHover(ref, function() {
|
||
|
// use id or data attribute instead here
|
||
|
let href = ref.getAttribute('data-footnote-href') || ref.getAttribute('href');
|
||
|
try { href = new URL(href).hash; } catch {}
|
||
|
const id = href.replace(/^#\/?/, "");
|
||
|
const note = window.document.getElementById(id);
|
||
|
return note.innerHTML;
|
||
|
});
|
||
|
}
|
||
|
let selectedAnnoteEl;
|
||
|
const selectorForAnnotation = ( cell, annotation) => {
|
||
|
let cellAttr = 'data-code-cell="' + cell + '"';
|
||
|
let lineAttr = 'data-code-annotation="' + annotation + '"';
|
||
|
const selector = 'span[' + cellAttr + '][' + lineAttr + ']';
|
||
|
return selector;
|
||
|
}
|
||
|
const selectCodeLines = (annoteEl) => {
|
||
|
const doc = window.document;
|
||
|
const targetCell = annoteEl.getAttribute("data-target-cell");
|
||
|
const targetAnnotation = annoteEl.getAttribute("data-target-annotation");
|
||
|
const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation));
|
||
|
const lines = annoteSpan.getAttribute("data-code-lines").split(",");
|
||
|
const lineIds = lines.map((line) => {
|
||
|
return targetCell + "-" + line;
|
||
|
})
|
||
|
let top = null;
|
||
|
let height = null;
|
||
|
let parent = null;
|
||
|
if (lineIds.length > 0) {
|
||
|
//compute the position of the single el (top and bottom and make a div)
|
||
|
const el = window.document.getElementById(lineIds[0]);
|
||
|
top = el.offsetTop;
|
||
|
height = el.offsetHeight;
|
||
|
parent = el.parentElement.parentElement;
|
||
|
if (lineIds.length > 1) {
|
||
|
const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]);
|
||
|
const bottom = lastEl.offsetTop + lastEl.offsetHeight;
|
||
|
height = bottom - top;
|
||
|
}
|
||
|
if (top !== null && height !== null && parent !== null) {
|
||
|
// cook up a div (if necessary) and position it
|
||
|
let div = window.document.getElementById("code-annotation-line-highlight");
|
||
|
if (div === null) {
|
||
|
div = window.document.createElement("div");
|
||
|
div.setAttribute("id", "code-annotation-line-highlight");
|
||
|
div.style.position = 'absolute';
|
||
|
parent.appendChild(div);
|
||
|
}
|
||
|
div.style.top = top - 2 + "px";
|
||
|
div.style.height = height + 4 + "px";
|
||
|
let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter");
|
||
|
if (gutterDiv === null) {
|
||
|
gutterDiv = window.document.createElement("div");
|
||
|
gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter");
|
||
|
gutterDiv.style.position = 'absolute';
|
||
|
const codeCell = window.document.getElementById(targetCell);
|
||
|
const gutter = codeCell.querySelector('.code-annotation-gutter');
|
||
|
gutter.appendChild(gutterDiv);
|
||
|
}
|
||
|
gutterDiv.style.top = top - 2 + "px";
|
||
|
gutterDiv.style.height = height + 4 + "px";
|
||
|
}
|
||
|
selectedAnnoteEl = annoteEl;
|
||
|
}
|
||
|
};
|
||
|
const unselectCodeLines = () => {
|
||
|
const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"];
|
||
|
elementsIds.forEach((elId) => {
|
||
|
const div = window.document.getElementById(elId);
|
||
|
if (div) {
|
||
|
div.remove();
|
||
|
}
|
||
|
});
|
||
|
selectedAnnoteEl = undefined;
|
||
|
};
|
||
|
// Attach click handler to the DT
|
||
|
const annoteDls = window.document.querySelectorAll('dt[data-target-cell]');
|
||
|
for (const annoteDlNode of annoteDls) {
|
||
|
annoteDlNode.addEventListener('click', (event) => {
|
||
|
const clickedEl = event.target;
|
||
|
if (clickedEl !== selectedAnnoteEl) {
|
||
|
unselectCodeLines();
|
||
|
const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active');
|
||
|
if (activeEl) {
|
||
|
activeEl.classList.remove('code-annotation-active');
|
||
|
}
|
||
|
selectCodeLines(clickedEl);
|
||
|
clickedEl.classList.add('code-annotation-active');
|
||
|
} else {
|
||
|
// Unselect the line
|
||
|
unselectCodeLines();
|
||
|
clickedEl.classList.remove('code-annotation-active');
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
const findCites = (el) => {
|
||
|
const parentEl = el.parentElement;
|
||
|
if (parentEl) {
|
||
|
const cites = parentEl.dataset.cites;
|
||
|
if (cites) {
|
||
|
return {
|
||
|
el,
|
||
|
cites: cites.split(' ')
|
||
|
};
|
||
|
} else {
|
||
|
return findCites(el.parentElement)
|
||
|
}
|
||
|
} else {
|
||
|
return undefined;
|
||
|
}
|
||
|
};
|
||
|
var bibliorefs = window.document.querySelectorAll('a[role="doc-biblioref"]');
|
||
|
for (var i=0; i<bibliorefs.length; i++) {
|
||
|
const ref = bibliorefs[i];
|
||
|
const citeInfo = findCites(ref);
|
||
|
if (citeInfo) {
|
||
|
tippyHover(citeInfo.el, function() {
|
||
|
var popup = window.document.createElement('div');
|
||
|
citeInfo.cites.forEach(function(cite) {
|
||
|
var citeDiv = window.document.createElement('div');
|
||
|
citeDiv.classList.add('hanging-indent');
|
||
|
citeDiv.classList.add('csl-entry');
|
||
|
var biblioDiv = window.document.getElementById('ref-' + cite);
|
||
|
if (biblioDiv) {
|
||
|
citeDiv.innerHTML = biblioDiv.innerHTML;
|
||
|
}
|
||
|
popup.appendChild(citeDiv);
|
||
|
});
|
||
|
return popup.innerHTML;
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
var localhostRegex = new RegExp(/^(?:http|https):\/\/localhost\:?[0-9]*\//);
|
||
|
var filterRegex = new RegExp('/' + window.location.host + '/');
|
||
|
var isInternal = (href) => {
|
||
|
return filterRegex.test(href) || localhostRegex.test(href);
|
||
|
}
|
||
|
// Inspect non-navigation links and adorn them if external
|
||
|
var links = window.document.querySelectorAll('a[href]:not(.nav-link):not(.navbar-brand):not(.toc-action):not(.sidebar-link):not(.sidebar-item-toggle):not(.pagination-link):not(.no-external):not([aria-hidden]):not(.dropdown-item)');
|
||
|
for (var i=0; i<links.length; i++) {
|
||
|
const link = links[i];
|
||
|
if (!isInternal(link.href)) {
|
||
|
// target, if specified
|
||
|
link.setAttribute("target", "_blank");
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
</script>
|
||
|
</div> <!-- /content -->
|
||
|
<footer class="footer">
|
||
|
<div class="nav-footer">
|
||
|
<div class="nav-footer-left">
|
||
|
|
||
|
</div>
|
||
|
<div class="nav-footer-center">Lavet med <a href="https://quarto.org/">Quarto</a> i <a href="">RStudio</a> | Statistics with <a href="https://stats.nikohuru.dk/share/qpECsH3GvxLM5L92/fam.gdamsbo">Umami</a></div>
|
||
|
<div class="nav-footer-right">
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</footer>
|
||
|
|
||
|
|
||
|
|
||
|
</body></html>
|