<?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 Dmitry Sobolevsky on Medium]]></title>
        <description><![CDATA[Stories by Dmitry Sobolevsky on Medium]]></description>
        <link>https://medium.com/@dmitry.sobolevsky?source=rss-84736a31d1b5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*nh4UJ-Em_xDu8_dwvv-Gmw.jpeg</url>
            <title>Stories by Dmitry Sobolevsky on Medium</title>
            <link>https://medium.com/@dmitry.sobolevsky?source=rss-84736a31d1b5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 23:33:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dmitry.sobolevsky/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[Why your next project should ditch Webpack!]]></title>
            <link>https://medium.com/@dmitry.sobolevsky/why-your-next-project-should-ditch-webpack-77256284bf16?source=rss-84736a31d1b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/77256284bf16</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[js]]></category>
            <dc:creator><![CDATA[Dmitry Sobolevsky]]></dc:creator>
            <pubDate>Fri, 26 Apr 2024 12:05:50 GMT</pubDate>
            <atom:updated>2024-04-26T12:05:50.322Z</atom:updated>
            <content:encoded><![CDATA[<p>Until recently, <strong>Webpack</strong> was the standard tool for building <strong>Javascript</strong> applications, but unfortunately those times have passed and a new hero has appeared on the scene — <strong>Vite</strong>!</p><h4>Why is everyone tired of Webpack?</h4><p>Webpack is a very powerful and reliable tool for building Javascript applications, but its speed leaves much to be desired. Also, it can be difficult for beginners to understand its configuration and terminology. Attention, I’m not saying that Webpack is bad! It’s just that there are more advanced tools available.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iuQVWgHyXLuoBYvQ" /><figcaption>Photo by <a href="https://unsplash.com/@patrick_schneider?utm_source=medium&amp;utm_medium=referral">Patrick Schneider</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Vite</h4><p>So let’s talk about Vite: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules">ESM</a>, <a href="https://rollupjs.org/">Rollup</a> and <a href="https://esbuild.github.io/">esbuild</a>.<br>What’s going on you may ask why use <strong>Rollup</strong> and <strong>esbuild</strong> at the same time?<br>Actually <strong>Vite</strong> uses <strong>Rollup</strong> &gt; <strong>production</strong> builds and <strong>esbuild</strong> &gt; <strong>development</strong>.</p><p><strong>Rollup</strong> is known for creating highly optimised JavaScript packages, thanks to its advanced tree rebuilding algorithms that remove unused code, making it ideal for production builds. It supports a wide range of <strong>JavaScript</strong> functions and plugins, providing sophisticated functionality such as code splitting and dynamic importing, which is essential for modern web applications.</p><p>Vite uses <strong>esbuild</strong> for its dev server and for pre-bundling dependencies because the speed of <strong>esbuild</strong> greatly improves the developer experience by providing fast rebuild times and efficient handling of node_modules during development.</p><h4>ATTENTION!</h4><blockquote>For the production build, by default Vite targets browsers that support <a href="https://caniuse.com/es6-module"><strong>native ES Modules</strong></a><strong>, </strong><a href="https://caniuse.com/es6-module-dynamic-import"><strong>native ESM dynamic import</strong></a><strong>,</strong> and <a href="https://caniuse.com/mdn-javascript_operators_import_meta"><strong>import.meta</strong></a>. Legacy browsers can be supported via the official <a href="https://github.com/vitejs/vite/tree/main/packages/plugin-legacy">@vitejs/plugin-legacy</a>.</blockquote><p>If you are going to support <strong>older browsers</strong> be sure to use <a href="http://twitter.com/vitejs/plugin-legacy">@vitejs/plugin-legacy</a> otherwise your customers will <strong>no longer be able to use your application.</strong></p><h4>Let’s create a new project with Vite!</h4><p>You won’t believe it, but you only need to execute one command:</p><pre>npm create vite@latest &lt;name_of_the_project&gt;</pre><p>Choose a project type:</p><pre>? Select a framework: › - Use arrow-keys. Return to submit.<br>❯   Vanilla<br>    Vue<br>    React<br>    Preact<br>    Lit<br>    Svelte<br>    Solid<br>    Qwik<br>    Others</pre><p>I’ll choose <strong>Vanilla</strong> for the example, and now choose <strong>Javascript</strong> or <strong>Typescript</strong>. There are different options for each type of project.</p><pre>✔ Select a framework: › Vanilla<br>? Select a variant: › - Use arrow-keys. Return to submit.<br>❯   TypeScript<br>    JavaScript</pre><p>And that’s it! The project has been created and is waiting for you!</p><pre>Done. Now run:<br><br>  cd &lt;name_of_the_project&gt;<br>  npm install<br>  npm run dev</pre><p>Creating a new web project has never been easier than it is now using <strong>Vite</strong>!</p><figure><img alt="Screenshot of the created project" src="https://cdn-images-1.medium.com/max/992/1*hZ66b1IAx6BZ10A3-PvCgA.png" /><figcaption>New project initial state</figcaption></figure><p><strong>Vite has become my default builder, which I advise you to do as well.</strong></p><h4>More templates?!</h4><p>If you couldn’t find the application customization you need in the Vite framework menu, take a look here:</p><p><a href="https://github.com/vitejs/awesome-vite?tab=readme-ov-file">GitHub - vitejs/awesome-vite: ⚡️ A curated list of awesome things related to Vite.js</a></p><p>This repo contains an insane amount of ready-made templates <strong>links</strong> for any type of web application you can imagine! Take a look!</p><h4>Configuring Vite</h4><p>To your surprise you won’t find <strong>vite.config.(ts|js)</strong> for just a <strong>Vanilla</strong> project, as <strong>Vite</strong> does everything for you out of the box!</p><p>But, if you are creating React, Vue or other type of project you will find <strong>vite.config.(ts|js)</strong> in the root directory, for an example let’s look at the config file for the <strong>React </strong>project<strong> </strong>and <strong>Vite</strong> reads that config everytime you use vite command.</p><pre>import { defineConfig } from &#39;vite&#39;<br>import react from &#39;@vitejs/plugin-react&#39;<br><br>// https://vitejs.dev/config/<br>export default defineConfig({<br>  plugins: [react()],<br>})</pre><p>As you can see it looks very simple and straightforward.</p><p><strong>plugins —</strong> can extend the capabilities of Vite by utilising the Rollup plug-in architecture with additional Vite-specific options. This integration allows Vite users to take advantage of Rollup’s rich collection of plug-ins and flexibly customise the development server and server-side rendering (SSR) features to meet their requirements.</p><p>If you are interested in more detailed customization I advise you to explore all possible <a href="https://vitejs.dev/config/shared-options.html">options here</a>.</p><h4>Conclusion</h4><p>In this article, we looked at how you can create a web project in 1 minute without any effort on your part and start developing right away.</p><p>More Vite articles: <br>- <a href="https://medium.com/@dmitry.sobolevsky/unlock-vites-power-with-custom-plugins-9eae1323c16c">Building Vite’s plugin</a></p><p><strong>Tschüss</strong>! <strong>Stay tuned!</strong></p><p>Reach me on <a href="https://www.linkedin.com/in/dmitry-sobolevsky/">LinkedIn</a> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77256284bf16" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlock Vite’s Power with custom plugins!]]></title>
            <link>https://medium.com/@dmitry.sobolevsky/unlock-vites-power-with-custom-plugins-9eae1323c16c?source=rss-84736a31d1b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/9eae1323c16c</guid>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[js]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Dmitry Sobolevsky]]></dc:creator>
            <pubDate>Fri, 26 Apr 2024 09:20:09 GMT</pubDate>
            <atom:updated>2024-04-26T09:21:21.866Z</atom:updated>
            <content:encoded><![CDATA[<p>Today let’s create a very necessary and small plugin to save the version of your build in index.html file.</p><p>If you have many environments and you need to check often which version of your web application is deployed on which environment — then this is the article for you!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*13zaYhhfU8zAHoHb" /><figcaption>Photo by <a href="https://unsplash.com/@jplenio?utm_source=medium&amp;utm_medium=referral">Johannes Plenio</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Vite config</h4><p>And so we have <strong>vite.config.ts</strong> for <strong>React</strong> application, actually it doesn’t matter what type of web application you are using with <strong>Vite</strong> — our new micro plugin will fit for all :)</p><pre>import { defineConfig } from &#39;vite&#39;<br>import react from &#39;@vitejs/plugin-react&#39;<br><br>// https://vitejs.dev/config/<br>export default defineConfig({<br>  plugins: [react()],<br>})</pre><h4>.env file</h4><p>So, we will read environment variables from our environment or <a href="https://vitejs.dev/guide/env-and-mode#env-files">.env files </a>that <strong>Vite</strong> supports out of the box.</p><p>For example, we can create a new <strong>.env</strong> file in the same folder as <strong>vite.config.ts.</strong></p><pre>VITE_BUILD_VERSION=5.0.1</pre><h4>.html changes</h4><p>Let’s also add placeholder to <strong>index.html</strong> file for future replacement during build. I suggest adding this hidden span element to the very beginning of the <strong>body</strong> tag for easy viewing in <strong>Dev Tools Inspector</strong>.</p><pre>  &lt;body&gt;<br>    &lt;span id=&quot;version&quot; hidden&gt;${version}&lt;/span&gt;<br>    ....<br>  &lt;/body&gt;</pre><h4>New Plugin</h4><p>We’re going to use <a href="https://vitejs.dev/guide/api-plugin#transformindexhtml"><strong>transformIndexHtml</strong></a><strong> </strong>method<strong> </strong>to change the contents of our <strong>.html</strong> file.<br>And so, our task is to find <strong>${version}</strong> in the html stream and replace it with <strong>the current build version</strong> which can be in your<strong> </strong>environment variables during CI/CD job.</p><pre>const versionInjector = (buildVersion: string) =&gt; {<br><br>  return {<br>    name: &#39;version-injector&#39;, // Name of the plugin<br>    transformIndexHtml(html) { <br>      const version = buildVersion || &#39;0.0.0&#39;;<br><br>      // Replace the placeholder with the actual version<br>      return html.replace(&#39;${version}&#39;, version);<br>    }<br>  };<br>};</pre><h4>Updating vite.config.ts</h4><p>And so our Vite config now looks like this!</p><pre>import {defineConfig, loadEnv} from &#39;vite&#39;<br>import react from &#39;@vitejs/plugin-react&#39;<br><br>export const versionInjector = (buildVersion: string) =&gt; {<br><br>  return {<br>    name: &#39;version-injector&#39;, // Name of the plugin<br>    transformIndexHtml(html) {<br>      const version = buildVersion || &#39;0.0.0&#39;;<br><br>      // Replace the placeholder with the actual version<br>      return html.replace(&#39;${version}&#39;, version);<br>    }<br>  };<br>};<br><br>export default defineConfig(({mode}) =&gt; { <br>  // loading env variables<br>  const env = loadEnv(mode, process.cwd());<br><br>  return {plugins: [react(), versionInjector(env.VITE_BUILD_VERSION)]};<br>});</pre><p>Let’s now start our project and look at the beginning of the <strong>&lt;body&gt; tag</strong>.</p><figure><img alt="Screenshot of DOM tree" src="https://cdn-images-1.medium.com/max/1024/1*PJ6DdEFX0ywsw10kjJa4PA.png" /><figcaption>Dev Tools Inspector</figcaption></figure><p><strong>Congratulations the plugin is ready!</strong></p><h4>Conclusion</h4><p>The point of this article was <strong>to show how easy and beautiful</strong> it is to make <strong>plugins for Vite</strong> and change literally anything while building an application.</p><p>And also if you are interested in this topic, I recommend you to study the source code of <a href="https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/src/index.ts">plugin-react</a>.</p><p><strong>Stay tuned!</strong></p><p>Reach me on <a href="https://www.linkedin.com/in/dmitry-sobolevsky/">LinkedIn</a> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9eae1323c16c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Frameworks 2024: Find Your Winner.]]></title>
            <link>https://medium.com/@dmitry.sobolevsky/web-frameworks-2024-find-your-winner-670c53a4034d?source=rss-84736a31d1b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/670c53a4034d</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[website]]></category>
            <category><![CDATA[js]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Dmitry Sobolevsky]]></dc:creator>
            <pubDate>Mon, 12 Feb 2024 16:50:58 GMT</pubDate>
            <atom:updated>2024-02-12T16:50:58.474Z</atom:updated>
            <content:encoded><![CDATA[<p>Nowadays there are so many different tools for building complex web applications that utilize this all local and every day it solves a huge number of different problems. Without these applications our life seems to be impossible already.</p><p>For example we can consider such applications as Facebook, Instagram, LinkedIn, Gmail and for sure Medium as we can see all these web applications are built using Javascript.</p><p>To build this kind of application using pure Javascript without any libraries or frameworks is possible but very painful and at some point will become very expensive, slow and painful for the team that develops and supports this project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Os5dPrXF13cPgATr" /><figcaption>Photo by <a href="https://unsplash.com/@ivoafr?utm_source=medium&amp;utm_medium=referral">Ivo Rainha</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>So first I suggest you dive into the history of the most popular web development tools.</p><h4>2006. jQuery</h4><p>58.5k ⭐</p><figure><img alt="jQuery logo" src="https://cdn-images-1.medium.com/max/1024/0*ow4HIURNUF-kwt9X.png" /><figcaption><a href="https://jquery.com/">https://jquery.com</a></figcaption></figure><p>One of the first libraries that can be considered the father of all JS libraries is <strong>jQuery</strong>. It was released in <strong>2006</strong> and contains a large amount of useful functionality for building dynamic interactive sites.</p><p>Over the years <strong>jQuery</strong> grew and especially its audience, at some point <strong>jQuery</strong> was present on almost every website and it became a standard for web development. I think that even now you can find a huge number of projects that are still using it and are not even going to switch to something else, there is a reason for that too, which I think many people understand — simplicity and low entry threshold.</p><p><strong>And surprise surprise! jQuery is alive and well!</strong></p><p><strong>jQuery is used by 94.4%</strong> 😱 of all the websites whose JavaScript library we know. <br><strong>This is 77.2% of all websites</strong> according to <a href="https://w3techs.com/technologies/details/js-jquery">https://w3techs.com/technologies/details/js-jquery</a>.</p><h4><strong>2010. Backbone</strong></h4><p>28.1k ⭐</p><figure><img alt="Backbone js logo" src="https://cdn-images-1.medium.com/max/899/0*wllHh9olFeWgdqra.png" /><figcaption><a href="https://backbonejs.org/">https://backbonejs.org</a></figcaption></figure><p>Four years later in 2010 <strong>Backbone</strong> was released, it was a fully functional library that allows you to develop a web application using router and events. <br><strong>Backbone.js </strong>is a lightweight JavaScript framework for developing single-page web applications. Models with key-value binding and custom events, routing. It is used to create structured and modular applications.</p><h4><strong>2010. AngularJs</strong></h4><p>59k ⭐</p><figure><img alt="AngularJs logo" src="https://cdn-images-1.medium.com/max/383/0*vpOz2wK6cMC9NRQC.png" /><figcaption><a href="https://angularjs.org/">https://angularjs.org</a></figcaption></figure><p>Also in 2010 <strong>AngularJs</strong> was released by Google! <br>At that time <strong>AngularJs</strong> was a revolution in web development, which allowed to write very complex and at the same time easy to maintain applications.</p><p><strong>It has such key features as:</strong></p><p><strong>— MVC</strong><br> — 2-way Data Binding<br>— Form validations<br> — Scope<br> — Dependency Injection<br> — Routing and much more.</p><p>In the beginning it didn’t have a component approach instead it used <a href="https://docs.angularjs.org/guide/controller">Controllers</a> and <a href="https://docs.angularjs.org/guide/directive">Directives</a>.</p><p>It also had very <strong>interesting</strong> approaches to handling events: <em>$scope.$broadcast</em>, <em>$scope.$emit</em> and <em>$scope.$on</em> — anyone who has ever worked with this tool will know what I mean 😀.</p><p>Personally, I loved this framework and enjoyed working with it until Angular 2+ came along.</p><h4><strong>2011. Ember</strong></h4><p>22,4k ⭐</p><figure><img alt="Ember.js logo" src="https://cdn-images-1.medium.com/max/596/0*Zt9083kdeLAQkfcN.png" /><figcaption><a href="https://emberjs.com/">https://emberjs.com</a></figcaption></figure><p><strong>Ember.js</strong>, a pretty good tool for web application development.<br>But unfortunately it has a rather limited community, despite this it is used by <a href="https://emberjs.com/ember-users/">many companies</a> like Linkedin, Apple, Heroku and Netflix.</p><p>It offers a standardized project structure, automates many development tasks, and focuses on components for code reuse.</p><p>Key features include convenient routing, two-way data binding, and tools for data management. <strong>Ember.js</strong> is ideal for complex projects but can be <strong>challenging</strong> <strong>for beginners</strong> and <strong>overkill</strong> for small projects.</p><p>The framework itself is quite fast and lightweight, I can’t say anything bad about it.<br> <br>Once I even had a chance to rewrite 2 web applications written in <strong>Ember</strong> on React, the code is quite easy to read and the construction of the application is similar to AngularJs.</p><h4><strong>2013. React</strong></h4><p>218k ⭐</p><figure><img alt="React Icon" src="https://cdn-images-1.medium.com/max/306/1*kHB5qkOIhe6J4x4hWMurYA.png" /><figcaption><a href="https://react.dev/">https://react.dev</a></figcaption></figure><p>I think this library needs no introduction and it is one of the most famous and popular tools for web applications nowadays.</p><p><strong>React</strong> stands out for its approach to <strong>virtual DOM</strong> updating, which optimizes application <strong>performance</strong> and simplifies the development process. <br>It is popular for its flexibility, efficiency, and broad community support.<br> <br>One of the best things about <strong>React</strong> is its <strong>large community</strong>. <br>Having so <strong>many people</strong> using and supporting React means you can easily find help, resources, and new ideas. <br>This community is the biggest compared to other web development tools, which makes <strong>React</strong> even more valuable for developers.</p><h4><strong>2014. VueJs</strong></h4><p>43.1k ⭐</p><figure><img alt="VueJs logo" src="https://cdn-images-1.medium.com/max/300/0*tMXRZK9mWNstI72O.png" /><figcaption><a href="https://vuejs.org/">https://vuejs.org</a></figcaption></figure><p><strong>Vue.js </strong>is a progressive JavaScript framework for creating user interfaces. Founded by Evan Yu in 2014, Vue is designed for incremental adoption: it can be easily integrated into projects where only part of the page needs to be improved with more interactive components.</p><p>Vue’s main features include reactive and component-oriented development, lightweight and <strong>easy to learn</strong>, making it a popular choice among developers. Vue.js has quickly gained popularity due to its flexibility, performance, and <strong>user-friendly </strong>API.<br> <br>Personally, I like <strong>VueJs</strong> approach very much and consider it a very flexible and cool tool for developing web applications of any complexity and it reminds me of a <strong>mix of Angular and React</strong>.</p><h4>Finally!<br><strong>2016. Angular</strong></h4><p>93.5k ⭐</p><figure><img alt="Angular logo" src="https://cdn-images-1.medium.com/max/366/1*5PaRvq6y14fxwmgu9KAfwA.png" /><figcaption><a href="https://angular.io/">https://angular.io</a></figcaption></figure><p>And so we’ve reached one of my favorite frameworks <strong>Angular</strong> (2+). <br>There is a lot to say about it, but the most important thing is <strong>Typescript</strong>!</p><p>Angular started using typescript by default and it became the reason for many debates that are still going on today about the props and cons of <strong>Typescript</strong>.<br> <br>The new <strong>Angular</strong> adopted a lot of things from its ancestor AngularJs and also added such features as <strong>Reactive Forms</strong>, <strong>Angular CLI</strong>, <strong>RxJs</strong> and much more!</p><p>Now developing complex forms has become very easy and fast compared to all other solutions especially if you have large nested forms. <strong>Angular</strong> out of the box provides Template-Driven Forms, Reactive Forms and <strong>Async form validation</strong>.</p><p>Unfortunately <strong>Angular</strong> also has disadvantages: framework weight and high entry threshold from <strong>RxJS</strong> and <strong>reactive programming</strong>.</p><h4><strong>2016. Svelte</strong></h4><p>73,5k ⭐</p><p>The same year <strong>Svelte</strong> was released! Compared to other existing solutions, <strong>Svelte</strong> was the fastest and most productive.<br> <br>Unlike traditional frameworks like React and Vue, which do most of their work in the browser, Svelte moves that work to the <strong>compilation phase</strong> that occurs when the application is built.</p><p>This leads to the generation of highly efficient imperative code that updates the DOM directly, providing faster execution performance and smaller bandwidth.<br>Svelte’s API is designed to be <strong>simple and minimalistic</strong>, making it accessible to developers with basic knowledge of HTML, CSS and JavaScript.</p><p>The simplicity of the framework doesn’t sacrifice power, offering advanced features without a steep learning curve.<br>The popularity of this library has been growing constantly, accordig to Github starts it’s already even more popular than <strong>Vue.js</strong>.</p><h3>Summary</h3><h4>Usage</h4><p>Let’s check how many public websites have listed above tools.</p><figure><img alt="Usage img" src="https://cdn-images-1.medium.com/max/888/1*Smb-bfNhSi_fHz8eyfq3ag.png" /><figcaption><a href="https://w3techs.com/technologies/overview/javascript_library">https://w3techs.com/technologies/overview/javascript_library</a></figcaption></figure><p>As you can see, <strong>jQuery</strong> is in first place 🥇 🤯 and <strong>Backbone</strong> is even popular than <strong>Angular</strong>/<strong>Vue</strong>.</p><h4><strong>Downloads</strong></h4><p>And now I’m going to compare weekly downloads from NPM and we see raise of <strong>React</strong> 📈 with some weird attempts in 2022 by <strong>Vue</strong> 😀.</p><figure><img alt="Downloads comparison image" src="https://cdn-images-1.medium.com/max/1024/1*XU1NJO11OqWkgZAToHMX1g.png" /><figcaption><a href="https://npmtrends.com/@angular/core-vs-angular-vs-backbone-vs-ember-cli-vs-jquery-vs-react-vs-svelte-vs-vue">https://npmtrends.com/@angular/core-vs-angular-vs-backbone-vs-ember-cli-vs-jquery-vs-react-vs-svelte-vs-vue</a></figcaption></figure><h4>Perfomance</h4><p>As a follow up, let’s just do a quick comparison of rendering performance. Honestly this section deserves a separate article and a deep dive, which we will do in the near future.</p><figure><img alt="Libraries performance benchmark" src="https://cdn-images-1.medium.com/max/1024/1*oysCwlGl9pJQCCFr1Q3SaQ.png" /><figcaption><a href="https://krausest.github.io/js-framework-benchmark/current.html">https://krausest.github.io/js-framework-benchmark/current.html</a></figcaption></figure><figure><img alt="First paint performance benchmark" src="https://cdn-images-1.medium.com/max/760/1*ZG_aR42JUo61rKWlOS2fBQ.png" /><figcaption><a href="https://krausest.github.io/js-framework-benchmark/current.html">https://krausest.github.io/js-framework-benchmark/current.html</a></figcaption></figure><h4>State of JS</h4><p>One key resource for tracking the global <strong>popularity</strong> of <strong>web technologies</strong> is <strong>stateofjs.com</strong>. This site surveys the <strong>JavaScript</strong> ecosystem, offering insights into the trends and preferences of developers worldwide.</p><p>Please check <a href="https://2022.stateofjs.com/en-US/libraries/front-end-frameworks/">the results of 2022 survey</a> and make sure we’re on the same page.</p><p><strong>React rocks!</strong></p><p>FYI, <strong>2023 survey</strong> at <a href="https://stateofjs.com/en-US"><strong>stateofjs.com</strong></a> is still ongoing actively, feel free to share your experience there.</p><h3>Conclusion</h3><p>Despite some performance hurdles, <strong>React</strong> still stands out as the leading framework for web development.</p><p>Its <strong>vast ecosystem</strong>, <strong>strong community</strong>, and adaptable design support the building of dynamic, scalable applications efficiently.</p><p><strong>React’s</strong> approach to reusable components and <strong>regular updates</strong> keeps it ahead in the tech scene, making it the <strong>go-to choice</strong> for developers worldwide.</p><p><strong>Stay tuned!</strong></p><p>Reach me on <a href="https://www.linkedin.com/in/dmitry-sobolevsky/">LinkedIn</a> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=670c53a4034d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You don’t need React in 2024]]></title>
            <link>https://medium.com/@dmitry.sobolevsky/you-dont-need-react-in-2024-45257fa9b25b?source=rss-84736a31d1b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/45257fa9b25b</guid>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Dmitry Sobolevsky]]></dc:creator>
            <pubDate>Sun, 21 Jan 2024 21:21:41 GMT</pubDate>
            <atom:updated>2024-05-07T08:33:23.310Z</atom:updated>
            <content:encoded><![CDATA[<p>Nowadays React is gaining or has already gained a lot of popularity of course it is a very good solution for large or medium-sized applications, but not in any case for completely ordinary several page web sites with static content.</p><figure><img alt="Simple web site" src="https://cdn-images-1.medium.com/max/1024/1*iI7gMn5boZocDgqIuW-_2g.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@benchaccounting?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Bench Accounting</a> on <a href="https://unsplash.com/photos/three-white-paper-clips-black-ceramic-mug-black-pencil-and-white-pencil-eraser-on-white-surface-xxeAftHHq6E?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><p>FYI, this article is oriented to beginners, if you are senior suggest to remember your youth :)</p><h3>Proof.</h3><p>The main task of such simple websites is to convey information about a place, business or organization to the visitors.</p><p>Let’s look at such a web site on the example of a <strong>small business</strong>.<br>Most often the site consists of such pages as:</p><p>1. <strong>Home</strong> — contains the most important information about the business, hours of operation, contact information.<br>2. <strong>Contact</strong> — detailed contact information including phone number, address hours of operation, e-mail address and map with location, as well as a feedback form.<br>3. <strong>Services</strong> — this section tells about the services provided by the company and their description.</p><p>As far as we can see from the above pages, this project will be as simple and effective as possible.</p><p>Based on this we can understand that to develop such a project we will need the most basic and simple technologies as Html, Css and Javascript.</p><p>The architecture of the project is very simple, and includes <strong>3 static html pages</strong>:</p><ol><li>index.html</li><li>services.html</li><li>contact.html</li></ol><h3>Start development.</h3><p>For this project we can use two approaches:<br>- Local development in .html files using css and JS.<br>- Use webpack to develop and build the project. My advice is to always use this approach, it will make your life much easier.</p><p>Apart from <strong>webpack</strong> also let’s take <strong>scss</strong> instead of <strong>css</strong>. Below I will describe the advantages of <strong>webpack</strong> and <strong>scss</strong>.</p><h4>Webpack</h4><figure><img alt="webpack logo" src="https://cdn-images-1.medium.com/max/1024/0*ujon3MpyLfmzwiKM.png" /><figcaption><a href="https://webpack.js.org/">https://webpack.js.org/</a></figcaption></figure><p>First, we need to make sure that <strong>Node.js</strong> is installed and running.<br>It’s easy to check with a command in the terminal:</p><pre>node -v</pre><p>If you got Node.js version — great! If not please visit <a href="https://nodejs.org/en/download">Node.js official site</a> and install it.</p><p><strong>Let’s get started:<br></strong>Webpack — in simple words it is a grocery picker picking your “order” in the store -&gt; 📦.</p><p>Imagine that you come to the store and ask for:<br> — <strong>html</strong> pages<br> — styling using <strong>scss</strong><br> — <strong>Support</strong> for all current browsers <br> — Dynamic <strong>Javascript</strong> logic. Such as form submissions, dropdown lists, etc.<br> — JavaScript code should be <strong>compressed</strong> before uploading to the server to speed up the loading of your pages.<br> — A web <strong>server for local development</strong> with automatic page reloading to reflect all new code changes.</p><p>And our <strong>Webpack</strong> bundler does it all for you in a very simple and beautiful way!</p><h4>Let’s go!</h4><p>Creating a simple website with <strong>Webpack</strong> involves setting up a configuration that handles your <strong>HTML</strong> files, <strong>SCSS</strong> for styling, and <strong>JavaScript</strong> for functionality. Below is a basic <strong>webpack.config.js</strong> file that should meet your needs:</p><ol><li>Create empty folder with your project name — this is your <strong>project root directory</strong>.</li><li>Run <strong>npm i</strong> in the root directory. Set your project and other neccessary settings.</li><li>Install the required packages: you will need to install <strong>Webpack</strong> and a few loaders. Run this command in your project <strong>root</strong> directory:</li></ol><pre>npm install --save-dev webpack webpack-cli html-webpack-plugin mini-css-extract-plugin css-loader sass sass-loader style-loader babel-loader @babel/core @babel/preset-env webpack-dev-server</pre><p>4. Create <strong>webpack.config.js </strong>project root directory<strong>. </strong>This is your webpack configuration file.</p><pre>const path = require(&#39;path&#39;);<br>const HtmlWebpackPlugin = require(&#39;html-webpack-plugin&#39;);<br>const MiniCssExtractPlugin = require(&#39;mini-css-extract-plugin&#39;);<br><br>module.exports = {<br>  entry: &#39;./src/index.js&#39;, // Your main JavaScript file<br>  output: {<br>    path: path.resolve(__dirname, &#39;dist&#39;),<br>    filename: &#39;bundle.js&#39;,<br>  },<br>  module: {<br>    rules: [<br>      {<br>        test: /\.js$/,<br>        exclude: /node_modules/,<br>        use: {<br>          loader: &#39;babel-loader&#39;,<br>          options: {<br>            presets: [&#39;@babel/preset-env&#39;],<br>          },<br>        },<br>      },<br>      {<br>        test: /\.scss$/,<br>        use: [MiniCssExtractPlugin.loader, &#39;css-loader&#39;, &#39;sass-loader&#39;],<br>      },<br>    ],<br>  },<br>  plugins: [<br>    new HtmlWebpackPlugin({<br>      template: &#39;./src/index.html&#39;,<br>      filename: &#39;index.html&#39;,<br>    }),<br>    new HtmlWebpackPlugin({<br>      template: &#39;./src/services.html&#39;,<br>      filename: &#39;services.html&#39;,<br>    }),<br>    new HtmlWebpackPlugin({<br>      template: &#39;./src/contact.html&#39;,<br>      filename: &#39;contact.html&#39;,<br>    }),<br>    new MiniCssExtractPlugin(),<br>  ],<br>  devServer: {<br>    contentBase: path.join(__dirname, &#39;dist&#39;),<br>    compress: true,<br>    port: 3000,<br>  },<br>};</pre><p>5. Project Structure:<br>Create a new <strong>src</strong> folder project <strong>root</strong> directory containing:</p><ul><li><strong>index.js</strong>: The main JavaScript entry file.</li><li><strong>index.html</strong>, <strong>services.html</strong>, <strong>contact.html</strong>: Your HTML files.</li><li>An <strong>scss</strong> folder with your SCSS files.</li></ul><p>6. Babel Configuration: <br>Create a <strong>.babelrc</strong> file for Babel configuration in project <strong>root</strong> directory.</p><pre>{<br>  &quot;presets&quot;: [&quot;@babel/preset-env&quot;]<br>}</pre><p>Let me explain what’s is it. <strong>Babel</strong> is a widely used JavaScript compiler that allows you to use next generation JavaScript, today. It essentially transforms your modern <strong>Javascript</strong> code into a version that is compatible with current and older browsers or environments.</p><p><strong>Simple speaking like teenagers explaining their slang to the old people 😀</strong></p><p>Teenagers here is the latest ECMAScript and the old people — Internet Explorer 11. Thanks God it’s gone!</p><pre>&quot;scripts&quot;: {<br>  &quot;start&quot;: &quot;webpack serve --open&quot;,<br>  &quot;build&quot;: &quot;webpack --mode production&quot;<br>}</pre><p>8. Run your project:</p><ul><li>Use npm start to start the <strong>development</strong> server.</li><li>Use npm run build to create a production <strong>build</strong>.</li></ul><h3>SCSS</h3><p>Let’s try to explain in the most easist form:</p><p>Imagine you have a big box of colored pencils for drawing pictures✏️. Regular CSS (Cascading Style Sheets) is like using each pencil directly from the box to color your picture. You pick a color, draw a bit, then choose another color, and so on. It works well, but sometimes, you wish you could mix colors together, or remember your favorite combinations easily.</p><p>Now, think of <strong>SCSS</strong> (Sassy CSS) as having a magical coloring book where you can create your own special colored pencils.</p><ol><li><em>Special Pencils</em> (<strong>Variables</strong>): <br>You can make a special pencil by mixing colors together and giving it a name like “Sunset Orange.” Whenever you want that exact color, you just use your “Sunset Orange” pencil instead of mixing the colors again.</li></ol><pre>$ocean-blue: #1ca3ec;<br>body {<br>  background-color: $ocean-blue; /* Use Ocean Blue for the background */<br>}</pre><p>2.<em> Stacking Drawings</em> (<strong>Nesting</strong>):<br>Imagine you’re drawing a tree. First, you draw the trunk, then the branches, and lastly the leaves, right? In SCSS, you can draw like this too. You start with the big part (the tree), and then add the smaller parts (branches, then leaves) inside your drawing of the tree. It’s like drawing inside a drawing, which keeps everything neat and easy to understand.</p><pre><br>.garden {<br>  .tree {<br>    height: 10ft;<br>    .leaves {<br>      color: green;<br>    }<br>  }<br>}</pre><p>3. <em>Magic Formulas</em> (<strong>Mixins</strong>): <br>What if you could create a magic formula to draw certain things? Like a formula for drawing stars or clouds. Whenever you want to draw a cloud, you just use your magic cloud formula, and it appears! Rainbow:</p><pre>@mixin rainbow {<br>  background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);<br>}<br>.sky {<br>  @include rainbow; /* Draw a rainbow in the sky */<br>}</pre><p>4. <em>Sharing Colors</em> (<strong>Inheritance</strong>): <br>If you have a favorite set of colors you used for one picture, you can easily use the same colors for another picture without picking them all out again.</p><pre>.flower {<br>  size: small;<br>  smell: nice;<br>}<br>.rose {<br>  @extend .flower; /* Rose has the same features as a flower */<br>  color: red;<br>}</pre><p>5. <em>Little Helper Pages</em> (<strong>Partials and Import</strong>): <br>Imagine you have little pages where you draw parts of your picture — like a page for trees, another for houses. Then, in your big picture, you can just say “put the tree here” or “put the house there,” and it’s like you’re copying from your little helper pages.</p><pre>// _stars.scss (This is the little helper page)<br>.star {<br>  shape: star;<br>  color: yellow;<br>}<br><br>// main.scss (Your big picture)<br>@import &#39;stars&#39;; /* Use the star drawings here */</pre><p>6. <em>Math in Art</em> (<strong>Mathematical Operations</strong>): <br>What if you could use math to help with your drawing? Like saying, “Make this line twice as long as prev one” or “Use half of this blue.” Making a fence twice as tall:</p><pre>/* Making a fence twice as tall: */<br>.fence {<br>  height: 5ft;<br>  .tall-fence {<br>    height: 2 * 5ft; /* The tall fence is twice as high */<br>  }<br>}</pre><p>Using <strong>SCSS</strong> is like having all these cool tools and tricks to make drawing (or in this case, designing websites) easier and more fun. You can be more creative and make changes easily, just like how you’d want your magical coloring book to work!</p><p>Hopefully this explanation works for you. <br>Let’s get back to project setup.</p><p>9. And the last step in our project configuration is to add <strong>main.scss</strong> in <strong>./src/scss</strong>.</p><figure><img alt="And image" src="https://cdn-images-1.medium.com/max/1024/1*9qaZqiS0zzfS43-l_g4VfA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@timmossholder?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Tim Mossholder</a> on <a href="https://unsplash.com/photos/black-and-white-love-wall-decor-cUU-ZW51sXI?utm_content=creditCopyText&amp;utm_medium=referral&amp;utm_source=unsplash">Unsplash</a></figcaption></figure><p>That’s it! Our simple project is configured and should work and you can start the real development 🚀. <br>As you can see, to create a fairly simple website you don’t need to use any frameworks such as <strong>React</strong>, <strong>Angular</strong>, <strong>Vue</strong>, etc.</p><p>The above approach will be perfectly indexed by search engines and will not cause difficulties with the performance of your website. If you have a site has repetitive blocks such as header and footer on each page — then I suggest you use template engines to follow the <strong>DRY</strong> (DON’T REPEAT YOURSELF) approach.</p><p>I will post a separate article on <strong>template engines</strong> in the near future.</p><p>As a result of our labor on the server will get a set of static files that will be distributed using a web server such as <strong>Nginx</strong>,<strong> Node.js,</strong> <strong>Apache</strong>, etc.,</p><p>How to <strong>deploy</strong> your web project quickly and conveniently, we will also understand with you in the following articles.</p><p><strong>Stay tuned!</strong></p><p>Reach me on <a href="https://www.linkedin.com/in/dmitry-sobolevsky/">LinkedIn</a> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45257fa9b25b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Apps Unveiled: A Beginner’s Guide to Understanding Different Web Application Categories]]></title>
            <link>https://medium.com/@dmitry.sobolevsky/web-apps-unveiled-a-beginners-guide-to-understanding-different-web-application-categories-75c92bc4ddbf?source=rss-84736a31d1b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/75c92bc4ddbf</guid>
            <category><![CDATA[js]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Dmitry Sobolevsky]]></dc:creator>
            <pubDate>Thu, 18 Jan 2024 21:18:07 GMT</pubDate>
            <atom:updated>2024-01-18T21:50:30.593Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of web development, technology is evolving at an astonishing rate, but the three main pillars — HTML, CSS and JavaScript — remain the same. The key to creating effective web applications lies in choosing the right structure and development approach, which directly affects the user experience and functionality of the application. Let’s take a look at two major trends in web development:</p><ol><li><strong>Multipage applications (MPA) :</strong></li></ol><ul><li>The classic approach to web development.</li><li>Includes multiple interconnected pages.</li><li>Each page is re-loaded when you navigate.</li></ul><p><strong>2. Single Page Applications (SPA):</strong></p><ul><li>A modern approach that utilizes dynamic content loading.</li><li>All information is displayed on a single page.</li><li>Interactivity and quick transitions without completely reloading the page.</li></ul><p>In this article, we will explore both of these approaches in detail, examine their features, advantages and disadvantages, and determine when each will be most effective.</p><figure><img alt="The start of the web journey" src="https://cdn-images-1.medium.com/max/1024/0*5TtXwZEGrcbDD43o" /><figcaption>Photo by <a href="https://unsplash.com/@iriser?utm_source=medium&amp;utm_medium=referral">Irina Iriser</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Multipage applications (MPA)</h3><p>Multipage applications, or MPAs, are a traditional form of websites. Examples include <em>e-commerce websites</em>, <em>online banking systems</em>, <em>news websites</em> and <em>content management systems</em>.</p><p>Their main characteristics include:</p><h4>Structure:</h4><ul><li>Constructed from many linked web pages.</li><li>Each page corresponds to a specific URL.</li><li>Loading dynamics:</li></ul><p>The browser completely reloads the content, including HTML, CSS, and JavaScript, as you navigate between pages.</p><h4>Varieties:</h4><ul><li><strong>Static pages</strong>: Easy to create, contain fixed content.</li><li><strong>Dynamic pages</strong>: Generated by a server in real time, often using server-side programming languages (e.g. PHP, Python, Node.js).</li></ul><h4>Advantages:</h4><ul><li>Easy to develop and maintain, especially for small and medium-sized projects.</li><li>Good indexing by search engines due to fixed URLs and if your pages load pretty fast and don’t weigh very much. You can check this thanks to the <a href="https://developer.chrome.com/docs/lighthouse/overview">Lighthouse tool</a>.</li></ul><h4>Disadvantages:</h4><ul><li>Slow loading when navigating between pages due to reloading of all content.</li><li>Limited interactivity and dynamism compared to SPAs.</li></ul><p>MPA are ideal for sites where simplicity and clear structure are important, such as corporate sites, information portals, landing pages and online stores with simple logic and navigation.</p><p>They are also a good choice for projects where SEO optimization plays a key role, as each page can be optimized for a specific set of keywords.</p><p>It’s worth mentioning that this approach is less and less common in new developments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wJh2iBZcgNOb5Erw" /><figcaption>Photo by <a href="https://unsplash.com/@lautaroandreani?utm_source=medium&amp;utm_medium=referral">Lautaro Andreani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Single Page Applications (SPA)</h3><p>Single Page Applications, or SPAs, offer a modern approach to web development, focusing on interactivity and speed:</p><h4>Structure and Loading Dynamics:</h4><ul><li>An SPA consists of one page that dynamically updates content without a full page reload.</li><li>All code (HTML, CSS, JavaScript) is loaded during the first visit, with subsequent content changes handled through JavaScript.</li></ul><h4>Interactivity and User Experience:</h4><ul><li>Instant transitions and high-speed performance.</li><li>Smooth and continuous interface that enhances user interaction with the application.</li></ul><h4>Rendering Methods and SEO:</h4><ul><li>Client-Side Rendering (CSR): All content is generated in the browser, which can create SEO challenges due to asynchronous content loading.</li><li>Server-Side Rendering (SSR): Initial content loading occurs on the server, improving indexing and first-load speed.</li></ul><h4>Advantages:</h4><ul><li>Optimization of client resources and reduced server load.</li><li>Ideal for applications requiring rich interactive interfaces.</li></ul><h4>Challenges:</h4><ul><li>SEO challenges with CSR.</li><li>Possible delays in initial loading for large applications if Lazy loading is not used. What is Lazy Loading? We’ll find out in the next articles :)</li></ul><p>SPAs are best suited for projects that require complex interactive elements and dynamic data loading, such as interactive platforms, complex forms, dashboard and online games.</p><h3>Additional Approaches and Technologies in Web Development</h3><p>Beyond traditional Multi-Page Applications (MPAs) and Single Page Applications (SPAs), there are other significant approaches and technologies that play a crucial role in modern web development:</p><h4>Static Site Generation (SSG):</h4><ul><li>SSG tools allow the creation of web pages from static data and templates.</li><li>The output is a multi-page site with the benefits of static content, often integrated with SPA frameworks.</li><li>Commonly used for personal blogs or documentation sites, where content is predominantly static.</li></ul><h4>Progressive Web Applications (PWA):</h4><ul><li>PWAs use advanced web technologies to deliver an app-like experience.</li><li>They can be installed on devices directly from the browser and can function offline or send push notifications.</li><li>Ideal for creating a more engaging user experience, PWAs bridge the gap between web and native applications.</li></ul><p>These technologies, while distinct from traditional MPAs and SPAs, often complement them, enabling developers to create more efficient, scalable, and engaging web applications.</p><p>Web development primarily revolves around <strong>Multi-Page Applications (MPAs)</strong> for traditional, content-heavy sites, and <strong>Single Page Applications (SPAs)</strong> for dynamic, interactive experiences. Emerging technologies like <strong>Static Site Generation (SSG)</strong> and Progressive <strong>Web Applications (PWA)</strong> offer additional options, blending static efficiency with dynamic features.</p><p>And my favorite phrase:</p><h4>The choice hinges on the project’s goals and user needs.</h4><p><strong>Stay tuned!</strong></p><p>Reach me on <a href="https://www.linkedin.com/in/dmitry-sobolevsky/">LinkedIn</a> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75c92bc4ddbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MapboxGL initial setup for newbies]]></title>
            <link>https://medium.com/@dmitry.sobolevsky/mapboxgl-initial-setup-for-newbies-99f8da810474?source=rss-84736a31d1b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/99f8da810474</guid>
            <category><![CDATA[mapbox]]></category>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[Dmitry Sobolevsky]]></dc:creator>
            <pubDate>Mon, 17 Apr 2023 08:54:29 GMT</pubDate>
            <atom:updated>2023-04-19T07:23:11.768Z</atom:updated>
            <content:encoded><![CDATA[<h3>MapboxGL initial setup for newbies.</h3><p>Mapbox is one of the most popular and popular libraries in web development. Many very famous companies use it as the basis for their maps.</p><p>For example companies such as: Strava, Yahoo, CNN, The New York Times, Adobe and so on, the list is endless, if you want to know more details I advise to look at the website Mapbox.</p><p>In this article, I would like to demonstrate Layer and Source.<br>If you are not familiar with the GeoJSON format, I suggest you read my previous two articles:<br>1. <a href="https://medium.com/@dmitry.sobolevsky/geojson-tutorial-for-beginners-ce810d3ff169?source=your_stories_page-------------------------------------">GeoJSON Tutorial for Beginners</a><br>2. <a href="https://medium.com/@dmitry.sobolevsky/feature-and-featurecollection-in-geojson-f36ec38ebdb1?source=your_stories_page-------------------------------------">Feature and FeatureCollection in GeoJSON.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xsojGGna3t8sWvBbpqXjJw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@hoachld?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Hoach Le Dinh</a> on <a href="https://unsplash.com/photos/PeRt3uMmjYM?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>And so here we go!</p><h4>Let’s create our first Map:</h4><ol><li>The first thing you have to do is to get a Mabpox Access Token. To do this, you need to register a new account at <a href="https://account.mapbox.com/">https://account.mapbox.com</a> and after registration find your key.<br>Initially Mapbox uses a Pay-as-you-go rate, which means that you pay nothing until you reach certain limits, for example 50,000 card impressions per month.</li><li>Add the library sources to the page, there are several options here:</li></ol><p>2.1 For simple addition to the page:</p><pre>&lt;link href=&quot;https://api.mapbox.com/mapbox-gl-js/v2.13.0/mapbox-gl.css&quot; rel=&quot;stylesheet&quot;&gt;<br>&lt;script src=&quot;https://api.mapbox.com/mapbox-gl-js/v2.13.0/mapbox-gl.js&quot;&gt;&lt;/script&gt;</pre><p>2.2 Using NPM</p><pre>npm i mapbox-gl</pre><p>importing into your JS/TS files</p><pre>import mapboxgl from &#39;mapbox-gl&#39;</pre><p>3. The next and very important step is to add your AccessToken to the Mapbox object.</p><pre>mapboxgl.accessToken = &#39;YOUR_MAPBOX_ACCESS_TOKEN&#39;</pre><p>4. We need to prepare a parent element for our map, inside this element will happen all the magic of Mapbox and Canvas.</p><p><strong>HTML</strong>:</p><pre>&lt;div id=&quot;map&quot;&gt;&lt;/div&gt;</pre><p><strong>React</strong>:</p><pre>function YourComponent {<br>  ...<br>  const mapContainer = useRef(null);<br> <br>  return (<br>    &lt;div&gt;<br>      &lt;div ref={mapContainer} className=&quot;map-container&quot; /&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>5. Create a Mapbox instance with pretty obvious settings, note that if you use the HTML approach the “container” must contain a unique html element id as in the example below:</p><pre><br>const map = new mapboxgl.Map({<br>  container: &#39;map&#39;, // container ID<br>  // Choose from Mapbox&#39;s core styles, or make your own style with Mapbox Studio<br>  style: &#39;mapbox://styles/mapbox/satellite-v9&#39;, // style URL<br>  center: [-79.076910, 43.078640], // starting position [lng, lat]<br>  zoom: 14 // starting zoom<br>});</pre><p>If you are adding a map in <strong>React</strong>, use a link to the HTML element instead of the <strong>id</strong>.</p><pre>const map = new mapboxgl.Map({<br>        container: mapContainer.current,<br>        ....<br>})</pre><p>6. If you’ve done all the steps and find that your map still doesn’t show up — <strong>you’re doing it right</strong>!<br>The problem is that your parent element that holds the map must have <strong>at least the height</strong>.</p><p>In this screenshot, you can see that all the necessary elements have already been added to the page, but Canvas element has <strong>position: absolute </strong>— that’s why our container must have a fixed height. That’s default style which comes from mapbox-gl.css.</p><p>It can be <strong>height</strong>: <strong>100vh, 20rem</strong> or <strong>500px and etc — depends on the requirements or </strong>you can even rewrite position style for the canvas element.</p><figure><img alt="Screenshot with Mapbox elements in the DOM" src="https://cdn-images-1.medium.com/max/1024/1*EsF240GiGQgb2fUYfAoiLg.png" /></figure><p>Let’s add few styles:</p><pre><br>body { margin: 0; padding: 0; } // ignore this line if you use proper css-reset<br>#map { height:100vh; width: 100vw; } // fullscreen </pre><p>If you’ve done everything right, you should see this:</p><figure><img alt="Map" src="https://cdn-images-1.medium.com/max/1024/1*RvbnJUp3liYgEN3Ywdj0vQ.png" /></figure><p><strong>Congratulations</strong>, now our map is ready and we can move on! <br>If anything is wrong, you can check my example <a href="https://jsfiddle.net/sobolevskidmitry/eskxhn4q/122/">here</a>.</p><p>And now let’s add a couple of controls to our map for easier use.</p><h4>What are Controls?</h4><p>Roughly speaking Controls are buttons for interaction with the map, thanks to them you can:<br>1. Zoom in/out<br>2. fullscreen mode<br>3. Re-orient the map. <br>4. Geolocation <br>5. and many more, you can also create your own Controls with the custom logic.</p><p>In our example, we will add only the 2 most popular controls contained in the <strong>mapboxgl</strong> library.</p><p>First of all, we add <strong>NavigationControl</strong>, which gives us the possibility to use <strong>zoom in, zoom out and rotation controls</strong>.</p><p>This is done as simply as possible:</p><pre>map.addControl(new mapboxgl.NavigationControl());</pre><figure><img alt="Navigation controls buttons" src="https://cdn-images-1.medium.com/max/396/1*UHNSYOJH-S1Kb-VNfveytg.png" /></figure><p>After that, 3 new buttons should appear on your map. By default, new Controls are always added to the top-right corner, but this is very easy to change if you want. Note the method<strong> map.addControl(…, </strong>&#39;top-right&#39;<strong>) and </strong>the second argument you can pass the position:<strong> </strong>valid values are &#39;top-left&#39; , &#39;top-right&#39; , &#39;bottom-left&#39; , and &#39;bottom-right&#39; .</p><h4>Markers</h4><p>A marker on a Mapbox map is a visual symbol that represents a specific location on the map. It’s usually represented by a small icon or a pin that can be customized to show different colors, shapes, and images. Markers are commonly used to indicate points of interest such as businesses, landmarks, or other important locations.</p><p>Let’s say we want to add a point on the map where are we going to meet with our friends and share this map to our friends. We will wait them on the parking :</p><pre> <br> const marker = new mapboxgl.Marker()<br>  .setLngLat([-79.0805,43.07594049])<br>  .addTo(map);</pre><p>Now our map should look like this, keep in mind that there are bunch of ways to customise the markers: you can use images, icons and text.</p><figure><img alt="Map with a marker" src="https://cdn-images-1.medium.com/max/1024/1*GpuuLUsWHEvHIMIHXFZqOQ.png" /></figure><h4>Sources?!</h4><p>In Mapbox, a <strong>Source</strong> is geospatial object data that is used to create and display Layers on a map. Source can be vector or raster, in fact, there are many more in Mapbox, but we will focus on only 2 for now.</p><p>A vector source can contain data in GeoJSON format, which represents the geometry of objects as points, lines and polygons. This data can be used to display layers on the map using special symbols, colors and styles.</p><p>A raster source is an image or set of images that can be used to create layers on a map, such as satellite imagery or elevation maps. Raster sources are usually larger in size than vector sources and may require more memory and computing resources.</p><p>Let’s highlight the other parking lots in the area on the map if all of the parking lots you’re meeting are occupied-just for this, we’ll use <strong>GeoJSON</strong>.</p><p>This is what our FeatureCollection will look like with the other two parking lots.</p><pre>const parkingData = {<br>  &quot;type&quot;: &quot;FeatureCollection&quot;,<br>  &quot;features&quot;: [<br>    {<br>      &quot;type&quot;: &quot;Feature&quot;,<br>      &quot;properties&quot;: {name: &quot;Parking 1&quot;},<br>      &quot;geometry&quot;: {<br>        &quot;coordinates&quot;: [<br>          [<br>            [<br>              -79.0863007196429,<br>              43.078176735849894<br>            ],<br>            [<br>              -79.0863007196429,<br>              43.07756367664959<br>            ],<br>            [<br>              -79.08422921340407,<br>              43.07756367664959<br>            ],<br>            [<br>              -79.08422921340407,<br>              43.078176735849894<br>            ],<br>            [<br>              -79.0863007196429,<br>              43.078176735849894<br>            ]<br>          ]<br>        ],<br>        &quot;type&quot;: &quot;Polygon&quot;<br>      }<br>    },<br>    {<br>      &quot;type&quot;: &quot;Feature&quot;,<br>      &quot;properties&quot;: {name: &quot;Parking 2&quot;},<br>      &quot;geometry&quot;: {<br>        &quot;coordinates&quot;: [<br>          [<br>            [<br>              -79.083818483719,<br>              43.07916805264233<br>            ],<br>            [<br>              -79.083818483719,<br>              43.07710713921787<br>            ],<br>            [<br>              -79.08213984935331,<br>              43.07710713921787<br>            ],<br>            [<br>              -79.08213984935331,<br>              43.07916805264233<br>            ],<br>            [<br>              -79.083818483719,<br>              43.07916805264233<br>            ]<br>          ]<br>        ],<br>        &quot;type&quot;: &quot;Polygon&quot;<br>      }<br>    }<br>  ]<br>}</pre><p>Add to the map Source with these data, we must necessarily add new Sources and Layers <strong>only after the map is loaded</strong>, for this we will listen to the event <strong>“load”</strong>, otherwise there will be an error during initialization of the map: <strong>“Error: Style is not done loading”.</strong></p><pre>map.on(&#39;load&#39;, () =&gt; {<br>  map.addSource(&#39;parkingSource&#39;, {<br>    type: &#39;geojson&#39;,<br>    data: parkingData<br>  });<br>});</pre><p>I think everything in the current code is clear, except the first argument <strong>map.addSource(‘parkingSource’, ….) </strong>— ‘<strong>parkingSource</strong>’ is a unique Source id that we will refer to a bit below to render our polygons on the map visually and to do this we will need to use Layer.</p><h4>Layer</h4><p>In Mapbox, a Layer is a graphical element on a map that displays data from a Source in a specific style and with specific properties. Layers are used to display geospatial data on a map, such as buildings, roads, rivers, country borders and other objects.</p><p>Each layer consists of several properties, such as:</p><ul><li>Layer Name - a unique name that identifies the layer on the map.</li><li>Data source - the source from which the layer gets its data.</li><li>Geometry type - the type of geometry that is used to display the layer’s data. This can be a point, a line, or a polygon.</li><li>Display style - the style used to display the geometry of the layer, including color, line width, textures, and other properties.</li><li>Filters - rules that determine which source data is displayed on the map.</li><li>Layer heights and order - determine how layers interact with each other and how they are displayed in 3D space.</li></ul><p>Layers can be used to create colorful and informative maps that are easy to read and interpret.</p><p>Adding new layer and using our already existed Source:</p><pre>map.on(&#39;load&#39;, () =&gt; {<br>  map.addSource(&#39;parkingSource&#39;, {<br>    type: &#39;geojson&#39;,<br>    data: parkingData<br>  });<br><br>  map.addLayer({<br>    &#39;id&#39;: &#39;parkingLayer&#39;,<br>    &#39;type&#39;: &#39;fill&#39;,<br>    &#39;source&#39;: &#39;parkingSource&#39;, // reference the data source<br>    &#39;paint&#39;: {<br>      &#39;fill-color&#39;: &#39;#00f907&#39;,<br>      &quot;fill-opacity&quot;: 0.4<br>    }<br>  });<br>});</pre><p>Let’s also increase our zoom a bit and place our marker in the center of the map.</p><pre>map.flyTo({<br>  center: marker.getLngLat(),<br>  speed: 0.2,<br>  zoom: 15<br>});</pre><p>Now our map should look like this, after the initialization of the map, you should see a smooth animation of movement.</p><figure><img alt="Map with polygons" src="https://cdn-images-1.medium.com/max/1024/1*lxHwCsZNURb7-MAXyfMkXA.png" /></figure><p>I think that’s enough for today 😊 I hope you got it all, if you still have any questions leave a comment or welcome to my example on <a href="https://jsfiddle.net/sobolevskidmitry/eskxhn4q/122/">jsfiddle</a>.</p><p>In the next article we’ll take apart Layers Styles and Layers Filters.<br><strong>Stay tuned!</strong></p><p>Reach me on <a href="https://www.linkedin.com/in/dmitry-sobolevsky/">LinkedIn</a> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99f8da810474" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Feature and FeatureCollection in GeoJSON.]]></title>
            <link>https://medium.com/@dmitry.sobolevsky/feature-and-featurecollection-in-geojson-f36ec38ebdb1?source=rss-84736a31d1b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/f36ec38ebdb1</guid>
            <category><![CDATA[features]]></category>
            <category><![CDATA[geojson]]></category>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[Dmitry Sobolevsky]]></dc:creator>
            <pubDate>Sat, 25 Mar 2023 20:24:36 GMT</pubDate>
            <atom:updated>2023-04-19T07:23:50.845Z</atom:updated>
            <content:encoded><![CDATA[<p>In <a href="https://medium.com/@dmitry.sobolevsky/geojson-tutorial-for-beginners-ce810d3ff169">the previous article</a>, we figured out what the basic GeoJSON blocks are. And now it’s time to break down the most important and most commonly used object types.</p><figure><img alt="Image with bricks" src="https://cdn-images-1.medium.com/max/1024/1*d4c70h0qY8vJ178QQ6lEBA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@mattseymour?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Matt Seymour</a> on <a href="https://unsplash.com/wallpapers/design/geometric?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>As we already remember in GeoJSON there are such types:<br>- Point 🔵<br>- LineString 📈<br>- Polygon 🟥<br>- MultiPoint 🔵🔴<br>- MultiLineString 📉📈<br>- MultiPolygon 🟥 🟦</p><h3>Feature 🏞</h3><p><strong>Feature</strong> in GeoJSON is an object that contains a geometric shape (such as types above ^) and properties (such as name, type, etc.) for that shape.</p><p>To illustrate this, imagine that you are drawing a map of a city. You would start by drawing different shapes on the map-for example or polygons to represent buildings or parks. Then you would add information about each shape, such as the name of the park or the type of building.</p><figure><img alt="Image of a park" src="https://cdn-images-1.medium.com/max/1024/1*kwvp7xi64jVdC6kh_gk_uQ.png" /><figcaption>Example of 1 Feature with Polygon</figcaption></figure><p>Suppose we have data about the boundaries of a the city park, and we want to represent this data in GeoJSON format. We can create a <strong>Feature</strong> for this polygon and keep park’s name and size as additional info.</p><pre><br>    {<br>      &quot;type&quot;: &quot;Feature&quot;,<br>      &quot;properties&quot;: {<br>        &quot;name&quot;: &quot;Olympic Park&quot;,<br>        &quot;size&quot;: &quot;85 hectares&quot;<br>      },<br>      &quot;geometry&quot;: {<br>        &quot;coordinates&quot;: [<br>          [<br>            [<br>              11.539417624693925,<br>              48.17613313877797<br>            ],<br>            [<br>              11.538077298468238,<br>              48.168150074081154<br>            ],<br>            [<br>              11.561556116500725,<br>              48.1685970352552<br>            ],<br>            [<br>              11.558505718881861,<br>              48.1759482169781<br>            ],<br>            [<br>              11.539417624693925,<br>              48.17613313877797<br>            ]<br>          ]<br>        ],<br>        &quot;type&quot;: &quot;Polygon&quot;<br>      }<br>    }</pre><p><strong>This “Feature” has three main components:</strong></p><ol><li><strong>type</strong>: specifies the type of the GeoJSON object, in this case it is “Feature”.</li><li><strong>geometry</strong>: defines the geometric shape of the object. In this example, it is a polygon, defined by a list of coordinates of the polygon vertices.</li><li><strong>properties</strong>: contains the properties of the object, such as park name and size. <strong>If you need to store additional information about a Feature, please keep it here</strong>.</li></ol><h3>FeatureCollection 🏞 🏝🏔</h3><p>A <strong>FeatureCollection</strong> is a set of geographic objects, each represented by a <strong>Feature</strong> object. Let’s imagine that we have the city of Munich, and we want to create a <strong>FeatureCollection</strong> for all the parks in the city.</p><figure><img alt="Image with boundaries of parks of the Munich" src="https://cdn-images-1.medium.com/max/1024/1*4w3l2SVyk8mh_aDL9yp2mQ.png" /></figure><p>Here’s what a <strong>FeatureCollection</strong> example might look like for the city of Munich and its parks, as you can see, a FeatureCollection is just an “array” of <strong>Feature</strong>s with extra fields.</p><pre>{<br>  &quot;type&quot;: &quot;FeatureCollection&quot;,<br>  &quot;features&quot;: [<br>    {<br>      &quot;type&quot;: &quot;Feature&quot;,<br>      &quot;properties&quot;: {<br>        &quot;name&quot;: &quot;Olympic Park&quot;,<br>        &quot;size&quot;: &quot;85 hectares&quot;<br>      },<br>      &quot;geometry&quot;: {<br>        &quot;coordinates&quot;: [ [...] ],<br>        &quot;type&quot;: &quot;Polygon&quot;<br>      }<br>    },<br>    {<br>      &quot;type&quot;: &quot;Feature&quot;,<br>      &quot;properties&quot;: {<br>        &quot;name&quot;: &quot;English garden&quot;,<br>        &quot;size&quot;: &quot;384 hectares&quot;,<br>      }<br>,<br>      &quot;geometry&quot;: {<br>        &quot;coordinates&quot;: [ [...] ],<br>        &quot;type&quot;: &quot;Polygon&quot;<br>      }<br>    },<br>    {<br>      &quot;type&quot;: &quot;Feature&quot;,<br>      &quot;properties&quot;: {<br>        &quot;name&quot;: &quot;Hirschgarten&quot;,<br>        &quot;size&quot;: &quot;40 hectares&quot;,<br>      },<br>      &quot;geometry&quot;: {<br>        &quot;coordinates&quot;: [ [...] ],<br>        &quot;type&quot;: &quot;Polygon&quot;<br>      }<br>    },<br>    ....</pre><p>Here are the main fields of a <strong>FeatureCollection</strong> object:</p><ol><li>“<strong>type</strong>”: This field indicates the type of the object, which in this case would be “<strong>FeatureCollection</strong>” to signify that it is a collection of features.</li><li>“<strong>features</strong>”: This field contains an array of <strong>Features.</strong></li><li>“<strong>bbox</strong>”: This field is an optional bounding box that represents the minimum bounding rectangle that contains all the features in the collection. It is represented as an array of four numbers, where the first two represent the lower left corner of the bounding box and the last two represent the upper right corner.</li><li>“<strong>metadata</strong>”: This field is also <strong>optional </strong>and contains additional metadata or information about the FeatureCollection. Basically it’s a JSON object and may contain any number of fields depending on the application or use case.</li></ol><p>You can store all kinds of information and add extra fields to the Feature and FeatureCollection root objects, but if you do this, your data will no longer meet the GeoJSON standards, although your code or application may still work.</p><p>I would also like to remind you about a very handy tool for exploring the GeoJSON format -&gt; geojson.io. There you can draw and see the raw data of any format described above.</p><p>That’s all for today! Stay tuned!</p><p>Reach me on <a href="https://www.linkedin.com/in/dmitry-sobolevsky/">LinkedIn</a> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f36ec38ebdb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GeoJSON Tutorial for Beginners]]></title>
            <link>https://medium.com/@dmitry.sobolevsky/geojson-tutorial-for-beginners-ce810d3ff169?source=rss-84736a31d1b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce810d3ff169</guid>
            <category><![CDATA[geojson]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[json]]></category>
            <dc:creator><![CDATA[Dmitry Sobolevsky]]></dc:creator>
            <pubDate>Wed, 15 Mar 2023 22:31:28 GMT</pubDate>
            <atom:updated>2023-04-19T07:24:36.022Z</atom:updated>
            <content:encoded><![CDATA[<h3>GeoJSON tutorial for beginners</h3><p>This is the first article in a series about working with maps in web development. Here I want to break down a very important type of data, without which it is very difficult to imagine the work of maps in modern web applications. So today we will analyze what <strong>GeoJSON</strong> is and what it consists of and what it is needed for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*32QG4MjNBvhoXHVxCE85_A.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@nasa?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">NASA</a> on <a href="https://unsplash.com/photos/_SFJhRPzJHs?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>GeoJSON is a data format for representing geographic objects and their attributes. It is used to store and exchange geodata such as points, lines and polygons, as well as their associated attributes such as name, description, address, etc. If you want more technical and official explanations, visit the GeoJSON format <a href="https://www.rfc-editor.org/rfc/rfc7946">page</a>.</p><p><strong>GeoJSON</strong> uses JSON text format to represent data, which makes it easily readable by humans and computers alike. In GeoJSON format, geometric objects are defined as <strong>Point</strong>, <strong>LineString</strong>, <strong>Polygon</strong>, <strong>MultiPoint</strong>, <strong>MultiLineString</strong>, and <strong>MultiPolygon</strong>.</p><p>In GeoJSON, it is also possible to set the coordinate system and other parameters of geometric objects, such as geometry type, coordinate accuracy and other properties, but we’ll get to that in the next article.</p><p>GeoJSON has become a widely used data format in the field of geoinformatics and in software development.</p><p>There are a bunch of JavaScript libraries that use GeoJSON for working with geographic data. Some popular libraries:</p><ol><li><strong>Mapbox GL JS</strong> —<strong> </strong>client-side JavaScript library for building web maps and web applications with Mapbox’s modern mapping technology<strong>.</strong></li><li><strong>Leaflet</strong> — open-source JavaScript library for mobile-friendly interactive maps.</li><li><strong>Turf.js</strong> — JavaScript library for performing spatial operations and analysis on GeoJSON data.</li><li><strong>D3.js</strong> — JavaScript library for producing dynamic, interactive data visualizations in web browsers</li><li><strong>OpenLayers</strong> — is an open-source JavaScript library for displaying map data in web browsers as slippy maps.</li><li>and many others…</li></ol><h4><strong>Point 🔴</strong></h4><p>A Point in GeoJSON is like <strong>a location</strong> on a treasure map. It’s a specific spot on the map that can be identified using a set of coordinates (latitude and longitude). Just like you might use an “X marks the spot” to indicate where a treasure is buried, a Point in GeoJSON uses coordinates to show where something is located on the Earth’s surface.</p><p>For example, if you were making a map of your neighborhood and wanted to show where your house is, you could use a <strong>Point</strong> in GeoJSON to mark the exact location of your house on the map.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5wM1fAsLYzRTx-v0MJ6qfg.png" /></figure><p>Overall, a Point is simply a way to represent a <strong>single location</strong> on a map.</p><p><strong>Point GeoJSON representation:</strong></p><pre>{<br>  &quot;coordinates&quot;: [<br>    8.308903076149363,<br>    47.05038385401457<br>  ],<br>  &quot;type&quot;: &quot;Point&quot;<br>}</pre><h4><strong>LineString 📈</strong></h4><p>A <strong>LineString</strong> in GeoJSON is like a path on a treasure map. It’s a line that connects a series of points, and it can be used to show a route or a path between two or more places.</p><p>For example, imagine you’re making a treasure map that leads to a hidden treasure. Or you just want to find the way to the closest bakery 🥨</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TnZ0sOEmduHq3TgOEDcOsA.png" /></figure><p>You might use a LineString to draw a path on the map that shows the route from the starting point to the treasure location. The LineString would be made up of a series of points that connect to form a line, just like a dot-to-dot drawing.</p><p>In GeoJSON, a LineString is a way to represent a series of connected points as a single object, making it easy to show a path or route on a map. It’s commonly used in applications such as navigation and transportation planning.</p><p><strong>LineString GeoJSON representation:</strong></p><pre>{<br>    &quot;coordinates&quot;: [<br>      [<br>        8.310242689008646,<br>        47.05429444841852<br>      ],<br>      [<br>        8.310504651721004,<br>        47.05399445514598<br>      ],<br>      [<br>        8.309440079847974,<br>        47.05356534791096<br>      ],<br>      [<br>        8.309228280208345,<br>        47.05341345071696<br>      ],<br>      [<br>        8.309100085689579,<br>        47.05285522481279<br>      ],<br>      [<br>        8.308498128818854,<br>        47.05292737678937<br>      ]<br>    ],<br>    &quot;type&quot;: &quot;LineString&quot;<br>  }</pre><h4><strong>Polygon </strong>🔲</h4><p>A Polygon in GeoJSON is like a <strong>shape</strong> on a treasure map. It’s a <strong>closed shape</strong> made up of straight lines, and it can be used to show the outline of an area, like a park, a lake, or a building.</p><p>For example, imagine you’re making a treasure map that leads to a castle. You might use a Polygon to draw the shape of the castle walls on the map. The Polygon would be made up of a series of points that connect to form a closed shape, just like drawing the outline of a castle on a piece of paper.</p><figure><img alt="Polygon example" src="https://cdn-images-1.medium.com/max/1024/0*YbLbrDXtyhltUy2Z" /><figcaption>Polygon example</figcaption></figure><h4>Polygon GeoJSON representation:</h4><pre>{<br> &quot;coordinates&quot;: [<br>   [<br>     [<br>       12.478129652015241,<br>       41.9022826549635<br>     ],<br>     [<br>       12.478129652015241,<br>       41.90136017129154<br>     ],<br>     [<br>       12.479303348926749,<br>       41.90136017129154<br>     ],<br>     [<br>       12.479303348926749,<br>       41.9022826549635<br>     ],<br>     [<br>       12.478129652015241,<br>       41.9022826549635<br>     ]<br>   ]<br> ],<br> &quot;type&quot;: &quot;Polygon&quot;<br>}</pre><p>Actually, Polygon GeoJSON is really similar to <strong>LineString</strong>, but the shape is closed and usually, in Polygon <strong>the first and the last coordinates</strong> are the same Point. Please, take a look at the example above.</p><h4>MultiPoint ⚪️</h4><p>A MultiPoint is like<strong> a collection of points</strong> on a treasure map. It’s a group of individual points, each with its own latitude and longitude coordinates, and it can be used to show the locations of multiple things on a map.</p><p>For example, imagine you’re making a treasure map that shows the locations of hidden gems throughout a park. You might use a MultiPoint to mark the locations of each gem on the map. The MultiPoint would be made up of a series of individual points, each with its own coordinates, just like putting multiple dots on a piece of paper to show the locations of different gems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EXnHAEyD4slc6F7S" /></figure><h4>MultiPont GeoJSON representation:</h4><pre>{<br>   &quot;type&quot;: &quot;MultiPoint&quot;,<br>   &quot;coordinates&quot;: [<br>     [<br>       -73.984,<br>       40.748<br>     ],<br>     [<br>       -73.985,<br>       40.749<br>     ],<br>     [<br>       -73.986,<br>       40.75<br>     ],<br>     [<br>       -73.987,<br>       40.751<br>     ]<br>   ]<br>}</pre><h4>MultiLineString 📈📉</h4><p>A MultiLineString in GeoJSON is like a group of paths on a treasure map. It’s a collection of lines that connect a series of points, and it can be used to show multiple routes or paths between different places on a map.</p><p>For example, imagine you’re making a treasure map that leads to a treasure chest, and you want to show three different possible routes that someone could take to get there. You might use a MultiLineString to draw three different paths on the map, each made up of a series of connected points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xPc0q_eAXhdZAA6M" /></figure><h4>MultiLineString GeoJSON representation:</h4><pre>{<br>     &quot;type&quot;: &quot;MultiLineString&quot;,<br>     &quot;coordinates&quot;: [<br>       [<br>         [<br>           2.3415215150407676,<br>           48.848216086115485<br>         ],<br>         [<br>           2.3407788857352045,<br>           48.847325398150645<br>         ],<br>         [<br>           2.3380359484630446,<br>           48.8480269147754<br>         ]<br>       ],<br>       [<br>         [<br>           2.330406031247776,<br>           48.84706528274708<br>         ],<br>         [<br>           2.3372693633740766,<br>           48.84692340104834<br>         ],<br>         [<br>           2.3372933191584764,<br>           48.84791656449744<br>         ]<br>       ],<br>       [<br>         [<br>           2.332755904765321,<br>           48.85020559607162<br>         ],<br>         ...,<br>         [<br>           2.336719866067824,<br>           48.84788609233465<br>         ]<br>       ]<br>     ]<br>}</pre><h3>MultiPolygon 🏔🌋🏝</h3><p>A MultiPolygon in GeoJSON is like <strong>a group of shapes</strong> on a treasure map. It’s a collection of polygons, each made up of a series of connected points, and it can be used to show <strong>multiple areas or regions</strong> on a map.</p><p>For example, imagine you’re making a treasure map that shows different types of land in a park, such as a forest, a meadow, and a lake. You might use a MultiPolygon to draw three different shapes on the map, <strong>each made up of a series of connected points</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nkSDQayg_a_IIwjR" /><figcaption>MultiPolygon example</figcaption></figure><pre>{<br>  &quot;type&quot;: &quot;FeatureCollection&quot;,<br>  &quot;features&quot;: [<br>    {<br>      &quot;type&quot;: &quot;Feature&quot;,<br>      &quot;properties&quot;: {},<br>      &quot;geometry&quot;: {<br>        &quot;type&quot;: &quot;MultiPolygon&quot;,<br>        &quot;coordinates&quot;: [<br>          [<br>            [<br>              [<br>                2.291863239086439,<br>                48.8577137262115<br>              ],<br>              [<br>                2.293452085617105,<br>                48.856693553273885<br>              ],<br>              [<br>                2.2968403487010107,<br>                48.85892279314069<br>              ],<br>              [<br>                2.2951175030651143,<br>                48.86006886087142<br>              ],<br>              [<br>                2.291863239086439,<br>                48.8577137262115<br>              ]<br>            ]<br>          ],<br>          [<br>            [<br>              [<br>                2.288226120523035,<br>                48.86156752523257<br>              ],<br>              [<br>                2.2899681088877344,<br>                48.86042149181674<br>              ],<br>              [<br>                2.290810388976098,<br>                48.86063558796482<br>              ],<br>              [<br>                2.2909826735397587,<br>                48.8611015587675<br>              ],<br>              [<br>                2.28947039792655,<br>                48.862234983151495<br>              ],<br>              [<br>                2.288226120523035,<br>                48.86156752523257<br>              ]<br>            ]<br>          ],<br>          [<br>          [<br>            [<br>              2.2912927602678224,<br>              48.85709062155263<br>            ],<br>            [<br>              2.2905402133688426,<br>              48.85661663833349<br>            ],<br>            [<br>              2.291917551492446,<br>              48.855746990243716<br>            ],<br>            [<br>              2.2926328654095016,<br>              48.85624492205244<br>            ],<br>            [<br>              2.2912927602678224,<br>              48.85709062155263<br>            ]<br>          ]<br>        ]<br>        ]<br>      }<br>    }<br>  ]<br>}</pre><p>That’s it! We’ve taken apart all the basic types of elements in GeoJSON, I hope this data format is now much clearer and easier for you.</p><p>And last, I would also like to share with you a very useful tool for exploring and visualizing GeoJSON data directly in your browser — <strong>https://geojson.io.</strong></p><p>If you suddenly do not understand some type of data, I advise you to try it in <strong>geojson.io</strong> and you will figure it out!</p><p>Stay tuned!</p><p>Reach me on <a href="https://www.linkedin.com/in/dmitry-sobolevsky/">LinkedIn</a> 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce810d3ff169" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>