<?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[Geoman.io - Blog - Medium]]></title>
        <description><![CDATA[The Blog of Geoman — Visualize, Manage and Serve your Geospatial Data (GIS) - Medium]]></description>
        <link>https://medium.com/geoman-blog?source=rss----eadd6967ac4---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Geoman.io - Blog - Medium</title>
            <link>https://medium.com/geoman-blog?source=rss----eadd6967ac4---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 14:14:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/geoman-blog" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How do edit adjacent polygons accurately and efficiently]]></title>
            <link>https://medium.com/geoman-blog/professional-applications-using-geospatial-data-often-require-an-entire-city-country-or-other-area-91e50cce640?source=rss----eadd6967ac4---4</link>
            <guid isPermaLink="false">https://medium.com/p/91e50cce640</guid>
            <category><![CDATA[leaflet]]></category>
            <category><![CDATA[mapping]]></category>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[geojson]]></category>
            <category><![CDATA[geospatial]]></category>
            <dc:creator><![CDATA[Sumit Kumar]]></dc:creator>
            <pubDate>Mon, 13 Jul 2020 10:37:25 GMT</pubDate>
            <atom:updated>2020-07-13T10:41:56.511Z</atom:updated>
            <content:encoded><![CDATA[<p>Professional applications using geospatial data often require an entire city, country or other area to be split into many smaller GeoJSON polygons. All these polygons combined should cover the entire area of the map without overlapping parts of gaps Which can make editing them a cumbersome process. Not anymore.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*yPxpw38slk0phmUW6vWoGQ.gif" /></figure><p>When drawn accurately with tools like Leaflet-Geoman, adjacent polygons share coordinates at their corners. With <a href="https://geoman.io/blog/pinning-now-in-leaflet-geoman-pro">Leaflet-Geoman Pros Pinning-Feature</a>, you can pin those coordinates together. The result is, you can move entire borders between adjacent polygons in one go, without having to re-align any of the adjacent polygons by hand.</p><p>Just activate the pinning option and start editing – your adjacent polygons will stick together, continuously cover the entire area without gaps or overlaps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*WSpiPDHUzu1y865A_CnCEQ.gif" /></figure><p>With Pinning, workflows for administrators of geospatial data are getting simpler and save hours of time when editing geospatial data. Leaflet-Geoman Pro, a plugin for Leaflet to create and edit geospatial data directly on the map, offers many time-saving and easy-to-use tools for GeoJSON manipulation. <a href="https://geoman.io/geojson-editor">Try it in out online GeoJSON-Editor</a>, or check out our <a href="https://geoman.io/leaflet-geoman">libraries for developers</a>.</p><p><a href="https://geoman.io/">Geoman.io</a> creates tools for developers and geo-admins to create and manipulate GeoJSON directly on the map.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91e50cce640" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geoman-blog/professional-applications-using-geospatial-data-often-require-an-entire-city-country-or-other-area-91e50cce640">How do edit adjacent polygons accurately and efficiently</a> was originally published in <a href="https://medium.com/geoman-blog">Geoman.io - Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Handle Circles in GeoJSON]]></title>
            <link>https://medium.com/geoman-blog/how-to-handle-circles-in-geojson-d04dcd6cb2e6?source=rss----eadd6967ac4---4</link>
            <guid isPermaLink="false">https://medium.com/p/d04dcd6cb2e6</guid>
            <category><![CDATA[mapbox]]></category>
            <category><![CDATA[geospatial-data]]></category>
            <category><![CDATA[leaflet]]></category>
            <category><![CDATA[geojson]]></category>
            <category><![CDATA[geoman]]></category>
            <dc:creator><![CDATA[Sumit Kumar]]></dc:creator>
            <pubDate>Wed, 02 Jan 2019 12:39:50 GMT</pubDate>
            <atom:updated>2019-01-02T12:52:14.681Z</atom:updated>
            <content:encoded><![CDATA[<p>A common problem of using GeoJSON with interactive mapping libraries like <a href="https://leafletjs.com/">Leaflet</a> is the difference of supported shapes. Leaflet has an L.Circle class while GeoJSON does not support circles. Here is how we handle it in <a href="https://geoman.io/">Geoman</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tI1AXo-lkjvyr2VTTNjCcA.gif" /><figcaption>Geoman handles GeoJSON circles perfectly fine</figcaption></figure><p>When you store your GeoJSON in your database, .geojson-file or anything else you have to transform the layer into GeoJSON. A Leaflet circle transformed to geojson will simply be a point with one coordinate pair. Putting that back into Leaflet will give you a Marker as the radius information was lost. So, let’s store it. You can extract the radius of the circle layer and store it inside the custom properties of a GeoJSON. Using Leaflet, it could look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3edf3f638711c85b7b7d8ff1243e0e0d/href">https://medium.com/media/3edf3f638711c85b7b7d8ff1243e0e0d/href</a></iframe><p>The resulting json has all the information we need to create a circle in the next step:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd87527fab287a55446fce6d77d9a8cf/href">https://medium.com/media/fd87527fab287a55446fce6d77d9a8cf/href</a></iframe><p>You can safely store this but the important part to visualize is again is to handle the radius property when handing this GeoJSON to leaflet. We can use leaflets <a href="https://leafletjs.com/reference-1.4.0.html#geojson-pointtolayer">point to layer</a> function to do this. If the radius property is present we return a Circle, otherwise a Marker.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c84ffcb9a25a36b094cc9d04e33831c/href">https://medium.com/media/5c84ffcb9a25a36b094cc9d04e33831c/href</a></iframe><p><em>Note: we’re using </em><a href="https://lodash.com/docs/4.17.10#forEach"><em>lodash here</em></a><em> to loop over the data — you can of course loop over it however you want.</em></p><p>So whenever you import your GeoJSON data into leaflet using the createLayersFromJson function, it will create circles if a radius is available.</p><p>This is exactly how we do it in <a href="https://geoman.io/">Geoman</a> where this is already built in. You can see here an import of a JSON-file with multiple GeoJSON features:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*POIAPBpALkgQefFE9tkqRA.gif" /></figure><p>My name is Sumit and I build stuff. If you have feedback or questions, drop me a line <a href="https://twitter.com/TweetsOfSumit">on Twitter </a>and <a href="https://raum.sh/about">check out my mailing list</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d04dcd6cb2e6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geoman-blog/how-to-handle-circles-in-geojson-d04dcd6cb2e6">How To Handle Circles in GeoJSON</a> was originally published in <a href="https://medium.com/geoman-blog">Geoman.io - Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Testing Maps e2e with Cypress]]></title>
            <link>https://medium.com/geoman-blog/testing-maps-e2e-with-cypress-ba9e5d903b2b?source=rss----eadd6967ac4---4</link>
            <guid isPermaLink="false">https://medium.com/p/ba9e5d903b2b</guid>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[cypress]]></category>
            <category><![CDATA[leaflet]]></category>
            <category><![CDATA[mapbox]]></category>
            <category><![CDATA[e2e-testing]]></category>
            <dc:creator><![CDATA[Sumit Kumar]]></dc:creator>
            <pubDate>Fri, 14 Dec 2018 10:37:52 GMT</pubDate>
            <atom:updated>2018-12-14T10:39:55.975Z</atom:updated>
            <content:encoded><![CDATA[<h3>e2e Testing Map Layers with Cypress</h3><p>In order to ensure proper geo-data management tools within <a href="https://geoman.io/">Geoman</a>, we are testing our <a href="https://geoman.io/editor">Studio</a> and of course our <a href="https://github.com/codeofsumit/leaflet.pm">open source library leaflet.pm</a> for leaflet layer manipulation. Our tool of choice is <a href="https://www.cypress.io/">Cypress</a> as it was the first end-to-end testing experience that did not drive us crazy all the time. Actually, it was (and still is) a joy to use. And this is how we do it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i53IG4DAoczlFzaToo2tqw.gif" /></figure><p>Let’s start with a simple index.html with a leaflet map and include the <a href="https://github.com/codeofsumit/leaflet.pm">leaflet.pm</a> geometry management library.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8596e43a3e1a6a3f23534030d154a974/href">https://medium.com/media/8596e43a3e1a6a3f23534030d154a974/href</a></iframe><p>We will initiate the leaflet map inside cypress/support/index.js before each test.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d5b3bdded4548711b2fac92f35121ac0/href">https://medium.com/media/d5b3bdded4548711b2fac92f35121ac0/href</a></iframe><h3>Our First Test</h3><p>create cypress/integration/polygon.spec.js with an empty test:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0c9f393abc97c4d69d1cdc1b2b87a359/href">https://medium.com/media/0c9f393abc97c4d69d1cdc1b2b87a359/href</a></iframe><p>and launch Cypress with cypress open .</p><p>If we start the polygon test from the Cypress UI we can see the map initiates and our test succeeds. We will now test if a polygon can be drawn using the toolbar.</p><p>To enter drawing mode via the leaflet.pm toolbar, we need to click the polygon button. We can get it by its css class selector like this: cy.get(&#39;.leaflet-pm-icon-polygon&#39;);</p><p>But we don’t want to type this all the time, especially for all the different buttons. So we will abstract this with a custom Cypress command inside cypress/support/commands.js .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ef43cf396a7db4346a562cf67799ca2/href">https://medium.com/media/2ef43cf396a7db4346a562cf67799ca2/href</a></iframe><p>So now, we can get the polygon button and click it with cy.toolbarButton(&#39;polygon&#39;).click(); which enables our drawing mode. A polygon can now be drawn by clicking on the map:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2612439f04117c73e89f26f887f22fbe/href">https://medium.com/media/2612439f04117c73e89f26f887f22fbe/href</a></iframe><p>In order to close a polygon, we click the first marker again so the coordinates of the first and last click are the same. Our tests now creates a polygon:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x7yMKNDx0Tg10X3HptUxLg.gif" /></figure><p>Next, we need to actually put some assertions in and depending on what functionality we want to test, we can do a lot of different things. In this example, I will test the active state of the toolbar button, the draw polygon feature and ability to cut a hole into a polygon. Let’s go through it point by point.</p><h4>Test Button State</h4><p>That’s easy. We can see in the DOM inspector that the container element of our buttons will get an .active class. So we test against that by checking if the class is not present before the click and is present after.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/96d807ba3a9e31cb8454c36ea0a5e781/href">https://medium.com/media/96d807ba3a9e31cb8454c36ea0a5e781/href</a></iframe><p>As you can see, it’s pretty simply to test for classes in Cypress. Now, we will test the polygon itself — please keep in mind thatI will put everything into the same test now but you can structure your tests however you want.</p><h4>Test Polygon Vertices</h4><p>There are many ways to test that the polygon is actually on the map. I chose to test this together with the edit mode of leaflet.pm. Enabling editing of a polygon in leaflet.pm creates markers at each vertex to enable the user to drag, add and remove markers to edit the polygon:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*usKzPhRLoQ7ssijnZiYfUw.gif" /></figure><p>So we can enable edit mode and test the number of present markers on the map. We have two markers here. The vertex markers and the middle-markers in between them. Based on the css classes the markers have, we can get vertex markers with cy.get(&#39;.marker-icon:not(.marker-icon-middle)&#39;) and middle markers with cy.get(&#39;marker-icon-middle&#39;) .</p><p>The polygon should have 4 vertex markers and we can test that like this:</p><pre>cy.get(‘.marker-icon:not(.marker-icon-middle)’).should(($p) =&gt; {<br>  expect($p).to.have.length(4);<br>});</pre><p>This is rather long so let’s abstract this away into a command in commands.js again:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/38696eabc094346730dbb58c91942757/href">https://medium.com/media/38696eabc094346730dbb58c91942757/href</a></iframe><p>So, after the polygon is drawn we should have 0 vertex markers because edit mode is not enabled yet. We enable it (and test the button while we’re at it) and count the markers again.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2580f0b8fe472941144332b56b15996a/href">https://medium.com/media/2580f0b8fe472941144332b56b15996a/href</a></iframe><p>Cypress runs that test and shows you 5 successful assertions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EzQ5yxN7U1DyNfiRM3R-HA.gif" /></figure><p>Awesome! The polygon seems to have been created with the correct number of vertices and the edit mode properly added all necessary markers. Testing the middle markers is now also a one-liner that we could add: cy.hasMiddleMarkers(4)</p><h4>Test Holes in Polygons</h4><p>With the previously created commands and knowledge, testing a functioning cutting feature is quite easy. We will select the cutting tool (and check the button state again), trigger some clicks on the map to complete a polygon that will be subtracted from the current one and check the marker count again. This time, we also test the middle markers. Here’s what our final test looks like.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82c4b7067104f9e7e6aca3d87aba97bd/href">https://medium.com/media/82c4b7067104f9e7e6aca3d87aba97bd/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wl618I-wOSO2w8ewLAbvdQ.gif" /><figcaption>The complete test executed by Cypress</figcaption></figure><h4>Planned Improvements</h4><ul><li>Move the button test into the toolbarButton command. This will save us quite some lines of code</li><li>Create a new command for drawing shapes so we can call cy.drawShape(&#39;polygon&#39;) and the clicks are triggered within that</li><li>Extend cy.hasVertexMarkers to enable edit mode on it’s own and test middle markers automatically</li><li>Expose the leaflet map object from index.js via Aliases</li></ul><p>We have quite a few tests now for a lot of shapes including MultiPolygons, LayerGroups, Circles and more. Here’s the complete leaflet.pm test suite running:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i53IG4DAoczlFzaToo2tqw.gif" /></figure><p>The tests runs for each Pull Request and Branch <a href="https://github.com/codeofsumit/leaflet.pm">on Github</a></p><p>leaflet.pm is open source and so are it’s test. Feel free to <a href="https://github.com/codeofsumit/leaflet.pm/tree/develop/cypress">check it out and contribute</a> if you have ideas. For advanced geo-data mangement and visualization features, check out <a href="https://geoman.io/">Geoman</a>.</p><p>My name is Sumit and I build stuff. If you have feedback or questions, drop me a line <a href="https://twitter.com/TweetsOfSumit">on Twitter </a>and <a href="https://raum.sh/about">check out my mailing list</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba9e5d903b2b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geoman-blog/testing-maps-e2e-with-cypress-ba9e5d903b2b">Testing Maps e2e with Cypress</a> was originally published in <a href="https://medium.com/geoman-blog">Geoman.io - Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>