Thicket data repository for the EEG
at main 3.9 kB view raw
1{ 2 "id": "https://www.tunbury.org/2025/04/24/infra-map", 3 "title": "OCaml Infra Map", 4 "link": "https://www.tunbury.org/2025/04/24/infra-map/", 5 "updated": "2025-04-24T10:00:00", 6 "published": "2025-04-24T10:00:00", 7 "summary": "Yesterday, we were talking about extending the current infrastructure database to incorporate other information to provide prompts to return machines to the pool of resources after they have completed their current role/loan, etc. There is also a wider requirement to bring these services back to Cambridge from Equinix/Scaleway, which will be the subject of a follow-up post. However, the idea of extending the database made me think that it would be amusing to overlay the machine’s positions onto Google Maps.", 8 "content": "<p>Yesterday, we were talking about extending the current infrastructure database to incorporate other information to provide prompts to return machines to the pool of resources after they have completed their current role/loan, etc. There is also a wider requirement to bring these services back to Cambridge from Equinix/Scaleway, which will be the subject of a follow-up post. However, the idea of extending the database made me think that it would be amusing to overlay the machine’s positions onto Google Maps.</p>\n\n<p>I added positioning data in the Jekyll Collection <code>_machines\\*.md</code> for each machine. e.g. <a href=\"https://raw.githubusercontent.com/ocaml/infrastructure/refs/heads/master/_machines/ainia.md\">ainia.md</a></p>\n\n<div><div><pre><code>---\nname: ainia\n...\nlatitude: 52.2109\nlongitude: 0.0917\n---\n</code></pre></div></div>\n\n<p>Then Jekyll’s Liquid templating engine can create a JavaScript array for us</p>\n\n<div><div><pre><code>\n <span>// Define machines data array from Jekyll collection</span>\n <span>const</span> <span>machinesData</span> <span>=</span> <span>[</span>\n <span>{</span><span>%</span> <span>for</span> <span>machine</span> <span>in</span> <span>site</span><span>.</span><span>machines</span> <span>%</span><span>}</span>\n <span>{</span><span>%</span> <span>if</span> <span>machine</span><span>.</span><span>latitude</span> <span>and</span> <span>machine</span><span>.</span><span>longitude</span> <span>%</span><span>}</span>\n <span>{</span>\n <span>name</span><span>:</span> <span>\"</span><span>{{ machine.name }}</span><span>\"</span><span>,</span>\n <span>lat</span><span>:</span> <span>{{</span> <span>machine</span><span>.</span><span>latitude</span> <span>}},</span>\n <span>lng</span><span>:</span> <span>{{</span> <span>machine</span><span>.</span><span>longitude</span> <span>}},</span>\n <span>{</span><span>%</span> <span>if</span> <span>machine</span><span>.</span><span>description</span> <span>%</span><span>}</span>\n <span>description</span><span>:</span> <span>\"</span><span>{{ machine.description | escape }}</span><span>\"</span><span>,</span>\n <span>{</span><span>%</span> <span>endif</span> <span>%</span><span>}</span>\n <span>// Add any other properties you need</span>\n <span>},</span>\n <span>{</span><span>%</span> <span>endif</span> <span>%</span><span>}</span>\n <span>{</span><span>%</span> <span>endfor</span> <span>%</span><span>}</span>\n <span>];</span>\n\n</code></pre></div></div>\n\n<p>This array can be converted into an array of map markers. Google have an API for clustering the markers into a count of machines. I added a random offset to each location to avoid all the markers piling up on a single spot.</p>\n\n<p>The interactive map can be seen at <a href=\"https://infra.ocaml.org/machines.html\">machines.html</a></p>", 9 "content_type": "html", 10 "author": { 11 "name": "Mark Elvers", 12 "email": "mark.elvers@tunbury.org", 13 "uri": null 14 }, 15 "categories": [ 16 "OCaml", 17 "tunbury.org" 18 ], 19 "source": "https://www.tunbury.org/atom.xml" 20}