Update documentation

This commit is contained in:
Alexis Métaireau 2023-11-11 21:40:31 +01:00
parent c4994114b4
commit 2dc67b7244

View file

@ -38,7 +38,6 @@
<p>Last week, I&#8217;ve been lucky to start working on <a href="https://github.com/umap-project/umap/">uMap</a>, an open-source map-making tool to create and share customizable maps, based on Open Street Map&nbsp;data.</p> <p>Last week, I&#8217;ve been lucky to start working on <a href="https://github.com/umap-project/umap/">uMap</a>, an open-source map-making tool to create and share customizable maps, based on Open Street Map&nbsp;data.</p>
<p>My goal is to add real-time collaboration to uMap, but <strong>we first want to be sure to understand the issue correctly</strong>. There are multiple ways to solve this, so one part of the journey is to understand the problem properly (then, we&#8217;ll be able to chose the right path&nbsp;forward).</p> <p>My goal is to add real-time collaboration to uMap, but <strong>we first want to be sure to understand the issue correctly</strong>. There are multiple ways to solve this, so one part of the journey is to understand the problem properly (then, we&#8217;ll be able to chose the right path&nbsp;forward).</p>
<p>Part of the work is documenting it, so expect to see some blog posts around this in the&nbsp;future.</p> <p>Part of the work is documenting it, so expect to see some blog posts around this in the&nbsp;future.</p>
<p>Also, this is made possible via the generous help of <a href="http://scopyleft.fr/">ScopyLeft</a>, so thanks to&nbsp;them!</p>
<h2 id="installation">Installation</h2> <h2 id="installation">Installation</h2>
<p>I&#8217;ve started by installing uMap on my machine, made it work and read the codebase. uMap is written in Python and Django, and using old school Javascript, specifically using the Leaflet library for <span class="caps">SIG</span>-related&nbsp;interface.</p> <p>I&#8217;ve started by installing uMap on my machine, made it work and read the codebase. uMap is written in Python and Django, and using old school Javascript, specifically using the Leaflet library for <span class="caps">SIG</span>-related&nbsp;interface.</p>
<p>Installing uMap was simple. On a&nbsp;mac:</p> <p>Installing uMap was simple. On a&nbsp;mac:</p>
@ -99,12 +98,12 @@ the current code&nbsp;base.</p>
<li>The actual rendering and modifications of the map are directly done in JavaScript, on the&nbsp;clients.</li> <li>The actual rendering and modifications of the map are directly done in JavaScript, on the&nbsp;clients.</li>
</ul> </ul>
<p>The data is split in multiple layers. At the time of writing, concurrent writes to the same layers are not possible, as one edit would potentially overwrite the other one. It&#8217;s possible to have concurrent edits on different layers,&nbsp;though.</p> <p>The data is split in multiple layers. At the time of writing, concurrent writes to the same layers are not possible, as one edit would potentially overwrite the other one. It&#8217;s possible to have concurrent edits on different layers,&nbsp;though.</p>
<p>When a change occurs, <a href="https://github.com/umap-project/umap/blob/master/umap/views.py#L917-L948">each <code>DataLayer</code> is sent by the client to the server</a>.</p> <p>When a change occurs, <a href="https://github.com/umap-project/umap/blob/c16a01778b4686a562d97fde1cfd3433777d7590/umap/views.py#L917-L948">each <code>DataLayer</code> is sent by the client to the server</a>.</p>
<ul> <ul>
<li>The data is updated on the&nbsp;server.</li> <li>The data is updated on the&nbsp;server.</li>
<li><strong>If the data has been modified by another client</strong>, an <code>HTTP 422 (Unprocessable Entity)</code> status is returned, which makes it possible to detect conflicts. The users are prompted about it, and asked if they want to overwrite the&nbsp;changes.</li> <li><strong>If the data has been modified by another client</strong>, an <code>HTTP 422 (Unprocessable Entity)</code> status is returned, which makes it possible to detect conflicts. The users are prompted about it, and asked if they want to overwrite the&nbsp;changes.</li>
<li>The files are stored as geojson files on the server as <code>{datalayer.pk}_{timestamp}.geojson</code>. <a href="https://github.com/umap-project/umap/blob/master/umap/models.py#L426:L426">A history of the last changes is preserved</a> (The default settings preserves the last 10&nbsp;revisions).</li> <li>The files are stored as geojson files on the server as <code>{datalayer.pk}_{timestamp}.geojson</code>. <a href="https://github.com/umap-project/umap/blob/c16a01778b4686a562d97fde1cfd3433777d7590/umap/models.py#L426-L433">A history of the last changes is preserved</a> (The default settings preserves the last 10&nbsp;revisions).</li>
<li>The data is stored <a href="https://github.com/umap-project/umap/blob/master/umap/static/umap/js/umap.js#L158-L163">in a Leaflet object</a> and <a href="https://github.com/umap-project/umap/blob/master/umap/static/umap/js/umap.js#L1095:L1095">backups are made manually</a> (it does not seem that changes are saved&nbsp;automatically).</li> <li>The data is stored <a href="https://github.com/umap-project/umap/blob/c16a01778b4686a562d97fde1cfd3433777d7590/umap/static/umap/js/umap.js#L158-L163">in a Leaflet object</a> and <a href="https://github.com/umap-project/umap/blob/c16a01778b4686a562d97fde1cfd3433777d7590/umap/static/umap/js/umap.js#L1095:L1095">backups are made manually</a> (it does not seem that changes are saved&nbsp;automatically).</li>
</ul> </ul>
<h3 id="data">Data</h3> <h3 id="data">Data</h3>
<p>Each layer consists&nbsp;of:</p> <p>Each layer consists&nbsp;of:</p>
@ -195,7 +194,7 @@ features we&nbsp;want.</p>
<p>o <strong>If the target location specifies an object member that does exist, <p>o <strong>If the target location specifies an object member that does exist,
that member&#8217;s value is&nbsp;replaced.</strong></p> that member&#8217;s value is&nbsp;replaced.</strong></p>
</blockquote> </blockquote>
<p>It seems to bad for us, as in our case this will happen each time a new feature is added to the feature&nbsp;collection.</p> <p>It seems too bad for us, as this will happen each time a new feature is added to the feature&nbsp;collection.</p>
<p>It&#8217;s not working out of the box, but we could probably hack something together by having all features defined by a unique id, and send this to the server. We wouldn&#8217;t be using vanilla <code>geojson</code> files though, but adding some complexity on top of&nbsp;it.</p> <p>It&#8217;s not working out of the box, but we could probably hack something together by having all features defined by a unique id, and send this to the server. We wouldn&#8217;t be using vanilla <code>geojson</code> files though, but adding some complexity on top of&nbsp;it.</p>
<p>At this point, I&#8217;ve left this here and went to experiment with the other ideas. After all, the goal here is not (yet) to have something functional, but to clarify how the different options would play&nbsp;off.</p> <p>At this point, I&#8217;ve left this here and went to experiment with the other ideas. After all, the goal here is not (yet) to have something functional, but to clarify how the different options would play&nbsp;off.</p>
<h3 id="using-crdts">Using&nbsp;CRDTs</h3> <h3 id="using-crdts">Using&nbsp;CRDTs</h3>