<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dennis Bauszus on Medium]]></title>
        <description><![CDATA[Stories by Dennis Bauszus on Medium]]></description>
        <link>https://medium.com/@dbauszus?source=rss-b8939ac69d9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*u4wBYMbtRgoq7vrlaPcm6w.jpeg</url>
            <title>Stories by Dennis Bauszus on Medium</title>
            <link>https://medium.com/@dbauszus?source=rss-b8939ac69d9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 05:03:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dbauszus/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Composing Software: Spatial for the JAMstack generation.]]></title>
            <link>https://dbauszus.medium.com/composing-software-spatial-for-the-jamstack-generation-e741bed43d87?source=rss-b8939ac69d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e741bed43d87</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[foss4g]]></category>
            <category><![CDATA[openlayers]]></category>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[spatial]]></category>
            <dc:creator><![CDATA[Dennis Bauszus]]></dc:creator>
            <pubDate>Tue, 23 Aug 2022 18:02:59 GMT</pubDate>
            <atom:updated>2022-08-23T18:02:59.616Z</atom:updated>
            <content:encoded><![CDATA[<p>At GEOLYTIX we are currently putting finishing touches to the v4 release of <a href="https://github.com/GEOLYTIX/xyz/tree/v4">XYZ/Mapp</a>.</p><p><a href="https://github.com/GEOLYTIX/xyz/wiki">XYZ is a node.js application to provide serverless cloud interfaces for spatial data. Mapp is a library to build web applications which interface with the XYZ API.</a></p><p>Working with a small team of dedicated engineers we must keep the library as lean as possible. With dozens of v3 instances already in production, our clients we are satisfied with the available features and performance. Developer experience and integration within the open source community are the priorities for the next release. A first step in this direction was the decision to split the Mapp bundle in two by porting any UI methods into a <a href="https://github.com/GEOLYTIX/xyz/blob/v4/lib/ui.mjs">separate library</a>.</p><p>In this article I want to highlight some Javascript (ES2020) techniques which we use to extend and customise the core functionality of the Mapp library and UI within a browser context (or JAMStack for clickbait).</p><p>Fortunately we never supported Internet Explorer to begin with. This allows to use the best of available techniques such as function composition, object proxies, and dynamic imports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*JnuoMrbzxcyc6FtpuCOfIw.png" /></figure><h3>What is software composition.</h3><p>In the words of Eric Elliot; <a href="https://medium.com/javascript-scene/composing-software-the-book-f31c77fc3ddc">All software development is composition</a>: The act of breaking a complex problem down to smaller parts, and then composing those smaller solutions together to form your application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8_q8m9Saxq6Jt4oH.jpeg" /><figcaption>Composing Software by Eric Elliot</figcaption></figure><h3>What is the JAMstack.</h3><p>Coined by Netlify CEO and co-founder Mathias Biilmann to describe modern web development architecture, a <em>JAMstack</em> consist of JavaScript, APIs, and Markup. <a href="https://en.wikipedia.org/wiki/Jamstack">In Jamstack websites, the application logic typically resides on the client side, without being tightly coupled to the back end server.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5hsK67wa6QtUWqgq.jpeg" /><figcaption>Image credit <a href="http://www.cygnismedia.com/">www.cygnismedia.com</a></figcaption></figure><p>This means that we are able to import the Mapp library into any hosted markup and start building map-centric applications with vanilla Javascript. There is no need to learn any particular web framework though you are free to choose one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*0Wd8f6VF6Y9RSXBI.jpg" /><figcaption>Image by Andres Reales</figcaption></figure><h3>Composition without compilation.</h3><p>There are multiple ways to bring script into the context of a web application.</p><p>The <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#basic_usage">basic usage of the &lt;script&gt; tag</a> allows import from a source.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/835f8e0ca0c0ffc11dd780bc94ddae6d/href">https://medium.com/media/835f8e0ca0c0ffc11dd780bc94ddae6d/href</a></iframe><p>Script may also be nested inline as a <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement">HTMLScriptElement</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c5ed40b6c29da52cb4be134f0f9e1b0/href">https://medium.com/media/9c5ed40b6c29da52cb4be134f0f9e1b0/href</a></iframe><p>Then there is the evil eval(). There isn’t much to be said but;</p><p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval!"><strong>Never use eval()</strong></a>.</p><p>Within Mapp script we may also use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import">static imports</a> for locally available modules. We use <a href="https://esbuild.github.io/getting-started/">esbuild</a> to bundle the Mapp and UI libraries.</p><p><a href="https://github.com/tc39/proposal-dynamic-import#import">Proposed at TC39</a>, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import">dynamic imports</a> are finally available in all modern browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*sG0rMDlUtnMtViMl03P1Zg.png" /><figcaption>As of yesterday IE is already gone from the MDN support matrix.</figcaption></figure><p>The static form may be preferable for loading initial dependencies, and can benefit more readily from static analysis tools and <a href="https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking">tree shaking</a>. However we are able to use dynamic imports as a fallback for missing script dependencies and to extend our application via plugins.</p><p>It is important to note that these imports come from <a href="https://www.skypack.dev/">Skypack</a> which provides load optimized npm packages with no install and no build tools.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*jQHXaSXrKxRocfL8XUA1Kg.png" /></figure><h3>Function Composition</h3><p><a href="https://www.educative.io/answers/function-composition-in-javascript"><strong>Function composition</strong> is an approach where the result of one function is passed on to the next function, which is passed to another until the final function is executed for the final result.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TFDTcPJWA0EZ6CC1PYPPzw.png" /></figure><p>Multiple utility libraries such as <a href="https://ramdajs.com/">Ramda</a> and <a href="https://lodash.com/">Lodash</a> provide methods to compose functions. Within the mapp.utils we provide a basic compose() method where an array of functions is <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce">reduced</a> to provide a final results from the <em>reducer</em> callbacks.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/64e2fe8b32a697272101862d688f31e7/href">https://medium.com/media/64e2fe8b32a697272101862d688f31e7/href</a></iframe><h3>Callback arrays</h3><p>We provide callback arrays where it is not required to execute methods in a synchronous manner.</p><p>The <a href="https://openlayers.org/en/latest/apidoc/module-ol_interaction_Draw.html">Openlayers draw interaction</a> for example can be configured with a condition to confirm whether the event should be handled. With a callback array we can execute multiple asynchronous function calls from a single event.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bd12e15d1af34a6903dd07c2e6e5a9b8/href">https://medium.com/media/bd12e15d1af34a6903dd07c2e6e5a9b8/href</a></iframe><p>Initiated with a callback array the Mapp API draw interaction allows for multiple calls to different routing APIs such as <a href="https://docs.mapbox.com/help/getting-started/directions/">Mapbox Directions</a> or <a href="https://developer.here.com/documentation/routing-api/dev_guide/index.html">Here Routing</a> with the draw geometry as input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*--jdPxNN3-rlHLunYKILYg.png" /></figure><h3>DOM events and proxies</h3><p>The separation of user interface and mapview means that the Mapp library cannot know about any listview element created by the UI library. List objects must be able to handle insert, delete, and update methods. These changes should be reflected in the display of the listview element. Once imported, UI library methods may listen to change events on the mapview target or the document body itself. This is not recommended unless the event is in regard to a view change of the mapview element.</p><p>A more elegant solution will create a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy">Proxy</a> from the mapview.locations list object. Methods to add or remove location views from listview element can be bound to the <em>set</em> and <em>deleteProperty</em> methods of the proxy.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6dc6ecb9ed40955b1614af65c4b8e5c5/href">https://medium.com/media/6dc6ecb9ed40955b1614af65c4b8e5c5/href</a></iframe><h3>Dictionaries</h3><p>In order to provide user interfaces for our global clients it must be possible to extend <a href="https://github.com/GEOLYTIX/xyz/tree/v4/lib/dictionaries">Mapp dictionaries</a> by merging new entries and languages into the dictionaries object.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b84bb8c3d3b2990d9588f54de3910516/href">https://medium.com/media/b84bb8c3d3b2990d9588f54de3910516/href</a></iframe><p>The mapp.dictionary itself is a proxy which will return the English text for the requested key value as fallback.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ebf97dfaebf24507fe6c8aeb5b673cc2/href">https://medium.com/media/ebf97dfaebf24507fe6c8aeb5b673cc2/href</a></iframe><h3>Dynamic Imports</h3><p>The UI and Mapp bundle must only include dependencies without which no mapview could be initialised. Furthermore, any script included must be open source and not violate our <a href="https://github.com/GEOLYTIX/xyz/blob/v4/LICENSE">licence</a>.</p><p>Openlayers allows for 3rd party mapping libraries such as <a href="https://github.com/mapbox/mapbox-gl-js">mapbox-gl</a> or <a href="https://github.com/maplibre/maplibre-gl-js">maplibre-gl</a> to <a href="https://openlayers.org/en/latest/apidoc/module-ol_layer_Layer.html#~RenderFunction">override the default render of the layer object</a>.</p><p>Within a Mapp module we can check whether a library has already been loaded from a script tag and is available as global object. If unavailable we will create a promise to await the import of the required library from Skypack. Subsequent and concurrent calls must wait for the promise assigned to a variable outside the closure to be fulfilled.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/693064e80a2915841e6dfd22d2ecc5f0/href">https://medium.com/media/693064e80a2915841e6dfd22d2ecc5f0/href</a></iframe><p>In a similar fashion are we able to provide fallback imports for libraries such <a href="https://github.com/chartjs/Chart.js">chart-js</a> and <a href="https://github.com/olifolkerd/tabulator">tabulator</a> which are referenced in the mapp.ui library. This allows us to provide core interface methods for data visualisations but only load the libraries once required. Not every Mapp instance adds charts and/or tables for spatial data represented in a mapview. And not every user will open a location which supports such a visualisation. But once they do, the necessary script will either be imported from Skypack if not already cached in the browser.</p><p>A client can change the behaviour of the layer style function to create custom icons which represent the distribution of feature properties within a cluster and display their location on hover.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fdbauszus-glx%2Fembed%2Fpreview%2FbGazOaG%3Fdefault-tabs%3Djs%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DbGazOaG&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2Fdbauszus-glx%2Fpen%2FbGazOaG&amp;image=https%3A%2F%2Fshots.codepen.io%2Fdbauszus-glx%2Fpen%2FbGazOaG-512.jpg%3Fversion%3D1661077646&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/81f727dcc5f4ac4480ae7aba289032d5/href">https://medium.com/media/81f727dcc5f4ac4480ae7aba289032d5/href</a></iframe><h3>Mapp Plugins</h3><p>Prior to the general availability of dynamic imports we would use promises to to create a script tag element which we append to the document head of an application view. Once loaded the script element and associated event listener would be removed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31655737913478537c9fd49bc09b5009/href">https://medium.com/media/31655737913478537c9fd49bc09b5009/href</a></iframe><p>This process required the plugin script to be nested in a CustomEvent dispatched to the document. The Mapp library could be passed as event detail thus allowing to modify or append the library within the global (window) context.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b91fafe00077db2247f7c37306f4c3e7/href">https://medium.com/media/b91fafe00077db2247f7c37306f4c3e7/href</a></iframe><p>This rather unelegant process has now been superseded by the v4 Mapp <a href="https://gist.github.com/dbauszus-glx/e7397406aba43876079a13878729bf0e">loadPlugins</a> utility. Here we only need to provide an array of source locator to be dynamically imported within a Promise.all().</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2db380c47983da8ea8821474ceb74933/href">https://medium.com/media/2db380c47983da8ea8821474ceb74933/href</a></iframe><p>The <a href="https://geolytix.github.io/public/mapp_v4/plugins/sentimentStyle.js">plugin script</a> as shown in the codepen above is hosted on Geolytix /public Github repository published via Github Pages.</p><p>We added a plugin to create and cache SVG icons that represent a feature’s sentiment property to the Bristol locale in the XYZ/Mapp dev workspace.</p><p><a href="https://geolytix.dev/latest/view/blog?layers=mapbox_base,sentiment_style&amp;locale=Bristol&amp;plugins=true">https://geolytix.dev/latest/view/blog?layers=mapbox_base,sentiment_style&amp;locale=Bristol&amp;plugins=true</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*wG7OTvZDChRuJH0Cwg8Mcw.png" /></figure><p><strong><em>SEE YOU SPATIAL COWBOY…</em></strong></p><p>This article is in support of my lightning talk at the ’22 FOSS4G conference in Firenze. I hope to meet you there and talk anything Mapp and Javascript for Spatial in more detail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/0*kbpJDgt4XwrQTW2b.png" /></figure><p>GEOLYTIX are proud to sponsor <a href="https://uk.osgeo.org/foss4guk2022local/">FOSS4G in the UK (17th November ‘22)</a>. Please mark the date and join us either in London or Leeds. I am planning to organise and record a workshop prior to the UK event to provide some hands-on Mapp v4 experience for front-end developers.</p><p>Please subscribe to the GEOLYTIX newsletter and follow us on twitter for forthcoming details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/0*DXMOcPHBf_nNJbCJ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e741bed43d87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamic imports of Javascript modules.]]></title>
            <link>https://dbauszus.medium.com/dynamic-imports-of-javascript-modules-c2326fd4151c?source=rss-b8939ac69d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2326fd4151c</guid>
            <category><![CDATA[dynamic-import]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[location-intelligence]]></category>
            <category><![CDATA[modules]]></category>
            <category><![CDATA[application-development]]></category>
            <dc:creator><![CDATA[Dennis Bauszus]]></dc:creator>
            <pubDate>Thu, 07 Oct 2021 17:48:29 GMT</pubDate>
            <atom:updated>2021-10-07T17:48:29.694Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://github.com/tc39/proposal-dynamic-import#import">Proposed at TC39</a>, an <em>import function</em> is finally available in most browsers. While this is not a feature to make everyday developer life easier it allows for some interesting solutions. In this shortish article I want to highlight a particular use case for dynamic imports.</p><p>You may skip this article if you need to support Internet Explorer.</p><h4>When to use dynamic imports?</h4><p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#dynamic_imports">MDN advises to use dynamic imports only when necessary</a>. Modules to support optional features which may not be required to launch an application are suited for dynamic imports.</p><p>We are building a location intelligence library (<a href="https://github.com/GEOLYTIX/xyz">MAPP</a>). Openlayers is the primary application interface for spatial data and is required at initialisation in order to present the data as a map control.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*CypXVscmzNWWvm2FRH7zpg.png" /></figure><p>Location data may also be presented as chart or table. For this we require additional libraries such as <a href="https://www.chartjs.org/">Chart.js</a> or <a href="https://github.com/olifolkerd/tabulator">Tabulator</a>. In order to keep the MAPP package lean we prefer to not bundle additional libraries over a size of ~5kb. Chart.js and Tabulator may be provided as script tags in our application views. These libraries may not be required at all by an application view, or may only be required at a later stage. It is now possible to import these modules just in time when needed.</p><h4>How to use dynamic imports?</h4><p>We create our own small modules to be imported for all optional modules. Since the <em>import function</em> returns a promise, our exported function must be async to be awaited for the import to resolve.</p><p>The imported module is stored in a variable outside the closure of our export and shared between multiple imports of the same module.</p><p>If null when required, the <em>dynamicImport</em> method will check whether the module has already been assigned to the window (global) object via a script tag. The module assigned to the window will be assigned to our variable if this is the case. Otherwise we will await the <em>import function</em> to resolve the Tabulator module from <a href="https://www.skypack.dev/">skypack</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/893da5c5dc0130de023931603bcb4a62/href">https://medium.com/media/893da5c5dc0130de023931603bcb4a62/href</a></iframe><h4>Disclaimer</h4><p>This is a fairly new way of doing things. We are currently undergoing a major re-write of the XYZ ecosystem and specifically the MAPP frontend. We are planning to retire Webpack in favour of Snowpack and are re-thinking our handling or third party modules in this regard. We are NOT using this technology yet in production and would like to read your comments.</p><p>For all things Mapp, XYZ, and Location Intelligence in general please follow <a href="https://geolytix.com/">GEOLYTIX</a> on all channels.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2326fd4151c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cloud Chameleon — Making a serverless ‘whodunit’ game for the Zoom generation.]]></title>
            <link>https://dbauszus.medium.com/cloud-chameleon-making-a-serverless-whodunit-game-for-the-zoom-generation-3bb06e012b33?source=rss-b8939ac69d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/3bb06e012b33</guid>
            <category><![CDATA[social-gaming]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[zoom]]></category>
            <category><![CDATA[cloud-gaming]]></category>
            <dc:creator><![CDATA[Dennis Bauszus]]></dc:creator>
            <pubDate>Sat, 16 Jan 2021 19:11:37 GMT</pubDate>
            <atom:updated>2021-01-16T19:11:37.573Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cloud Chameleon — Making a serverless ‘whodunit’ game for the Zoom generation.</h3><p>With no end to the UK lockdown in sight, Zoom parties will remain the weekly highlight of social interaction. Some classic party games such as <a href="https://en.wikipedia.org/wiki/Outburst_(game)">Outburst</a> can be easily played without everyone having the game available at home.</p><p>Looking for new party games to play I bought <a href="https://bigpotato.com/gb/games/the-chameleon/"><strong>The Chameleon</strong></a> by Shoreditch game designers <a href="https://bigpotato.com/"><strong>BigPotatoGames</strong></a>. While the idea is simple enough the game doesn’t easily lend itself to be played by Zoom party without some tweaking. Being a javascript developer I decided to port the game to the cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/0*zuJr4Hmxh6drofsu.jpg" /></figure><p>In this article I decsribe the game mechanics of the CloudChameleon prototype which I was able to put together within a few hours. Hopefully some interested parties will pick up the game and provide us with feedback to further tweak this version of the game. In addition to the game itself I want to discuss the development process and how the codebase may easily be adpated to port other games to the cloud.</p><h3>The Chameleon</h3><p>Your job is to blend in and not get caught. Everyone else is trying to work out who the Chameleon is. Everyone suspects everyone else at the beginning.<br>Using one carefully chosen word the other players try to smoke out the Chameleon, who doesn’t know the secret word.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F3IEEUcG0nSo%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D3IEEUcG0nSo&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F3IEEUcG0nSo%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4514eaf357d09c7b1595e232cbac5060/href">https://medium.com/media/4514eaf357d09c7b1595e232cbac5060/href</a></iframe><h3>How to play CloudChameleon</h3><p>Hosted on Vercel the game can be accessed here: <a href="https://chameleon-roan.vercel.app/">https://chameleon-roan.vercel.app/</a></p><p>The initial screen provides a link to create a new game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*R3ya3mzuzN9I6Uzt1tqV0w.png" /></figure><p>Each game has a unique ID. Following the link to create a new game will redirect the browser with url path being the ID of the game.</p><p>The cloud version of the game is centered around a lounge where players may join or leave in between rounds. Providing your name in the input field and clicking join will request a player cookie from the CloudChameleon host and add the player to the current game. A player will automatically join a game if a CloudChameleon cookie is already present.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*mPW63DKvLkO05P4GKmm-oA.png" /></figure><p>The first player to join is the dealer. It is possible to deal a card with a single player but it wouldn’t make sense to play the game with less than 3 or 4 players minimum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*J3d-p5WJCbZTWyoT42F-yw.png" /></figure><p>The dealer may select a card to be played in the next round. As for now I only provide half of the cards which were shipped with the game as bought from the BigPotatoGames shop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*uwvQlul08q46GKNzpcaMZw.png" /></figure><p>Selecting a card will close the lounge. The host randomly selects who the Chameleon is and the secret word from the card. Every player in the lounge will now see the card with the secret word highlighted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*n7pXPWXJFcpDGt1CgL_FPQ.png" /></figure><p>The Chameleon is now in control of the game but does not have the secret word highlighted.</p><p>The round can now be played via zoom. Every player, including the Chameleon, should take a moment to consider which word they want to say in order to describe the secret word. The chosen word should be vague enough to not give away the secret, but concise enough to flush out the Chameleon.</p><p>Once every one is ready the round is played by saying the word each player has chosen, beginning with the dealer for this round. Beware that it is possible that the dealer for this round can be the Chameleon.</p><p>Due to the nature of a Zoom party the order of play should be determined prior to each player saying their chosen word. Alternatively the player to say their word may name the next player until everyone has provided their clue.</p><p>The group must now decide who the Chameleon is. If no majority decision can be made the dealer of this round can act as tie breaker.</p><p>It is now the turn of the Chameleon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*0SXwCCz4r9ekCSU7iu7R3g.png" /></figure><p>If undetected the Chameleon may click the text button and end this round.</p><p>If uncovered by the other players may Chameleon may make an educated guess for the secret. By clicking any of the words on the card the Chameleon may guess that this word is indeed the secret.</p><p>All players return to the lounge with the scoreboard reflecting the result of the round played. The Chameleon is now the dealer and may start the next round by selecting a card.</p><h4>Scoring</h4><p><em>If undected the Chameleon will received 2 points.</em></p><p><em>If detected but guessing the secret the Chameleon will receive 1 point.</em></p><p><em>But guessing poorly and every other player will receive a point instead for uncovering the Chameleon.</em></p><h3>Making the game</h3><p>By nature of my profession it was clear that the game should be deployed as a serverless function via <a href="https://vercel.com/"><strong>Vercel</strong></a>. As of today and according to their website forever; It is possible to deploy serverless functions for <a href="https://vercel.com/pricing">free</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*QG0Z4QHTB8Bs9vF9.png" /></figure><p>Being serverless the game data itself must be stored in a document store to record the game status and scores. This can be done with <a href="https://cloud.google.com/firestore"><strong>FireStore</strong></a>,<strong> </strong>Google’s fully managed, scalable, and serverless document database. This service comes with a very generous free tier of 20,000 requests per day, and 1GB document storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eMnqZ26uqMttygSG.png" /></figure><p>The game data itself is tiny. The game and document itself share an ID which is created through the <a href="https://www.npmjs.com/package/nano"><strong>Nano</strong></a> package. The status of the game is defined by the current card. Players are in the lounge if the card key is undefined. The players are stored in an array. The first entry being the dealer / chameleon. The game data is updated when a card is selected and during scoring.</p><p>The game id is provided with all requests as URL path parameter. The player id is provided in a cookie with each request.</p><p>The host must be able to trigger events in the browser script for the game. This is usually done with <a href="https://socket.io/">socket.io</a>. However, our host lambda will terminate after a request has been processed. Socket.io does not play well serverless.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*ui98WnDLr0kcyQlYNPR4ng.png" /></figure><p><a href="https://pusher.com/channels"><strong>Pusher/channels</strong></a> is a great service for socket.io~like functionality without the fuss. The free tier includes 200k messages per day which should be plenty for quite a few games. The initial setup took me less time than writing this paragraph. The browser script subscribes to a channel with the same ID as the game. This allows the host to trigger events in the script when players join, leave, a card is dealt, or the scores are updated at the end of a round.</p><p>This leaves only the game script and view to be assembled. This is hardly at facebook level complexity and using a framework such as React would be overkill. We believe in vanilla and simple javascript. The <a href="https://github.com/WebReflection/uhtml"><strong>µhtml</strong></a><strong> </strong>library developed by <a href="https://twitter.com/WebReflection">Andrea Giammarchi</a> provides us with means to effeciently render the game interface into a browser document view.</p><blockquote><a href="https://github.com/dbauszus-glx/chameleon">https://github.com/dbauszus-glx/chameleon</a></blockquote><p>Please feel free to fork my repository and deploy your own host of this game with the information provided here.</p><p>I strongly feel that there is more to be made with the techniques applied in this port. I would like to create a serverless host for the <a href="https://www.secrethitler.com/">Secret Hitler</a> game next. And then perhaps design my own game mechanics in due time. Then again this lockdown can not last forever.</p><blockquote>#staysave</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3bb06e012b33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub Pages media galleries with µhtml]]></title>
            <link>https://dbauszus.medium.com/github-pages-media-galleries-with-%C2%B5html-36771bf05d28?source=rss-b8939ac69d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/36771bf05d28</guid>
            <category><![CDATA[icons]]></category>
            <category><![CDATA[github-pages]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Dennis Bauszus]]></dc:creator>
            <pubDate>Fri, 18 Sep 2020 17:42:37 GMT</pubDate>
            <atom:updated>2020-09-18T17:42:37.483Z</atom:updated>
            <content:encoded><![CDATA[<p>At <a href="https://geolytix.co.uk/">GEOLYTIX</a> we build all kinds of map applications for which we require a range of location marker. It is recommended to use a dedicated image hosting service such <a href="https://cloudinary.com/">cloudinary</a> for caching and on the fly transformations. But we also like the comfort of building SVG from code which makes public GitHub repositories a great tool. GitHub allows us to collaborate on, modify, and version SVGs with an IDE or directly through the GitHub web interface.</p><p>Sounds good? Well here is a screenshot of Icons for British Pubs to wet your appetite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jxx7JoN9PvQZuoiynv0Pxg.png" /></figure><p>It is possible to access GitHub files through the <a href="https://developer.github.com/v3/">GitHub Rest API</a>. Access can be enhanced by enabling <a href="https://pages.github.com/">GitHub pages</a> in the repository settings. GitHub Pages will serve a page from an index.html template included in a repository code folder.</p><p>Having a lot of fun with the capabilities of GitHub pages as well as the GitHub Rest API we came up with the idea to put together a small template for a media gallery. Rendering DOM without a frontend framework is the perfect job for <a href="https://github.com/WebReflection/uhtml">µhtml</a>, a micro HTML/SVG render.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c567c864dba78ea1eb06171d7fec0c29/href">https://medium.com/media/c567c864dba78ea1eb06171d7fec0c29/href</a></iframe><p>The small inline script module will read the content of the repository folder as JSON from the Rest API. Using µhtml we render links for folder on top and a grid flex gallery with images sourced from GitHub Pages links below.</p><p>The <a href="https://github.com/GEOLYTIX/MapIcons/blob/master/index.html">index.html</a> can be accessed on the GitHub Pages URL for each folder:</p><p><a href="https://geolytix.github.io/MapIcons"><strong>https://geolytix.github.io/MapIcons</strong></a></p><p>Of course there is a lot more that can be done with µhtml and GitHub Pages.</p><p>Massive thanks to my colleague <a href="https://twitter.com/cityremade">Agata</a> for creating most of the MapIcons in this repository and to <a href="https://twitter.com/WebReflection">Andrea Giammarchi</a> @WebReflection for putting together an awesome suite of DOM utils among other amazing JavaScript wizardry.</p><p>I hope this will help some of you to make more cool things with these tools.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36771bf05d28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Serverless Enterprise Application Architecture for the JAMstack generation with Zeit, Now Vercel…]]></title>
            <link>https://medium.com/geolytix/serverless-enterprise-application-architecture-for-the-jamstack-generation-with-zeit-now-vercel-92509a3db87d?source=rss-b8939ac69d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/92509a3db87d</guid>
            <category><![CDATA[jamstack]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[vercel]]></category>
            <category><![CDATA[application-architecture]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Dennis Bauszus]]></dc:creator>
            <pubDate>Tue, 07 Jul 2020 19:00:03 GMT</pubDate>
            <atom:updated>2022-08-23T07:23:54.692Z</atom:updated>
            <content:encoded><![CDATA[<h3>Serverless Enterprise Application Architecture with Zeit, Now Vercel, and GitHub for free.</h3><p>This article is about the Enterprise Application Architecture which we use at <a href="https://geolytix.co.uk/">GEOLYTIX</a> in order to facilitate best value from <em>Vercel</em> and <em>GitHub</em>. We are currently building <a href="https://github.com/GEOLYTIX/xyz"><em>XYZ</em></a>¹, a free and open source project to provide interfaces for the analysis and presentation of spatial data. Our aim is to implement techniques in modern web development learned from the emergence of the <em>JAMstack</em>.</p><h3>What’s in a name?</h3><blockquote><em>The JAMstack at its core, is simply an attempt to give a name to a set of widely used architectural practices. It gives us one word to communicate a large range of architectural decisions.²</em></blockquote><p><em>JAMstacks</em> consist of [client-side] JavaScript, APIs, and Markup. The latter usually being HTML + CSS to create browser applications running JavaScript. The term was coined by Netlify CEO and co-founder Mathias Biilmann to describe a modern web development architecture. I highly recommend the <a href="https://www.netlify.com/oreilly-jamstack">ebook provided by Netlify</a> <em>if you feel that delivering great websites should be more about the craft of markup and JavaScript than server setup and administration</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K1Jb0LnrgkSy9p0w.jpeg" /><figcaption>Image credit <a href="http://www.cygnismedia.com/">www.cygnismedia.com</a></figcaption></figure><p>Mathias does well to emphasize that the <em>JAMstack</em> is not one specific technology itself but <em>a mindset and an approach</em>.</p><p>For <em>XYZ</em> we combine the idea of a <em>JAMstack</em> with a <a href="https://medium.com/decoupled/distilled-patterns-of-enterprise-application-architecture-c2db29b90259">pattern of enterprise application architecture which has been proposed by Martin Fowler</a>.</p><p>In his book Fowler suggest three principle layers.</p><h4>Data Source Layer</h4><p>Working in the spatial sector you will have come across the term ‘<em>Spatial is special</em>’. In practice, this means we require a <a href="https://en.wikipedia.org/wiki/PostGIS"><em>PostGIS</em></a> extended relational database (RDS). <em>Amazon Aurora</em> provides us with the capacity to configure a <em>serverless</em> RDS to store and process spatial data. I plan to write in-depth on this subject soon. In the meantime, our friends <a href="https://twitter.com/addresscloud">@addresscloud</a> have written a great article in regards to <a href="https://blog.addresscloud.com/serverless-postgis/">serverless <em>PostGIS</em> with <em>AWS Aurora</em></a>.</p><h4>Domain / Service Layer</h4><p>This architecture layer is a collection of APIs and routing rules which form the application’s domain logic. Once deployed the <em>Application Layer </em>is referred to as the <em>XYZ Host</em>. I use <em>Domain</em> or <em>Service Layer</em> interchangeably referring to the same layer but distinct paths. The business logic of our application is written as <a href="https://martinfowler.com/eaaCatalog/transactionScript.html"><em>transaction script</em></a> to be processed by the <em>Service Layer</em>. Developed as a <em>Node.js</em> application the <em>domain layer</em> is of a modular structure. Modules to generate and sign token, and ultimately the authentication of client requests are available to all API modules. This allows for secure requests to be passed to the <em>Data Source Layer</em>. Requests may also be <em>proxied</em> to 3rd party services by providing keys as secret environment variables, accessible by the <em>XYZ Host</em> processes alone.</p><h4>Presentation / Controller Layer</h4><p>This layer is composed of client facing interfaces as <em>Application Views</em>. Here we apply techniques from the <em>JAMstack</em>. I use <em>Presentation</em> or <em>Controller Layer</em> interchangeably referring to the same layer but distinct methods. The <em>XYZ Library</em> being the controller to send <a href="https://en.wikipedia.org/wiki/Representational_state_transfer"><em>RESTful</em></a> requests to APIs in the <em>Domain / Service Layer</em>, the <em>XYZ Host. </em>Other libraries such as <a href="https://github.com/openlayers/openlayers">Openlayers</a>, <a href="https://github.com/chartjs">ChartJS</a>, and <a href="https://github.com/olifolkerd/tabulator">Tabulator</a> are used for the presentation of data as maps, charts, or tables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yh5B29DjGtvCksJSrqCEPA.png" /></figure><h4>Application View JAMstack</h4><p>Client side applications use the <em>JAMstack</em> to retrieve and present content from a Content Delivery Network (CDN). The content is often in the form of articles fed into framework controls to compose web applications such as blogs. In our use case the content is in the form of spatial data which are locations defined by their geometries and associated property values.</p><p>Data along with script and markup may be either retrieved from the <em>XYZ Host</em>, from 3rd party service providers or from a CDN. Content may be stored in <strong>GitHub</strong> repositories to be accessed via the <em>GitHub API</em>. Static assets which do not require to be rendered by the <em>XYZ Host</em> may be cached in a CDN such as <strong>JSDelivr</strong> and directly loaded into an <em>Application View</em>.</p><h4>Are dashboards dead?</h4><p><a href="https://twitter.com/tbrownlow3">Taylor Brownlow</a> wrote about the end of dashboards in <a href="https://towardsdatascience.com/dashboards-are-dead-b9f12eeb2ad2">this excellent article</a>. The argument for notebooks as the dashboard’s spiritual successor are valid and we are big fans of <a href="https://observablehq.com/">observable</a>, as well as <a href="https://count.co/">count</a>.</p><blockquote>We do want to have the power and flexibility to answer any question. We want to collaborate on, present, and share information. And we want to garner trust in the process by making the code itself as obvious and clearly visible as possible.</blockquote><p>These points are not only relevant to the data science within business and location intelligence processes but to the wider audience of open source developers.</p><p>These general requirements should not be defined by the form of the application interface. Whether we define a dashboard, notebook, or report, within the <em>XYZ</em> context we refer to these browser interfaces as <em>Application Views</em>.</p><h3>GitHub for Teams</h3><p><em>GitHub</em> is the obvious choice for all of our programming resources, whether they are HTML, JavaScript, or SQL.</p><p>Having been <em>GitHub pro</em> user for many years our team at GEOLYTIX got used to the ease of collaborating on and versioning of complex configurations stored in public and private repositories.</p><p>In April, <a href="https://github.blog/2020-04-14-github-is-now-free-for-teams/"><em>GitHub</em> introduced generous new pricing for all developers</a>. This allows us to provide the same capabilities for configuring <em>serverless</em> processes for free to everyone.</p><p><em>XYZ APIs</em> act as a headless Content Management System (CMS) to retrieve, cache, and serve content from <em>GitHub</em> for the <em>Application View JAMstack.</em></p><p>A <a href="https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token"><em>personal access token</em></a> may be provided as an environment secret to the <em>XYZ Host</em> processes. The token allows access to resources through the <a href="https://developer.github.com/v3/"><em>GitHub Rest API v3</em></a>. All resources as defined in a shared workspace, including the workspace itself as a JSON document will be cached by each of the <em>serverless</em> API functions. Thus requiring access to the API only after cold starts or when requested after a previously cached resource has been modified.</p><p>The transition from local to live is seamless. Having a <em>GitHub</em> repository cloned and open in VSCode we commit changes and use our remote resources for local development. With the data source never being local it does not matter whether the configuration is accessed remotely while running the XYZ Host a local <em>Node.js</em> process.</p><p>Locally we use <a href="https://github.com/expressjs/express"><em>Express</em></a> to develop and debug <em>XYZ APIs</em>. Each API however has been designed to be deployed as an <a href="https://aws.amazon.com/lambda"><em>AWS Lambda</em></a> via <em>Vercel</em>.</p><h3>[Zeit] Now / Vercel</h3><p><em>Zeit</em> (<a href="https://vercel.com/blog/zeit-is-now-vercel">recently rebranded as <em>Vercel</em></a>) abstract away the complexity of deploying to the <em>AWS Lambda</em> service directly. <a href="https://vercel.com/docs/runtimes#official-runtimes">Official runtimes</a> allow <a href="https://vercel.com/docs/v2/serverless-functions/introduction"><em>serverless functions</em> </a>access to the <a href="https://vercel.com/docs/runtimes#official-runtimes/node-js/node-js-request-and-response-objects"><em>Node.js</em> request and response objects</a>.</p><p>We refer to a <em>XYZ Host</em> deployed to <em>Vercel</em> as an <em>XYZ Instance</em>.</p><p>A <a href="https://vercel.com/docs/configuration#introduction/configuration-reference"><em>deployment configuration</em></a> allows the <em>domain layer</em> to route requests to individual functions. Each function being a <em>serverless</em> process with access to all good things Node 12 (e.g. ES6 module imports). Rewrites defined in the deployment configuration may route requests to external <em>XYZ Instances</em> using the same domain, e.g. <strong>geolytix.xyz</strong>.</p><p>The node process’ <a href="https://vercel.com/docs/v2/build-step#environment-variables"><em>environment variables</em></a> may be safely deployed with the <em>deployment configuration</em> or stored as secrets with <em>Vercel</em>.</p><p>Deployments are possible via a <a href="https://vercel.com/github"><em>GitHub integration</em></a> or through the <a href="https://vercel.com/download">CLI</a>. Once deployed, logs for each <em>serverless function</em> within an <em>XYZ Instance</em> may be accessed through <em>Vercel’s</em> website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XuMXyOsPYc1XZohRzMELUg.png" /><figcaption>A quick shout-out for the marvelous design by <a href="https://medium.com/u/9732b5410517">Evil Rabbit</a></figcaption></figure><h4>Did somebody say free?</h4><p>It may sound crazy, but <em>Vercel </em>is available from free. We are not directly affiliated with <em>Vercel</em> in any form but absolutely love their services. When we refactored the <em>XYZ APIs</em> as <em>serverless functions</em> we worked according to the <a href="https://vercel.com/docs/v2/platform/limits">platform limits</a> for hobby user.</p><h3>XYZ Templating</h3><p><em>XYZ APIs</em> use <em>templating</em> to prevent the client from making direct requests to the data source layer. <em>Transactional script</em> may be stored as SQL templates in a public <em>GitHub</em> repository. Each API process will cache the template as part of the workspace and substitute parameters received with requests before returning the database response to the <em>presentation layer</em>.</p><p>Parameter substitution in templates constitutes for the <em>server[less]side rendering</em> of dynamic <em>Application Views</em>.</p><p>Constituting for the <em>presentation layer, Application Views</em> are the primary user interface for <em>XYZ APIs</em>. Being able to develop, modify, and assign templates to production deployments of the API fits with the project’s policy on developer experience. We try to keep the language as vanilla as possible with a minimum of framework requirements. Being a small team of developers (three) we would be unable to invest in the development of utilities such as a <em>drag &amp; drop</em> to build dashboards.</p><p>There is currently an abundance of location intelligence platforms and many have intricate build interfaces such as <a href="https://carto.com/airship/"><em>Carto’s Airship</em></a>. These utilities are at level which would be unattainable by ourselves in this rat race. We try to keep our development workflow as simple and focused as possible. Microsoft/GitHub are nowadays beacons of open source development and have built integrated development environments (IDE) which many developers are already familiar with. We do not want to introduce new syntax or language unless absolutely necessary. From our personal experience the best experience for a web developer is the capability to use vanilla HTML, CSS, and JavaScript in a live environment to build engaging application interfaces. Similarly we want to give data scientists the capability to write a SQL whose result may be immediately presented as a map, chart, table, or raw JSON.</p><h3>Prototyping &amp; Development Workflow</h3><p>We are also big fans of coding sandboxes such as <a href="https://jsfiddle.net/">jsfiddle</a>, <a href="https://codepen.io/">codepen</a>, or <a href="https://codesandbox.io/">codesandbox</a>. These tools are invaluable for communicating issues and rapid prototyping.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fgoldrydigital%2Fn2fhvpqy%2Fembedded%2F&amp;display_name=jsFiddle&amp;url=https%3A%2F%2Fjsfiddle.net%2Fgoldrydigital%2Fn2fhvpqy%2Fembed%2Fresult%2Cjs%2Chtml%2Ccss&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/9aea1cedd4dd6980a9080e3fb4eeac4f/href">https://medium.com/media/9aea1cedd4dd6980a9080e3fb4eeac4f/href</a></iframe><p>The fiddle above shows a sample of the <em>Retail Points</em> data provided by GEOLYTIX. Once we are happy with the functionality we can push the markup and script into our public <em>GitHub</em> repository to be used as templates.</p><p>In <a href="https://github.com/GEOLYTIX/public/blob/master/geodata/geodata_single.html">this example markup template</a> the {dir} parameter is to be substituted. When requested from <em>XYZ View API</em> with URL parameter for the host, locale, and layers we receive the markup as HTML with the {dir} parameter substituted as ‘/geodata’ which is the path for the geodata instance on our development domain <strong>geolytix.dev</strong>.</p><blockquote><a href="https://geolytix.dev/geodata/view/geodata_single?host=https://geolytix.dev/geodata&amp;locale=London&amp;layers=Mapbox%20Base,Retail%20Points,Mapbox%20Label">geolytix.dev/geodata/view/geodata_single?host=https://geolytix.dev/geodata&amp;locale=London&amp;layers=Mapbox%20Base,Retail%20Points,Mapbox%20Label</a></blockquote><p>The geodata <em>Application View</em> may also be stored as a static asset by fixing {dir} and other template parameter in <a href="https://github.com/GEOLYTIX/public/blob/master/geodata/geodata_static.html">this HTML file</a>.</p><p>We use <em>GitHub Pages</em> to publish the public repository from its root. This allows us to open the static application view in a browser.</p><blockquote><a href="https://geolytix.github.io/public/geodata/geodata_static.html?host=https://geolytix.dev/geodata&amp;locale=London&amp;layers=Mapbox%20Base,Retail%20Points">geolytix.github.io/public/geodata/geodata_static.html?host=https://geolytix.dev/geodata&amp;locale=London&amp;layers=Mapbox%20Base,Retail%20Points</a></blockquote><p>The view from a template requested from the <em>XYZ View API</em> and the static view requested from <em>GitHub Pages</em> load the same script and request data from the same <em>XYZ host</em>.</p><p>The default <em>XYZ Application View</em> (MAPP) for the geodata instance can be requested from the root: <a href="https://geolytix.dev/geodata?layers=Mapbox%20Baselayer,Mapbox%20Labels,Retail%20Points&amp;locale=London&amp;lat=51.50729999999999&amp;lng=-0.12755&amp;z=12"><strong>geolytix.dev/geodata</strong></a></p><p>This workflow allows us to design and play with application views in a sandbox before committing code to a <em>GitHub</em> repository for publication without the need to redeploy our host. Views will be immediately available in production after a request to the <em>XYZ Workspace API</em> for all assets to be cached in all <em>serverless</em> API functions of this instance.</p><p>I hope this article may help you organizing your development workflow and perhaps will give you some ideas how to facilitate the best of <em>Vercel</em> &amp; <em>GitHub</em> for free. The <em>XYZ</em> project is free and open source and we are actively looking for developers who would like to contribute. Please feel free to contact me via twitter if there is anything in this article which you would like to discuss in more detail.</p><p><em>¹ While functionally similar, XYZ as referred to in this article is not affiliated with </em><a href="https://www.here.xyz/"><em>HERE XYZ</em></a><em>.</em></p><p>² Mathias Biilmann &amp; Phil Hawksworth; <em>Modern Web Development on the Jamstack</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92509a3db87d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geolytix/serverless-enterprise-application-architecture-for-the-jamstack-generation-with-zeit-now-vercel-92509a3db87d">Serverless Enterprise Application Architecture for the JAMstack generation with Zeit, Now Vercel…</a> was originally published in <a href="https://medium.com/geolytix">GEOLYTIX</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Turn your github documentation to eleventy.]]></title>
            <link>https://dbauszus.medium.com/turn-your-github-documentation-to-eleventy-82e9591b5a55?source=rss-b8939ac69d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/82e9591b5a55</guid>
            <category><![CDATA[documentation]]></category>
            <category><![CDATA[open-source-development]]></category>
            <category><![CDATA[eleventy]]></category>
            <category><![CDATA[tree-view]]></category>
            <category><![CDATA[github-pages]]></category>
            <dc:creator><![CDATA[Dennis Bauszus]]></dc:creator>
            <pubDate>Sat, 06 Jun 2020 14:51:01 GMT</pubDate>
            <atom:updated>2020-11-11T18:10:15.628Z</atom:updated>
            <content:encoded><![CDATA[<p>The success of your open source project and indeed any complex solution depends on good documentation. Writing documentation can be a real challenge, especially if you are too involved with a project from its inception. Knowing every detail you may fail to explain what is obvious to you and your team. In this article I want to discuss the technical aspects of documenting a GitHub repository.</p><p>Our project being an open source API and library for spatial data interfaces.</p><p><a href="https://github.com/GEOLYTIX/xyz">GEOLYTIX/xyz</a></p><h4>GitHub Pages — keeping it together</h4><p>Being Open Source in nature we only considered free hosting options. The documentation should also be a part of the code repository itself. <a href="https://pages.github.com/">GitHub Pages</a> are therefore the ideal solution for our needs. Within minutes the master branch can be hosted through a CDN; SSL certificate, meaningful URL, and batteries included.</p><p>While being able to assign a custom domain, we believe that the organisation @ github.io and the repository name as first URL path segment are already a great address for any documentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*_YZI0LYW4bHdap7GwlEe_g.png" /></figure><p>Building from the repository’s master branch also allows access to any of the incorporated resources via GitHub Pages as a CDN.</p><p>What’s left to do was to create a /docs directory full of compiled documentation pages.</p><h4>Eleventy — static site generator</h4><p>Written in Javascript, our programming language of choice, 11ty became quickly our favourite static site generator. With a minimum of feature bloat and dependencies, 11ty ticked all the boxes. We instantly liked the ease of configuration for a tool which turns markup into static web pages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*C2bBiBSHjWNbxEcZFjdmIA.gif" /></figure><p>A single <a href="https://github.com/GEOLYTIX/xyz/blob/master/eleventy/_includes/root.html">html root template</a> provides us with a responsive grid view to include navigation as well as content compiled from markup documents.</p><p>11ty was installed as a dev dependency since it is not required to deploy the compiler with the XYZ API itself. The html root template and individual markup documents are stored in the <a href="https://github.com/GEOLYTIX/xyz/tree/master/eleventy">eleventy folder</a>.</p><p>The eleventy package can be executed using npx:</p><p><em>npx eleventy — input ./eleventy — output ./docs — formats=md</em></p><p>This command would take all markdown files from the input directory and compile static pages with the provided root template in the output directory.</p><h4>Tree view navigation</h4><p>The XYZ API and library structure closely follow the organisation of javascript code in the repository. It was desired to have a tree view navigation for the documentation to be compiled from the organisation of markdown files in the ./eleventy input directory.</p><p>This was achieved with <a href="https://www.11ty.dev/docs/data-frontmatter/">11ty front-matter data</a> and the <a href="https://www.11ty.dev/docs/config/">.eleventy configuration</a>.</p><pre>---<br>title: XYZ<br>tags: [root, getting-started, workspace, develop, mapp]<br>layout: root.html<br>orderPath: /_index<br>---</pre><p>The front-matter allowed us to provide tags which should be shown in the tree view navigation and fine tune the order of documents. We did not want the order to be alphabetical alone. Certain articles are meant to be the first in a group. Prefixing the file name with an underscore in the orderPath would ensure that this article would be sorted ahead if compared with a regular filePath. The <a href="https://www.11ty.dev/docs/collections/">collection</a> sorting was handled in the .eleventy configuration.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9de1565b09e31602237181743fe53556/href">https://medium.com/media/9de1565b09e31602237181743fe53556/href</a></iframe><p>Furthermore we want to make sure that subsequent articles in a branch would be indented in the tree view. This would require some css to be derived from a level property. The base level could be derived by splitting the path on slashes. The penultimate element in the resulting path array being the branch. While iterating through the sorted collection of articles we store the current branch and reset the level by 1 if the branch changes, thus providing that the first article in a branch would have a superior level to its leaf articles.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d1526d547f435eeb43d54f6b296cf42e/href">https://medium.com/media/d1526d547f435eeb43d54f6b296cf42e/href</a></iframe><h4>XYZ</h4><p>This being setup, we just need to run now the eleventy compilation prior to committing changes to our master.</p><p>Voila — The latest version hosted through GitHub pages can be visited here:</p><h4><a href="https://geolytix.github.io/xyz/docs">https://geolytix.github.io/xyz/docs</a></h4><p>Us being fans of minimum design; I am rather happy with the result…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*Ap8W5KGV8_-MzzPQ8dB8yQ.png" /></figure><p>This being said… Massive thanks to <a href="https://twitter.com/zachleat">Zach Leatherman</a> and the <a href="https://twitter.com/eleven_ty">Eleventy team</a>. You are truly helping keeping Open Source ahead.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82e9591b5a55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing a logo for FOSS4G 2021 in Buenos Aires]]></title>
            <link>https://dbauszus.medium.com/designing-a-logo-for-foss4g-2021-in-buenos-aires-43242cbefd80?source=rss-b8939ac69d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/43242cbefd80</guid>
            <category><![CDATA[logo-design]]></category>
            <category><![CDATA[open-source-software]]></category>
            <category><![CDATA[foss4g]]></category>
            <dc:creator><![CDATA[Dennis Bauszus]]></dc:creator>
            <pubDate>Tue, 26 May 2020 18:33:20 GMT</pubDate>
            <atom:updated>2020-05-26T18:33:20.412Z</atom:updated>
            <content:encoded><![CDATA[<p>Reading this today you will already know that the FOSS4G event in Calgary had to be cancelled due to the ongoing COVID-19 crisis. But after each FOSS4G is always before the next. This being in Buenos Aires in 2021 is all very exciting. <strong>Vamos a Argentina!</strong></p><p>While it is hard to wait this long there are now even more chances to get involved. On such opportunity is the annual competition for an event logo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RGUSfUFjzJp90CtMASFPUQ.png" /></figure><p>Please visit the <a href="https://wiki.osgeo.org/wiki/FOSS4G_2021/Logo_Contest">competition page</a> for details and guidelines.</p><p>I quite like to wear my conference shirts at events such as London <a href="https://twitter.com/geomob">Geomobs</a> or in the office, back when going to the office was still a thing. In previous years I would have been busy working on a presentation or workshop at this time of the year. I always wanted to enter the logo competition though, if only given the time. This could be the year.</p><p>First a quick look at all the previous FOSS4G events and their logos. It’s quite a mixed bag and I am sure everyone has their favourites. Personally I like the Boston logo best.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o6KHPd3854yFj0bF9V7Rng.png" /></figure><p>The Boston layout works just so well across different mediums.</p><h4>What kind of monuments has Buenos Aires to offer though?</h4><p>Recommendations included the obelisco, the <a href="https://en.wikipedia.org/wiki/Puente_de_la_Mujer">women’s bridge</a>, <a href="https://en.wikipedia.org/wiki/Floralis_Gen%C3%A9rica">a metal flower sculpture</a>, the <a href="https://en.wikipedia.org/wiki/Galileo_Galilei_Planetarium">planetarium</a>, and tango. Tango? I can neither dance nor draw well, so that one is out of the question. The metal flower is cool but also hard to draw. <a href="https://en.wikipedia.org/wiki/Galileo_Galilei_Planetarium">Now the planetarium is quite something</a>. Named after Galileo Galilei I couldn’t imagine a better fitting symbol for a geographers’ conference. Plus, my limited Inkscape skills allows me to sketch the principal saucer like features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*jwSBDxSxsVF3biCahmuauQ.png" /></figure><p>Next to the mandatory FOSS4G banner I added the flag of <a href="https://en.wikipedia.org/wiki/Buenos_Aires_Province">Buenos Aires province</a>, the sun face from the <a href="https://en.wikipedia.org/wiki/Flag_of_Argentina">flag of Argentina</a>, the city’s <a href="https://en.wikipedia.org/wiki/Coat_of_arms_of_Buenos_Aires">coat of arms</a>, and the <a href="https://en.wikipedia.org/wiki/Crux">southern cross</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*UaWAj84JMU330mNbjl_DRA.png" /></figure><p>I especially liked the dove from the coat of arms as a representation of the free / libre principle in open source projects.</p><p>But now I had some big decision to make…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*h1Uy1bJatENUhysjt2fBUQ.gif" /></figure><p>I am fairly happy with two of my designs, even though I couldn’t place the dove without overloading the design. Here is were you come in. Any feedback prior to me submitting either or both designs will help me a lot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7tSl1-oVjvD2zDk6ABbcXA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hl3MkhteuUdroY37LlT8gg.png" /></figure><h4>Which do you like best and why?</h4><p>Thanks again for your time and thank you for supporting free and open source software 4 geography.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43242cbefd80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bringing spatial interfaces to Zeit’s Now v2 platform]]></title>
            <link>https://dbauszus.medium.com/bringing-spatial-interfaces-to-zeits-now-v2-platform-d14d05faa9c?source=rss-b8939ac69d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/d14d05faa9c</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[zeit-now]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Dennis Bauszus]]></dc:creator>
            <pubDate>Sat, 07 Mar 2020 18:05:26 GMT</pubDate>
            <atom:updated>2020-03-07T18:26:40.716Z</atom:updated>
            <content:encoded><![CDATA[<p>I have previously written about <a href="https://geolytix.co.uk/">GEOLYTIX</a>’ work to <a href="https://medium.com/geolytix/the-zeit-is-now-for-serverless-web-mapping-77edebfaf17e">make spatial interfaces serverless with Zeit’s Now platform</a>. Soon after I published that article, <a href="https://zeit.co/blog/now-2">Zeit introduced the second coming of their Now cloud platform</a> for static sites and <em>Serverless Functions</em>. Everything changed and we had to go with the flow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TOSyZebGsKLJ5s0P.png" /></figure><p><strong>Now Again with Serverless Function</strong></p><p>Being able to deploy <a href="https://zeit.co/docs/v2/serverless-functions/introduction">functions</a> written for the <a href="https://zeit.co/docs/runtimes#official-runtimes/node-js">Node.js runtime</a> allowed us to break up the XYZ web server into individual handler for each endpoint. Once build, each handler will be a <em>Serverless Function</em> in an immutable deployment hosted as a Zeit <a href="https://zeit.co/docs/v2/platform/projects">Project</a>. <a href="https://zeit.co/docs/v2/network/regions-and-providers">Zeit uses regional AWS cloud services as origin for <em>Serverless Functions</em> as well as the Google Cloud Platform to provide edge caching for static content in the Zeit CDN</a>.</p><p><strong>Benefits</strong></p><p>Abstracting away cloud providers improves resilience with a minimum off fuss by not having to deal with different cloud consoles. Having no servers to maintain while further reducing NoOps costs makes the Zeit Now platform the most reasonable choice for GEOLYTIX’ cloud services. As of March ’20, <a href="https://zeit.co/pricing">Zeit even offer a free tier for hobbyists</a>.</p><blockquote>Reducing cost is at the heart of going serverless. Whether it is the price of <a href="https://en.wikipedia.org/wiki/Bare-metal_server">Metal</a>, DevOps or redundant uptime.</blockquote><p><strong>From serverful to serverless function handler</strong></p><p>The legacy serverful behavior was to deploy a code repository to Zeit and let the Node.js runtime build and subsequently run a Fastify web server. Serverful deployments were scaled to have a minimum 1 instance running at all times due to the associated startup time of 10+ seconds. We barely ever needed to scale up services with most instances only being frequently used by individual users. A vast majority of requests being directed at only a handful of endpoints providing data for map view change events. Breaking up the web server into individual function handlers for each endpoint was a logical step towards a pay-per-use interface for spatial data.</p><p>With all transformations and calculations being handled by the database backend our primary performance concern was the memory footprint of each handler and the ability to quickly scale functions for frequent synchronous requests.</p><p>There is an excellent article by Brooks Mikkelsen which lists the benefits of a serverless REST API and how to design a HTTP server for Zeit Now.</p><p>👉 <a href="https://medium.com/@bmikkelsen22/designing-a-serverless-express-js-api-using-zeit-now-6e52aa962235">Designing a Serverless Express.js API using Zeit Now</a></p><p><strong>Node.js HTTP server</strong></p><p>The <a href="https://github.com/zeit/now/blob/master/packages/now-node/src/index.ts">now/node builder</a> provides the <a href="https://nodejs.org/api/http.html#http_class_http_incomingmessage">IncomingMessage</a> and <a href="https://nodejs.org/api/http.html#http_class_http_serverresponse">ServerResponse</a> from the <a href="https://nodejs.org/api/http.html#http_http">node HTTP server</a> as parameter types to the module export function from each endpoint handler.</p><p><strong>Middleware / Endpoint authentication</strong></p><p>The Zeit Now CLI and now/node builder are still in beta and some capabilities are yet to be documented and tested in anger. At the time of moving our project from v1 to v2 it was not entirely clear how to use Express middleware with the now/node builder. In order to secure the <a href="https://restfulapi.net/">REST API</a> we built our own authentication logic to intersect all incoming requests. Being <a href="https://restfulapi.net/statelessness/">stateless</a>, each private request must bear a signed token to be validated by a <a href="https://github.com/auth0/node-jsonwebtoken#readme">node implementation of jsonwebtoken</a>.</p><p>The root handler for our API should return an application view template (html) from the API.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6869f4f14291756fccd462e914062f06/href">https://medium.com/media/6869f4f14291756fccd462e914062f06/href</a></iframe><p>Outside the <em>async</em> module exports function we define the authentication module. The <em>auth</em> module will validate a signed IncomingMessage (<em>req</em>) token and finish the ServerResponse (<em>res</em>) by sending a 4** status code to the client. This would occur if a token has expired. Public endpoints do not require a token. The <em>auth</em> module will respond with a login view if a token is required to access private endpoints.</p><p><strong>Configuration Caching and RDS Connection Pooling</strong></p><p>In order to cache configuration objects and templates we define a <em>const</em> object and an <em>async</em> method to retrieve the templates object outside the handler.</p><p>The <em>async</em> module function to retrieve templates will await for all templates to be loaded from local scripts, database or 3rd party service providers before returning the result to the endpoint. A module should resolve immediately with resources such as the API <em>workspace</em> being cached outside the exported module method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/28e7fb2fd0ba7db20d831c56643ff045/href">https://medium.com/media/28e7fb2fd0ba7db20d831c56643ff045/href</a></iframe><p>The endpoint will await for the templates to be retrieved and assign the returned <em>templates</em> object to the <em>const</em> defined outside the handler.</p><p>Modules may require database connection methods. We use <a href="https://node-postgres.com/">node postgres</a> <a href="https://node-postgres.com/features/pooling">connection pooling</a> for queries to connected databases. The connection pools are also cached outside the module handler.</p><p>The following endpoint will cache database connection pools <em>dbs</em> and a <em>layers</em> configuration object outside the handler.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a27469775a4dbc6fa3a064f01a20008/href">https://medium.com/media/5a27469775a4dbc6fa3a064f01a20008/href</a></iframe><p>The layer will be queried from a <a href="https://postgis.net/">PostGIS</a> table if a request passes authentication. Data will then be sent as geoJSON to the client.</p><p><strong>Routing with now.json rewrites, builds, and headers</strong></p><p>The now.json configuration defines build scripts for endpoints, HTTP request/response headers, and route rewrites for deployments to the Zeit now platform.</p><p>Environment variables defined in the now.json allow <em>node postgres</em> to create connection pools.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dba5a26041af8df397a773623943be95/href">https://medium.com/media/dba5a26041af8df397a773623943be95/href</a></iframe><p><a href="https://zeit.co/docs/configuration#project/builds"><em>Builds</em></a> define a path directory routing structure where the <em>root.js</em> module script in the <strong><em>/</em>api</strong> directory will be accessible via <strong>host:3000/api/root</strong></p><p>Routing can be further defined by using <a href="https://zeit.co/docs/configuration#project/rewrites"><em>rewrites</em></a>.</p><p><a href="https://zeit.co/docs/configuration#project/headers">Headers</a> allow us provide additional security headers for all API endpoints.</p><p><strong>Debugging in VScode with express.js</strong></p><p>Using <a href="https://zeit.co/docs/now-cli#commands/dev"><em>now dev</em></a> allows to locally build and serve the API. Logs and Error messages will be sent to the terminal console. Debugging methods with breakpoints and variable inspection in VScode is currently not possible with <em>now dev</em>.</p><p>node http server methods used by the now/node builder are fairly similar to the same server methods in <a href="https://expressjs.com/">express.js</a>.</p><p>We can create an <em>express</em> server script to host the same endpoints. If launched in a VScode debug session we can use all the <em>code</em> debug tools.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d24a3efc4d8016ecb6abd2e811503bf5/href">https://medium.com/media/d24a3efc4d8016ecb6abd2e811503bf5/href</a></iframe><p><strong>Deploying</strong></p><p>The API may be deployed to the cloud by providing the now.json to the <a href="https://zeit.co/docs/now-cli#introduction/now-cli-reference">Zeit now CLI</a>.</p><p>👏 👏 👏</p><p>I hope this article will be helpful for you if you are building a <em>serverless</em> REST API. This may also provide a better understanding of the Open Source <a href="https://github.com/GEOLYTIX/xyz/tree/development">XYZ framework</a>. It certainly will help myself to get feedback which I can feed back into the <a href="https://geolytix.github.io/xyz/">XYZ documentation</a>.</p><p>Big thanks to <a href="https://twitter.com/paulogdm">@paulogdm</a> and the <a href="https://twitter.com/zeithq">@zeithq</a> team for all the help along the way. It must have taken us a dozen or more Spectrum posts to get here.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d14d05faa9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Add search to your Ghost blog]]></title>
            <link>https://dbauszus.medium.com/add-search-to-your-ghost-blog-cb23db9cb56d?source=rss-b8939ac69d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb23db9cb56d</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[search]]></category>
            <category><![CDATA[blog]]></category>
            <category><![CDATA[ghost-blog]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Dennis Bauszus]]></dc:creator>
            <pubDate>Thu, 21 Nov 2019 17:08:35 GMT</pubDate>
            <atom:updated>2019-11-21T17:12:52.846Z</atom:updated>
            <content:encoded><![CDATA[<p>A couple of weeks ago, roughly around the time when the Prime Minister of the UK promised to do the very same to himself, we finally ditched Wordpress.</p><p>Maintaining Wordpress has been a huge pain for us as an organisation and for me personally since I am not a big fan of php, Apache Tomcat, mySQL and monolith architectures in general. We were running our own Digital Ocean droplet having to renew the Let’s Encrypt certificate ever so often. Or as Kevin puts it, ‘<a href="https://nehalist.io/why-im-not-the-biggest-wordpress-fan/">Why I’m not the biggest Wordpress fan</a>’.</p><p>Moving to Ghost was a breath of fresh air. Using Javascript throughout made me feel immediately comfortable. Sure there were some teething problems but nothing which we weren’t able to overcome. With the no fuss Ghost(pro) option we were up and running in no time.</p><blockquote><a href="https://blog.geolytix.net/">blog.geolytix.net</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZMzknejr0YXnW9i7q2LMVA.png" /></figure><p>At this stage I read that <a href="https://nehalist.io/why-i-dont-like-the-ghost-blogging-platform-anymore/">Kevin isn’t a fan of Ghost no more</a>. All valid points in that article. Myself, I would like to add that the use of jQuery in the default casper theme is shocking. But I was most surprised to find out that there is sort of <strong>no default search on the Ghost platform</strong>.</p><p>Though there are some open source solutions out there. I looked at <a href="https://github.com/electronthemes/ghost-finder">ghost-finder</a>, <a href="https://github.com/HauntedThemes/ghost-search">ghost-search</a>, or <a href="https://github.com/jamalneufeld/ghostHunter">ghostHunter</a>. I wasn’t too much taken by any of these. Being fairly competent at writing Javascript I decided to roll my own search by using the <a href="https://ghost.org/docs/api/v3/content/">Ghost Content API</a>. — Why is this not integrated in Ghost by default? Then again jQuery; Really?</p><p>Anyhow. Here is our search input on it’s own.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fdbauszus-glx%2Fembed%2Fpreview%2FoNNVMxx%3Fheight%3D600%26slug-hash%3DoNNVMxx%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2Fdbauszus-glx%2Fpen%2FoNNVMxx&amp;image=https%3A%2F%2Fscreenshot.codepen.io%2F2947706.oNNVMxx.small.d57859f0-b74a-4d3a-b3d2-8769d5160ccd.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/645bc7d5de28ec2decae5aa8a3cf2812/href">https://medium.com/media/645bc7d5de28ec2decae5aa8a3cf2812/href</a></iframe><p>We just added the input to the navigation bar in a local Ghost instance and upload this modified Casper theme to our hosted Ghost(pro).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*77FHp2mPcNUestlAdwRrow.png" /></figure><p>It’s also possible to add the input dynamically with a bit of script magic, but I’ll leave this to you as you might not want the input in the nav-right, or you may not even use the Casper theme.</p><p>A custom integration key was needed to connect the Content API with our Ghost host. We are only interested in the Content API key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*fal0rrXlSvQkhisa3VcXFw.png" /></figure><p>Did I mention that Content API must be imported into your hosted Ghost.</p><p>Let’s put the styles (for the input and drop down) and the script import in the ghost header.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*L3r8-nqMmYca-kdTsixP5Q.png" /></figure><p>The script as shown in the codepen goes into the Footer…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*Bmv2R3kg5ynGdNZ_4HLsmw.png" /></figure><p>That’s that.</p><p>As for the script itself. We load the title, url, and html content of our Ghost blog as data and pass this to the search function. The keyup event of the input form will split the search term by spaces and count matches in the html data. We sort the resulting array by combined occurrence count and display the top 5 results as title with with the URL as href in the results list.</p><p>EZ.</p><p>This wasn’t actually my first attempt. Prior to looking into the Ghost Content API I built a solution based on a Google Custom Search Engine (CSE). I got the idea from <a href="https://medium.com/@tony.m.pdx/adding-google-custom-search-to-a-headless-ghost-blog-with-a-react-redux-front-end-b8b79b6dfff7">this Medium article</a>.</p><p>Here is a working codepen for the same blog using a Google CSE.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fdbauszus-glx%2Fembed%2Fpreview%2FabbMOXe%3Fheight%3D600%26slug-hash%3DabbMOXe%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2Fdbauszus-glx%2Fpen%2FabbMOXe&amp;image=https%3A%2F%2Fscreenshot.codepen.io%2F2947706.abbMOXe.small.65397c12-3d08-494a-ac3e-ac7ab2097630.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/feb38170523218b6b6a4e9d8b4e7a6f7/href">https://medium.com/media/feb38170523218b6b6a4e9d8b4e7a6f7/href</a></iframe><p>I hope some of you may find this helpful.</p><p>Happy blogging.</p><p>Dennis</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb23db9cb56d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What the hex? Grid aggregations with PostGIS]]></title>
            <link>https://medium.com/geolytix/what-the-hex-grid-aggregations-with-postgis-a7d5feaec442?source=rss-b8939ac69d9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7d5feaec442</guid>
            <category><![CDATA[spatial-analysis]]></category>
            <category><![CDATA[hexagon]]></category>
            <category><![CDATA[postgis]]></category>
            <category><![CDATA[data-aggregation]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Dennis Bauszus]]></dc:creator>
            <pubDate>Sat, 19 Oct 2019 13:42:37 GMT</pubDate>
            <atom:updated>2019-10-19T13:42:37.146Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<p>I have previously written about <a href="https://medium.com/@goldrydigital/cluster-f-x-nesting-postgresql-kmeans-in-dbscan-for-responsive-maps-9ed99590a439">cluster algorithms</a> and <a href="https://medium.com/@goldrydigital/hex-grid-algorithm-for-postgis-4ac45f61d093">hex grid algorithms for PostGIS</a>. Today I want to present on the fly data aggregation algorithm for regular tessellation grids (square and hexagonal).</p><p>Aggregating data to a regular grid has been inspired by the work of Javier Goizueta for <a href="https://twitter.com/CARTO">Carto</a>. Please read Javier’s blog post on <a href="https://carto.com/blog/tile-aggregation">aggregating data for faster map tiles</a>.</p><p>Based on the current XYZ zoom level (_z) of the viewport we can define the grid resolution based on the length of the equator (40075016.68m). An additional _resolution factor can be introduced in order to control the spacing of grid cells at the given zoom level.</p><p>With a calculated grid cell size _r (width as well as height of a square grid cell) we can round sample point coordinates to the centroid of the containing grid cell.</p><p>Sample points within the same grid cell are grouped and the position of the cluster coordinate can either be defined as the centroid, a point on the surface of a union geometry, or in this case as the 0.5 percentile of an ordered array for x and y values.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/71d7b3ee41207f880c42ab965d798404/href">https://medium.com/media/71d7b3ee41207f880c42ab965d798404/href</a></iframe><p>We have loaded sample points from the <a href="http://landregistry.data.gov.uk/app/ppd">HM Land Registry Price Paid Dataset</a> into a PostGIS database for testing. Using a cloud hosted instance of GEOLYTIX’ XYZ engine for which this algorithm was developed we are able to aggregate a large set of points to a grid.</p><p>We use a bi-variate theme with the size of symbols representing the count of sample points in each cluster and the colour representing the average house price.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fjsfiddle.net%2Fgoldrydigital%2Fkycnovzw%2Fembedded%2Fresult%2Cjs&amp;src=https%3A%2F%2Fjsfiddle.net%2Fgoldrydigital%2Fkycnovzw%2Fembedded%2Fresult%2Cjs&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/65f3d3f23d74b0b43da84412eb1a8c32/href">https://medium.com/media/65f3d3f23d74b0b43da84412eb1a8c32/href</a></iframe><p>Aggregation to a grid with a regular hexagonal tessellation is somewhat more involved.</p><p>At first we create a surface tessallation from rectangles which represent hexagonal grid cells. The resolution _r is the width of a grid cell and the height is defined as:</p><blockquote>_r — ( ( _r * 2 / sqrt(3) ) — _r) / 2;</blockquote><p>Every second row is shifted by half the rectangles width.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*QYj-tjh6q5kqzsjrb8kh6w.png" /></figure><p>By checking whether the remainder of the round y coordinate is an odd number we know whether the row should be shifted.</p><p>The rounding defines a p0 coordinate which must be checked for neighbouring grid cells.</p><p>Even row p0 must be checked for neighbouring cells at the four quadrants.</p><p>Odd row p0 (shifted) must be checked for the adjacent cell to the left as well as the two adjacent cells which touch these.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*MvKm_ZQ4OVLnpxbyTPQBTQ.png" /></figure><p>Using PostgreSQL case statements we first check the odd rows in the following order. The cluster coordinate is the grid cell with the closest distance to the sample point coordinate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*T9F_eKFJkSKzFcSa9B6Rpw.png" /></figure><p>Next we check the four adjacent quadrant cells of the even rows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*2QtfG3FDbf4TvNN0mX_FuQ.png" /></figure><p>The complete select statement can be found in this GIST.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4e1710a29dc73bf4db3d0f6a7479fdc/href">https://medium.com/media/d4e1710a29dc73bf4db3d0f6a7479fdc/href</a></iframe><p>We implemented the algorithm in v2 of the XYZ spatial data interface and present a similar themed hex grid aggregation in the this fiddle.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fjsfiddle.net%2Fgoldrydigital%2F214ofdqh%2Fembedded%2Fresult%2Cjs&amp;src=https%3A%2F%2Fjsfiddle.net%2Fgoldrydigital%2F214ofdqh%2Fembedded%2Fresult%2Cjs&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c16f4d336c108a7a979bf3bb3f31158/href">https://medium.com/media/0c16f4d336c108a7a979bf3bb3f31158/href</a></iframe><p>I hope some of you will find this helpful.</p><p>Please check back for detailed XYZ v2 release notes soon.</p><p>Special thanks again to Javier for doing the ground work and to GEOLYTIX for funding this research and keeping XYZ a FOSS project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7d5feaec442" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geolytix/what-the-hex-grid-aggregations-with-postgis-a7d5feaec442">What the hex? Grid aggregations with PostGIS</a> was originally published in <a href="https://medium.com/geolytix">GEOLYTIX</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>