<?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[SpatialOps - Medium]]></title>
        <description><![CDATA[spatialOps is all about GIS let it be open source or Enterprise, let it be product announcement or hack for something. - Medium]]></description>
        <link>https://medium.com/random-gis-talks?source=rss----7d884ac83aa4---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>SpatialOps - Medium</title>
            <link>https://medium.com/random-gis-talks?source=rss----7d884ac83aa4---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 03:04:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/random-gis-talks" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Create Openlayers map in React Part 1]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/random-gis-talks/create-openlayers-map-in-react-part-1-425f8481ea9d?source=rss----7d884ac83aa4---4"><img src="https://cdn-images-1.medium.com/max/2600/1*FOI9CXi7xy-7mxkRNSw0IA.png" width="2880"></a></p><p class="medium-feed-snippet">Believe it or not! There is no active package available which harnesses the power of Openlayers with the Components of react. ( We&#x2019;re&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/random-gis-talks/create-openlayers-map-in-react-part-1-425f8481ea9d?source=rss----7d884ac83aa4---4">Continue reading on SpatialOps »</a></p></div>]]></description>
            <link>https://medium.com/random-gis-talks/create-openlayers-map-in-react-part-1-425f8481ea9d?source=rss----7d884ac83aa4---4</link>
            <guid isPermaLink="false">https://medium.com/p/425f8481ea9d</guid>
            <category><![CDATA[zustand]]></category>
            <category><![CDATA[openlayers]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Krishna G. Lodha]]></dc:creator>
            <pubDate>Wed, 27 Jul 2022 18:39:56 GMT</pubDate>
            <atom:updated>2022-07-28T04:36:39.343Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Using Geofence to add layer level security in Geoserver]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/random-gis-talks/using-geofence-to-add-layer-level-security-in-geoserver-471493e4d80?source=rss----7d884ac83aa4---4"><img src="https://cdn-images-1.medium.com/max/2600/1*yxa7-eZ3DZtxYTi6OzdbRw.png" width="3840"></a></p><p class="medium-feed-snippet">In this blog, we&#x2019;ll explore how to install geofence in geoserver, defined various types of rules and access the data based on it.</p><p class="medium-feed-link"><a href="https://medium.com/random-gis-talks/using-geofence-to-add-layer-level-security-in-geoserver-471493e4d80?source=rss----7d884ac83aa4---4">Continue reading on SpatialOps »</a></p></div>]]></description>
            <link>https://medium.com/random-gis-talks/using-geofence-to-add-layer-level-security-in-geoserver-471493e4d80?source=rss----7d884ac83aa4---4</link>
            <guid isPermaLink="false">https://medium.com/p/471493e4d80</guid>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[geoserver]]></category>
            <category><![CDATA[geofence]]></category>
            <dc:creator><![CDATA[Krishna G. Lodha]]></dc:creator>
            <pubDate>Fri, 10 Sep 2021 14:39:42 GMT</pubDate>
            <atom:updated>2021-09-12T10:57:15.171Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Easy way to create Styling in Geoserver (GeoStyler)]]></title>
            <link>https://medium.com/random-gis-talks/easy-way-to-create-styling-in-geoserver-geostyler-a81478d7965f?source=rss----7d884ac83aa4---4</link>
            <guid isPermaLink="false">https://medium.com/p/a81478d7965f</guid>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[style]]></category>
            <category><![CDATA[geostyler]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[geoserver]]></category>
            <dc:creator><![CDATA[Krishna G. Lodha]]></dc:creator>
            <pubDate>Thu, 02 Sep 2021 11:45:04 GMT</pubDate>
            <atom:updated>2021-09-02T11:44:43.890Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jCKb3saMP7uMqD7CzGG0Xg.jpeg" /></figure><p>Video of the blog is available here: <a href="https://youtu.be/UzEorIBgbQA">https://youtu.be/UzEorIBgbQA</a></p><p>Geoserver is absolutely amazing tool. It allows us to host our data and share it using OGC standards such as WMS, WFS, etc. Geoserver also has amazing security features where we can create sets of rules, roles, users, groups, etc. to define security for reading, writing data. Geoserver also has the capability to extend its functionality based on external plugins.</p><h4>But..</h4><p>Geoserver lags at one thing. <em>Styling. </em>Geoserver supports SLD, YSLD, CSS styling languages, but the problem is if we want to write styling we have to type it in XML format (for SLD), which might be okay if you are from a development background, but if you are not, then it is a nightmare. Sample Point SLD showing simple red color point looks like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3FVB_bydRd9rNLIRWypj8A.png" /><figcaption>SLD Example</figcaption></figure><p>Scary right!! 👻</p><p>The solution to this is to use YSLD or CSS Styling. The above code in CSS looks like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*N1szZAwBeHTqFgeJwrBFhg.png" /></figure><p>But still, it looks like writing code. The solution to this is 🥁 🥁</p><h3>Geostyler</h3><p><a href="https://geostyler.org/">Geostyler</a> is an OSGEO project which helps us to create styling using a GUI. Geostyler also supports CLI and also has multiple npm packages which can help us to use the core logic in our own code as well. Geostyler is Open source, thus we can take components of it and plug them into our website as well.</p><p>Head over to the <a href="https://geostyler.github.io/geostyler-demo/">demo</a> link for Geostyler GUI</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oqBCXw91SvG75DlKyDpv3g.png" /></figure><p>GUI has the following key components :</p><ol><li>Language — We can switch between 4 major languages</li><li>Compact — We can change Graphical editor to compact and expanded mode</li><li>Symbolizer Rendered — Displaying Symbol in Graphical Editor using Openlayers or Geoserver standard</li><li>Load Style — Upload .sld files to make changes in it</li><li>Load Data — Upload Shapefile, GeoJSON or WFS connection to load the data based on which we can create rules</li><li>Graphical Editor — We write our rules for the styles over here. These rules contain information such as Symbol ( Color, Fill, Opacity, Border, shape, etc.), Rule name, Rule Filter (Comparison and logical operations), Min Scale after which data will be shows, Max Scale after which data should be hidden, Count, Duplicates.</li><li>Code editor — We can preview SLD code over here, we can also make changes inside this and those will be reflected in Graphical editor as well</li><li>Preview Map — Map is available for us to preview styling on data</li></ol><p>In this GUI, we can create the style however we want and then either download it as .sld using <em>Save as File </em>button simply copy it to Clipboard. Once this is done, we can import it into GeoServer and use it.</p><p>A better way to do this is 🥁 🥁</p><h3>Geostyler Plugin for GeoServer</h3><p>Geostyler has built a plugin that can allow us to open the graphical editor inside the GeoServer styling page directly, thus eliminating the need to export the SLD and import it again. Using plugin we can also see the result directly on the data. <br>Head over to <a href="https://build.geoserver.org/geoserver/">https://build.geoserver.org/geoserver/</a> and depending upon what version of GeoServer are you using click on the link (2.17.x, 2.18.x, etc.), head over to the community module’s link, and search for geostyler and download the plugin and unzip it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LFtU8tonEPcjfAnGXKIXdA.png" /><figcaption>geostyler-plugin.zip link</figcaption></figure><p>Paste the plugin in <em>geoserver/webapps/geoserver/WEB-INF/lib/ </em>folder and restart geoserver.</p><p>Once restarted, head over to the styling tab and open any styling and you’ll see geostyler option available inside it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uTNHWqf7gIq4J3Tb8vtQEg.jpeg" /></figure><p>This GeoStyler will also have the same graphical editor which will be linked with the SLD code editor available traditionally in geoserver. <br>Head over to the layer preview tab in Style and click on the <strong>Layer preview enabled </strong>checkbox in the GeoServer tab</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxEk13rSVsLMoRW4zTJACw.jpeg" /><figcaption>Geoserver Geostyler Plugin</figcaption></figure><p>We can now again make changes in this editor and it will be reflected to the layer immediately. We don’t have to worry about saving this style explicitly, because as we make changes, it it autosaved.</p><h3>Hurray 🎉🎉</h3><h4>GeoStyler Other capabilities</h4><p>Geostyler is more than just a graphical editor, Geostyler can be downloaded from <a href="https://github.com/geostyler/geostyler">GitHub</a> source and changed according to projects as well. Many products allow users to create style on the fly and uses GeoStyler’s <a href="https://www.npmjs.com/package/geostyler">npm packages</a>. Check out their docs <a href="https://geostyler.github.io/geostyler/latest/index.html#developer-guide">here</a></p><blockquote><strong><em>About</em></strong><em> </em><strong><em>me</em></strong></blockquote><p>Hi, I’m Krishna Lodha, I’m a full-stack Web GIS developer. I’m really enthusiastic about the power of locations and what story it tells us. Read more about me at <a href="https://krishnaglodha.com/">https://krishnaglodha.com</a>, to get more information about this code or suggest a better way to do it. ping me on <a href="https://www.linkedin.com/in/krishnaglodha/">LinkedIn</a> 💼 , <a href="https://twitter.com/krishnaglodha">Twitter</a> 🐦 , and <a href="https://www.youtube.com/channel/UC7IQzdf_jn3gkt_9K0TDQmg?view_as=subscriber">Youtube</a>📺</p><p>Adios!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a81478d7965f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/random-gis-talks/easy-way-to-create-styling-in-geoserver-geostyler-a81478d7965f">Easy way to create Styling in Geoserver (GeoStyler)</a> was originally published in <a href="https://medium.com/random-gis-talks">SpatialOps</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keys and Constraints in Relational Database]]></title>
            <link>https://medium.com/random-gis-talks/keys-and-constraints-in-relational-database-51cbcea741cb?source=rss----7d884ac83aa4---4</link>
            <guid isPermaLink="false">https://medium.com/p/51cbcea741cb</guid>
            <category><![CDATA[relational-databases]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Krishna G. Lodha]]></dc:creator>
            <pubDate>Sat, 16 Jan 2021 10:53:50 GMT</pubDate>
            <atom:updated>2021-01-16T10:54:34.122Z</atom:updated>
            <content:encoded><![CDATA[<p>This post is part 2 of the article series ‘Database in 2021’, in <a href="https://medium.com/random-gis-talks/database-guide-in-2021-4199b7156e42">Part 1</a>, we saw basics such as What is Data? , What is Database? Types of Database? CRUD Operations in RDBMS ( PostgreSQL ). I hope you are familiar with all these before you start reading below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wi2AWZVTJpCzs_9McTeTHQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@bradfordnicolas?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Bradford Nicolas</a> on <a href="https://unsplash.com/s/photos/key?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>What makes a Relational Database actually Relational?</h4><p>Good Question! As the name suggests, there must be a way we can establish relations between multiple or the same tables or columns, so that we can save more data without making it complex to read. <br>example — For a franchise company such as MacDonalds or Dominos, they must be having some central data that is common to all stores, Regional Data that is common to some stores, and store data which is basically valid only for that store. In order to store all such data in databases and making sense out of it, a lot of connections between such tables, columns will be made. <br>In this blog post, we’ll try to make sense of all the cool features RDBMS provides to tackle such types of use cases. <br>🔑 <strong>KEYS in RDBMS — <br></strong>Keys are nothing but attributes in the table. Keys denote a special crucial characteristic to a column. Different types of keys in RDBMS are <br>1. Super Key <br>2. Composite Key<br>3. Foreign Key<br>4. Candidate Key<br>5. Primary Key<br>6. Alternate Key<br>7. Surrogate Key<br>In order to keep the blog short and simple, we’ll only discuss the most widely used keys.<br>🔑 <strong>Primary Key — </strong>Primary Key is assigned to the column, which acts as a head column, the primary key will contain a unique ID (0,1,2,3,…) to make it easy for the user to access the row data. Every table will have one and only one Primary key column. When we use software like pgAdmin, it helps us to take care of creating primary key easily. By Default column with the name ‘id’ will be created and treated as Primary key, but if you are dead set on using your own column as primary key, you can also do that as following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PjTBsKwdB21XM0yb-SjWxg.gif" /><figcaption>Creating a new table with a custom primary key</figcaption></figure><p>The Query Tool way for doing the same will be as following :</p><pre><strong>CREATE</strong> <strong>TABLE</strong> <strong>&lt;tablename&gt;</strong> <br>(  &lt;column1&gt; &lt;data_type&gt; PRIMARY <strong>KEY</strong>,  <br>&lt;column2&gt; &lt;data_type&gt;,  <br>… );</pre><p>in our case, it will be</p><pre>create table store_table<br>( storeId INTEGER PRIMARY KEY,<br>storelocation TEXT,<br>storeSize INTEGER ) ;</pre><p>All the columns except Primary Key are known as <strong>Alternate Keys<br></strong>🔑 <strong>Foreign Keys — </strong>Foreign Keys are an important column that helps us to connect 2 tables based on their primary keys. Using pgAdmin we can establish a relationship between multiple tables as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D1w2e6rZC7khYMqWDJ-f5w.gif" /><figcaption>Creating Foreign Keys</figcaption></figure><p>The Query Tool way to do the same is as follows :</p><pre>ALTER TABLE &lt;table1&gt; add constraint &lt;col_table1&gt; foreign key(&lt;col_table2&gt;) REFERENCES &lt;table2&gt;(&lt;col_table2&gt;) ON UPDATE CASCADE ON DELETE CASCADE;</pre><p>In our case, we’ll have to perform this in 2 steps, first is to add a column in the first table to hold the value of a key, and then adding a constraint to it.</p><pre>-- adding &#39;amenity_store_id&#39; column to &#39;store_table&#39; </pre><pre>ALTER TABLE store_table ADD COLUMN amenity_store_id integer </pre><pre>-- adding &#39;foregin key&#39; constraint to &#39;amenity_store_id&#39; column</pre><pre>ALTER TABLE store_table add constraint amenity_store_id foreign key(amenity_store_id) REFERENCES store_amenities(amenity_id) ON UPDATE CASCADE ON DELETE CASCADE;</pre><p>🚪<strong> Constraints in RDBMS —<br> </strong>Constraints in a nutshell are rules that column must follow in order to work properly. In Simple words, constraints allow us to be very strict with the column and data it is supposed to hold, so that even someone tries to enter the wrong data, the database will not accept it. Some of the most widely used constraints are as follows :<br>🚪 <strong>Not NULL</strong> — Self-explanatory! Isn’t it!! By default, every column has a null value for every entry, which means you can skip filling up information for the specific column if you want. But if you want to stop that behaviour, you can then add <strong>Not NULL </strong>Constrain to that column. in pgAdmin, you can easily do that by clicking on Nou Null switch in column popup</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yeIVdxUiS2zxaOCRPCFWXQ.png" /><figcaption>Not Null switch in the column list</figcaption></figure><p>you can also do that in Query Tool as follow :</p><pre>CREATE TABLE &lt;tablename&gt; <br>(&lt;column1&gt; &lt;data_type&gt; NOT <strong>NULL</strong>,<br>&lt;column2&gt; &lt;data_type&gt;,<br>&lt;column3&gt; &lt;data_type&gt; NOT <strong>NULL</strong>,<br>    ... );</pre><p>🚪 <strong>Unique — </strong>Again! Self-explanatory! Isn’t it!! By default you can enter any value in rows ( as long as data type matches ) but this might create problem in situations where you want each row to have distict value for the column. We can add this contraint my going in table properties using pgAdmin,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PGsRIwAVfBxtZA7oqvFGyQ.png" /><figcaption>adding unique contraint on ‘storelocation’ column</figcaption></figure><p>we can also do that in Query Tool as follow :</p><pre>CREATE TABLE &lt;tablename&gt; <br>(&lt;column1&gt; &lt;data_type&gt; UNIQUE,<br>&lt;column2&gt; &lt;data_type&gt;,<br>&lt;column3&gt; &lt;data_type&gt; UNIQUE,<br>    ... );</pre><p>If we try to insert same value twice, we’ll get following error</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*558NeW8rdTsVaEqK92tJ6g.png" /><figcaption>Error for duplicate value insertion</figcaption></figure><p>🚪<strong> Primary Key </strong>&amp; <strong>Foreign Key </strong>— These are also constriants on column, adding both of these are explained in <strong>Keys in RDBMS </strong>Section of this article</p><blockquote>Primary key can be considered as UNIQUE + NOT NULL constraint</blockquote><p>🚪 <strong>CHECK — </strong>Check Constraints gives us ability to check the value with certain condition before allowing it to be stored. E.g. — Store Size should be positive only ( &gt; 0 ) . in pgAdmin we can do that as follows :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ECFIhA6mJS-NzbUfGfjEjQ.png" /><figcaption>Creating Check constraint for storeSize column</figcaption></figure><p>we can also do that in Query Tool as follow :</p><pre>CREATE TABLE &lt;tablename&gt; <br>(&lt;column1&gt; &lt;data_type&gt; CHECK( &lt;condition&gt; ) ,<br>&lt;column2&gt; &lt;data_type&gt;,<br>&lt;column3&gt; &lt;data_type&gt; ,<br>    ... );</pre><p>If we try to insert value which might not pass the condition , we’ll get following error</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZdWKDlbdAUzzGPUv-Dwzg.png" /><figcaption>Error for not passing the check</figcaption></figure><blockquote>About me</blockquote><p>Hi, I’m Krishna Lodha, I’m a full-stack Web GIS developer. I’m really enthusiastic about the power of locations and what story it tells us. Read more about me at <a href="http://krishnaglodha.com/">http://krishnaglodha.com</a>, to get more information about this code or suggest a better way to do it. ping me on <a href="https://www.linkedin.com/in/krishnaglodha/">LinkedIn</a> 💼 , <a href="https://twitter.com/krishnaglodha">Twitter</a> 🐦 , and <a href="https://www.youtube.com/channel/UC7IQzdf_jn3gkt_9K0TDQmg?view_as=subscriber">Youtube</a>📺</p><p>Adios!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51cbcea741cb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/random-gis-talks/keys-and-constraints-in-relational-database-51cbcea741cb">Keys and Constraints in Relational Database</a> was originally published in <a href="https://medium.com/random-gis-talks">SpatialOps</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing GDAL plugin on Geoserver binary]]></title>
            <link>https://medium.com/random-gis-talks/installing-gdal-plugin-on-geoserver-binary-481a0c61688f?source=rss----7d884ac83aa4---4</link>
            <guid isPermaLink="false">https://medium.com/p/481a0c61688f</guid>
            <category><![CDATA[geoserver]]></category>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[gdal]]></category>
            <category><![CDATA[installation]]></category>
            <dc:creator><![CDATA[Krishna G. Lodha]]></dc:creator>
            <pubDate>Tue, 08 Dec 2020 15:15:49 GMT</pubDate>
            <atom:updated>2020-12-08T15:19:52.072Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rZT4XaTLctpFUxKX-crRkw.png" /><figcaption>Photo by <a href="https://unsplash.com/@chuttersnap?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">CHUTTERSNAP</a> on <a href="https://unsplash.com/s/photos/add-map?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>GeoServer is a JAVA based application developed to ease the styling and sharing of geospatial data using Opensource technology. It follows the standards of the <a href="http://www.opengeospatial.org/">Open Geospatial Consortium (OGC)</a> and thus has wide application in a variety of industries. GeoServer’s <a href="http://geoserver.org/">website</a> states more clearly regarding its usability and documentation.</p><blockquote>Let’s install GDAL plugin for Geoserver 2.18.0</blockquote><p>Make sure that you are aware of the geoserver version you are using. You can check it as follow</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XtoC8Et-5MpfnlBzQWOtRg.jpeg" /><figcaption>Check Geoserver Version</figcaption></figure><h4>Install GDAL plugin :</h4><p>Head over to <a href="http://geoserver.org/download/">geoserver.org</a> and click on the link mentioning your GeoServer Version and scroll down to extensions tab, there you can find GDAL plugin. Click on plugin to download the zip.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EZHBng77Vcc6kOF7It2TqA.jpeg" /><figcaption>Click on GDAL to download plugin</figcaption></figure><p>Once the Zip is downloaded successfully, unzip it and copy all .jar files in the unzipped folder to <strong>/usr/share/geoserver/webapps/geoserver/WEB-INF/lib/</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vIIgy_uWlSCqCd_PTMbk-w.jpeg" /><figcaption>Copy .jar file from plugin to lib folder in geoserver</figcaption></figure><p>Once the plugin is copied successfully, We need to also install GDAL into core OS.</p><h4><strong>Install GDAL on Ubuntu :</strong></h4><p>Fire up new terminal and paste following command</p><pre>sudo apt-get install gdal-bin libgdal-java</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Njp9FnbKtE1tVee-QJ_UqA.png" /><figcaption>install gdal on ubuntu</figcaption></figure><p>Generally this will install <strong>/usr/ </strong>folder</p><pre>export LD_LIBRARY_PATH=/&lt;path_to_gdal_install&gt;/lib<br>export GDAL_DATA=/&lt;path_to_gdal_install&gt;/share/gdal</pre><p>for me &lt;path_to_gdal_install&gt; is usr, thus above to commands for me will be</p><pre>export LD_LIBRARY_PATH=/usr/lib<br>export GDAL_DATA=/usr/share/gdal</pre><h4>Restart GeoServer :</h4><p>Once everything is done, stop the server and start again by calling <em>startup.sh</em> file.</p><p>Go to Stores and click on <strong>add new stores</strong> and you will see all available raster formats.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mSb0mEbVAjxAc-7LXLJTMQ.jpeg" /><figcaption>access different Raster formats by clicking on create new store</figcaption></figure><blockquote>About me</blockquote><p>Hi, I’m Krishna Lodha, I’m a full-stack Web GIS developer. I’m really enthusiastic about the power of locations and what story it tells us. Read more about me at <a href="http://krishnaglodha.com/">http://krishnaglodha.com</a>, to get more information about this code or suggest a better way to do it. ping me on <a href="https://www.linkedin.com/in/krishnaglodha/">LinkedIn</a> 💼 , <a href="https://twitter.com/krishnaglodha">Twitter</a> 🐦 , and <a href="https://www.youtube.com/channel/UC7IQzdf_jn3gkt_9K0TDQmg?view_as=subscriber">Youtube</a>📺</p><p>I write most of my post for the ‘<strong>Random GIS Talks</strong>’, which is a medium publication dedicated to posts regarding GIS installations, inventions, technologies, Case studies, etc. make sure to hit the subscribe button to stay updated for further posts 👉🏻 <a href="https://medium.com/random-gis-talks">here</a> 👈🏻</p><p>Make sure to leave 👏🏻 to the posts, this boosts the motivation for me to write more 😄</p><p>Adios!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=481a0c61688f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/random-gis-talks/installing-gdal-plugin-on-geoserver-binary-481a0c61688f">Installing GDAL plugin on Geoserver binary</a> was originally published in <a href="https://medium.com/random-gis-talks">SpatialOps</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing Geoserver Binary️ on Ubuntu 18.04 using terminal]]></title>
            <link>https://medium.com/random-gis-talks/installing-geoserver-binary%EF%B8%8F-on-ubuntu-18-04-using-terminal-ff9429ab47fa?source=rss----7d884ac83aa4---4</link>
            <guid isPermaLink="false">https://medium.com/p/ff9429ab47fa</guid>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[geoserver]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[terminal]]></category>
            <dc:creator><![CDATA[Krishna G. Lodha]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 09:14:19 GMT</pubDate>
            <atom:updated>2021-10-03T17:11:51.177Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BgbO37WVo8RiKRKR19sJ0g.png" /></figure><p>Geoserver is a JAVA based application developed to ease the styling and sharing of geospatial data using Opensource technology. It follows the standards of the <a href="http://www.opengeospatial.org/">Open Geospatial Consortium (OGC)</a> and thus has wide application in a variety of industries. Geoserver’s <a href="http://geoserver.org/">website</a> states more clearly regarding its usability and documentation.</p><blockquote>Let us begin by understanding the requirements and steps in order to install and run geoserver successfully</blockquote><p>Installing Geoserver in a GUI-based system such as Windows, Mac or even Ubuntu GUI is a piece of cake 🍰. Have a look at my blogs about 👉 <a href="https://medium.com/random-gis-talks/installing-geoserver-binary-in-windows-9ce2d6348245">windows</a> 👈 or about 👉 <a href="https://medium.com/random-gis-talks/installing-geoserver-binary-on-mac-os-x-322fdae18512">mac</a> 👈installations, If you have GUI access for Ubuntu machine you can follow similar steps for mac.</p><p>But If you just have a connection to ssh terminal and that’s all. Roll up your sleeves and follow this blog!</p><p>First things first, try to use the terminal as an admin user so you don’t have to type password zillion times.Make yourself the owner and go to the root directory :</p><pre>sudo -u root -i</pre><p>also, make sure you have an updated system</p><pre>sudo apt-get update</pre><h4>Step 1: Check/Install JAVA 8</h4><p>Geoserver currently only supports JAVA-JRE-8, you can install it by typing</p><pre>sudo apt-get install openjdk-8-jdk</pre><pre>sudo apt-get install openjdk-8-jre</pre><p>To cross-check installation, type</p><pre>java -version </pre><p>and you should get something similar to this as an output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h_1jrGAJiz_cJlHKU8p8Wg.png" /><figcaption>java -version output showing version 1.8 is installed</figcaption></figure><h4>Step 2: Installation of Postgres ( Optional )</h4><p>Most of the time, we prefer to save the data in the database so that it can be accessible can used by a lot of other applications as well. Sure <em>Shapefile </em>is better for saving Geospatial data, but it comes with a lot of compromises as well (e.g. not been able to read it/edit without software, etc.). I personally prefer <a href="https://www.postgresql.org/">Postgres</a> over other <a href="https://en.wikipedia.org/wiki/Relational_database#RDBMS">RDBMS</a>, since it is by far the world’s most advanced open-source relational database, and to put the cherry on top of this cake, it also allows us to leverage geospatial capabilities by installing and using <a href="https://postgis.net/install/">PostGIS</a>, PostGIS allows user to query the data using geospatial component ( buffer, within, intersects, etc. )</p><p>We’ll start by first installing the latest PostgreSQL version:</p><pre>sudo apt install postgresql postgresql-contrib</pre><p>Once the installation is done, you can use PostgreSQL by typing:</p><pre>sudo su - postgres</pre><p>and then type <strong><em>psql </em></strong>to open a window like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dDUyubxno0biVwxrMMKsgw.png" /></figure><p>you can get out of PostgreSQL by typing <strong><em>\q </em></strong>and then <strong><em>exit</em></strong></p><p>Now, you can install PostGIS:</p><pre>sudo apt install postgis</pre><h4>Step 3: Downloading GeoServer</h4><p>Downloading GeoServer without GUI might get a little tricky since we can’t simply do <em>sudo apt get geoserver </em>(Not at least by the time I’m writing the article 😔 ). But no worries!! If you visit the GeoServer download page, you’ll see that they use Sourceforge to keep their repo, when you click on download, you get redirected and GeoServer starts getting downloaded. If you remove the <em>download</em> from the URL, you’ll get a URL that can be used to download GeoServer zip using terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ij88uK_-V1oHYxyoch9UQA.png" /><figcaption>Geoserver Download page (Focus on URL)</figcaption></figure><p>now we need a safe place to download and unzip the GeoServer. <br>We’ll create a new directory and put GeoServer in it</p><pre>cd /usr/share<br>mkdir geoserver<br>cd geoserver</pre><pre>wget <a href="https://sourceforge.net/projects/geoserver/files/GeoServer/2.18.1/geoserver-2.18.1-bin.zip/download">https://sourceforge.net/projects/geoserver/files/GeoServer/2.18.1/geoserver-2.18.1-bin.zip</a></pre><p>This will download a <em>geoserver-2.18.1-bin.zip </em>file in a GeoServer folder that we just created.<br>The next step is to unzip the <em>geoserver-2.18.1-bin.zip.</em></p><pre>unzip <em>geoserver-2.18.1-bin.zip</em></pre><p>This will unzip the GeoServer folder, and if you type <strong><em>ls </em></strong>in the command line, you’ll see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*tB1bq_052Sc4iq4RCmRewA.png" /></figure><p>Finally, we’ll set up a variable to make it workable</p><pre>echo &quot;export GEOSERVER_HOME=/usr/share/geoserver&quot; &gt;&gt; ~/.profile<br>. ~/.profile</pre><p>and make sure that the user is the owner of this folder as well</p><pre>sudo chown -R USER_NAME /usr/share/geoserver/</pre><h4><strong>Step 4: Once everything is done!</strong></h4><blockquote>You are there!!</blockquote><p>Geoserver is successfully installed and you can now turn it up.<br>head over to <em>bin</em> directory and open <em>startup.sh</em> file</p><pre>cd bin<br>sh startup.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xTepQ7odORcLeadsArueng.png" /><figcaption>Geoserver started</figcaption></figure><p>Then you’ll see stuff beaming up on your terminal, and when you finally see a text something like in the photo, your GeoServer is up and running.</p><h4>Step 5: Making Geoserver ready for usage!</h4><p>Since you have installed GeoServer with Terminal, I’m guessing this is for your server, which means we need to be sure that the GeoServer and data inside it is accessible publicly. The default port for GeoServer is <strong><em>8080,</em></strong><em> </em>which must be open in your server in order to be able to access GeoServer from anywhere, another business we need to take care of is the <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS">CORS policy</a>, Geoserver allows users to get the data as a JSON, XML, etc. hence it is quite important to secure your data. If you try to use GeoServer right now, if you access the layers from another, it’ll show you a CORS error.<br>In order to solve this, you need to uncomment few lines in a <strong><em>web.xml </em></strong>file, which is generally located at</p><blockquote>geoserver/webapps/geoserver/WEB-INF</blockquote><p>Once you reach in a folder using the terminal, you can open and edit the file using <a href="https://en.wikipedia.org/wiki/Vim_(text_editor)">vim</a>. You can install vim by simply typing</p><pre>sudo apt install vim</pre><p>and then you can open the <em>web.xml</em> file using vim:</p><pre>sudo vim web.xml</pre><p>Vim allows us to modify the file from the terminal. click <strong><em>I (Captial i)</em></strong> to get into insert mode and use arrow keys to move down until you find a line with <strong>CORS in Jetty </strong>written.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V3xLriVGZDv7ixnz20vW9w.png" /><figcaption>CORS Jetty</figcaption></figure><p>Once you find it, Uncomment the code and again search for CORS, Since we are not using tomcat, you can keep CORS related to tomcat commented. You can find the third and final code for CORS.</p><p>Once both of these CORS codes are uncommented. You can hit the <strong><em>Esc</em></strong> key to get out of edit mode and type <strong><em>:wq </em></strong>to save the changes in web.xml</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*EtDmZNz9FdjfpGG7J1Rlxw.png" /></figure><p>Now you can head back to the bin folder again and run the GeoServer like</p><p><strong>Step 4.</strong>If you get an error while accessing GeoServer, Make sure to head back to the web.xml file and double-check all comments and uncomments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*HNmJORPY64HvI7xg71vQ6g.png" /><figcaption>503 Error HTTP</figcaption></figure><h3>And we are done!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*ExrEQM5CmQ--rVpWk74J8g.gif" /><figcaption><a href="https://media.giphy.com/media/26tPplGWjN0xLybiU/source.gif">https://media.giphy.com/media/26tPplGWjN0xLybiU/source.gif</a></figcaption></figure><blockquote>In this blog, we succeeded to install JAVA, PostgreSQL, PostGIS, Geoserver using terminal!!</blockquote><blockquote>About me</blockquote><p>Hi, I’m Krishna Lodha, I’m a full-stack Web GIS developer. I’m really enthusiastic about the power of locations and what story it tells us. Read more about me at <a href="http://krishnaglodha.com/">http://krishnaglodha.com</a>, to get more information about this code or suggest a better way to do it. ping me on <a href="https://www.linkedin.com/in/krishnaglodha/">LinkedIn</a> 💼 , <a href="https://twitter.com/krishnaglodha">Twitter</a> 🐦 , and <a href="https://www.youtube.com/channel/UC7IQzdf_jn3gkt_9K0TDQmg?view_as=subscriber">Youtube</a>📺</p><p>I write most of my post for the ‘<strong>Random GIS Talks</strong>’, which is a medium publication dedicated to posts regarding GIS installations, inventions, technologies, Case studies, etc. make sure to hit the subscribe button to stay updated for further posts 👉🏻 <a href="https://medium.com/random-gis-talks">here</a> 👈🏻</p><p>Make sure to leave 👏🏻 to the posts, this boosts the motivation for me to write more 😄</p><p>Adios!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff9429ab47fa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/random-gis-talks/installing-geoserver-binary%EF%B8%8F-on-ubuntu-18-04-using-terminal-ff9429ab47fa">Installing Geoserver Binary️ on Ubuntu 18.04 using terminal</a> was originally published in <a href="https://medium.com/random-gis-talks">SpatialOps</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Everything about GeoJSON]]></title>
            <link>https://medium.com/random-gis-talks/everything-about-geojson-67ddc6eda11e?source=rss----7d884ac83aa4---4</link>
            <guid isPermaLink="false">https://medium.com/p/67ddc6eda11e</guid>
            <category><![CDATA[qgis]]></category>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[geojson]]></category>
            <dc:creator><![CDATA[Krishna G. Lodha]]></dc:creator>
            <pubDate>Sun, 22 Nov 2020 16:22:08 GMT</pubDate>
            <atom:updated>2024-05-15T09:02:16.744Z</atom:updated>
            <content:encoded><![CDATA[<p>As the name suggests, GeoJSON is a combination of two words, Geographical and JSON, but if we try to understand it in more depth, the simple definition can be <strong>A</strong> <strong><em>JSON object accomodating information about the specific geometry (e.g. Point, Line, Polygon, etc.) along with optional metadata (e.g. id, etc.) <br></em></strong>In a world full of APIs, developers rely on information communicated mostly through JSON or XML most of the time. Thus to talk smoothly with existing logics and standards, GeoJSON was introduced.</p><h3>What is a GeoJSON file?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IRVgzdmSuWK8sclDjovtKA.jpeg" /></figure><p>GeoJSON file is written in the same way JSON is written. the extension for GeoJSON file is (well no surprise here! ) <strong><em>.geojson</em></strong></p><p>GeoJSON file follows a pattern, which is pretty standard and if broken, might week the geojson file. A standard GeoJSON file looks like this</p><pre>{<br>  &quot;type&quot;: &quot;FeatureCollection&quot;,<br>  &quot;features&quot;: [<br>  // GeoJSON features goes here<br> ],<br>// Extra optional metadata<br> &quot;crs&quot;: {<br>    &quot;type&quot;: &quot;name&quot;,<br>    &quot;properties&quot;: {<br>      &quot;name&quot;: &quot;EPSG:3857&quot;<br>    }<br>  }<br>}</pre><p>It is a Javascript Object or Python Dictionary, with certain keywords that must be there and certain optional</p><pre>&quot;type&quot; : &quot;FeatureCollection&quot;</pre><p>this must be available in the GeoJSON file as it indicated that the file contains features.</p><pre>&quot;features&quot; : [ <br>// Here we add all the features <br>]</pre><p>A typical example of GeoJSON Point feature is</p><pre>{<br>  &quot;type&quot;: &quot;Feature&quot;,<br>  &quot;geometry&quot;: {<br>    &quot;type&quot;: &quot;Point&quot;,<br>    &quot;coordinates&quot;: [21.22,71.23]<br>  },<br>  &quot;properties&quot;: {<br>    &quot;Cafe_name&quot;: &quot;Central Perk&quot;,<br>    &quot;Owner&quot;: &quot;Gunther&quot;<br>  }<br>}</pre><p>A typical example of GeoJSON LineString feature is</p><pre>{<br>  &quot;type&quot;: &quot;Feature&quot;,<br>  &quot;geometry&quot;: {<br>    &quot;type&quot;: &quot;LineString&quot;,<br>    &quot;coordinates&quot;:  [<br>          [8816056.117179131,2807009.212192692],<br>          [8829495.514106864,2610747.6742997607],<br>          [8942180.802355455,2644853.040425635]<br>        ]<br>  },<br>  &quot;properties&quot;: {<br>    &quot;Street_name&quot;: &quot;Wall street&quot;<br>  }<br>}</pre><p>A typical example of GeoJSON Polygon feature is</p><pre>{<br>  &quot;type&quot;: &quot;Feature&quot;,<br>  &quot;geometry&quot;: {<br>    &quot;type&quot;: &quot;Polygon&quot;,<br>    &quot;coordinates&quot;:  [<br>        [<br>          [9816056.117179131,2807009.212192692],<br>          [9829495.514106864,2610747.6742997607],<br>          [9942180.802355455,2644853.040425635],         <br>          [9816056.117179131,2807009.212192692]<br>        ]<br>    ]<br>  },<br>  &quot;properties&quot;: {<br>    &quot;City&quot;: &quot;Pasadena&quot;<br>  }<br>}</pre><p>Apart from these standard geometries, we can also draw MultiPoint, MultiLineString, MultiPolygon, etc.</p><p>Apart from &quot;type&quot; and &quot;features&quot; , you can add certain metadata properties to GeoJSON which will be optional and will serve just the informational purpose. e.g.</p><pre>&quot;crs&quot;: {<br>    &quot;type&quot;: &quot;name&quot;,<br>    &quot;properties&quot;: {<br>      &quot;name&quot;: &quot;EPSG:3857&quot;<br>    }<br>  }</pre><p>An example of complete GeoJSON is as follow</p><pre>{<br>  &quot;type&quot;: &quot;FeatureCollection&quot;,<br>  &quot;features&quot;: [<br>{<br>  &quot;type&quot;: &quot;Feature&quot;,<br>  &quot;geometry&quot;: {<br>    &quot;type&quot;: &quot;Point&quot;,<br>    &quot;coordinates&quot;: [1421881.6001608493,87787.9269855246]<br>  },<br>  &quot;properties&quot;: {<br>    &quot;Cafe_name&quot;: &quot;Central Perk&quot;,<br>    &quot;Owner&quot;: &quot;Gunther&quot;<br>  }<br>},<br>{<br>  &quot;type&quot;: &quot;Feature&quot;,<br>  &quot;geometry&quot;: {<br>    &quot;type&quot;: &quot;Polygon&quot;,<br>    &quot;coordinates&quot;:  [<br>        [<br>          [2377382.6722396947,1196468.8037478637],<br>          [2440022.8169193966,721756.6395827765],<br>          [1864031.5902764509, 590093.8583615604],         <br>          [2377382.6722396947,1196468.8037478637]<br>        ]<br>    ]<br>  },<br>  &quot;properties&quot;: {<br>    &quot;City&quot;: &quot;Pasadena&quot;<br>  }<br>}<br> ],<br> &quot;crs&quot;: {<br>    &quot;type&quot;: &quot;name&quot;,<br>    &quot;properties&quot;: {<br>      &quot;name&quot;: &quot;EPSG:3857&quot;<br>    }<br>  }<br>}</pre><blockquote><em>*Quick Note: Make sure that you remove all the comments from GeoJSON, as it is not allowed to write comments</em></blockquote><h4>Saving GeoJSON with .json</h4><p>Technically, Yes. GeoJSON is also at the end of the day JSON, you can save it as a .json file as well, given that you follow the standard mentioned earlier</p><h3>How to Create GeoJSON</h3><p>GeoJSON can be created with variety of online tools or using the software as well. Coordinates for the geometry are coordinate reference systems (CRS), dependant. That means different CRS will have different coordinates.</p><h4>You can try my tool <a href="http://anygeojson.com/">anyGeoJSON</a> 😁 (anygeojson.com)</h4><p>This tool allows users to select the CRS of their choice (3857, 4326, 32643, etc.) and then draw geometry. GeoJSON for that geometry is created in realtime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uUu9-SOJrwBI_JKyisQhaw.png" /><figcaption>AnyGeoJSON.com current Setup</figcaption></figure><p>You can also use software such as QGIS, ArcMap, etc. for the same purpose</p><h3>How to View GeoJSON</h3><p>GeoJSON is a vector file, hence it doesn&#39;t have a sense of style in itself. Tools such as QGIS, or <a href="http://anygeojson.com/">anyGeoJSON</a> has a default style feature which will enable you to visualize the data on the map, it is important to set the map in the same CRS of GeoJSON, otherwise, it might create false results.</p><h3>What are the alternatives of GeoJSON</h3><p>Geospatial Data can be stored in various ways, some of them are as follows:<br>1. ESRI Shapefile<br>2. KML/KMZ<br>3. GML</p><h3>How to generate GeoJSON</h3><p>You can use tools such as <a href="https://quickmaptools.com/">https://quickmaptools.com/</a> to convert your data from various formats to GeoJSON within browser itself.</p><blockquote>About me 🤠</blockquote><p>Hi, I’m Krishna Lodha, I’m a full-stack Web GIS developer. I’m really enthusiastic about the power of locations and what story it tells us. Read more about me at <a href="http://krishnaglodha.com/">http://krishnaglodha.com</a>, to get more information about this code or suggest a better way to do it. ping me on <a href="https://www.linkedin.com/in/krishnaglodha/">LinkedIn</a> 💼 , <a href="https://twitter.com/krishnaglodha">Twitter</a> 🐦 , and <a href="https://www.youtube.com/channel/UC7IQzdf_jn3gkt_9K0TDQmg?view_as=subscriber">Youtube</a>📺</p><p>I write most of my post for the ‘<strong>Random GIS Talks</strong>’, which is dedicated to posts regarding GIS installations, inventions, technologies, etc. make sure to hit the subscribe button to stay updated for further posts 👉🏻 <a href="https://medium.com/random-gis-talks">here</a> 👈🏻</p><p>Adios!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67ddc6eda11e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/random-gis-talks/everything-about-geojson-67ddc6eda11e">Everything about GeoJSON</a> was originally published in <a href="https://medium.com/random-gis-talks">SpatialOps</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Styling guide for GeoServer]]></title>
            <link>https://medium.com/random-gis-talks/styling-guide-for-geoserver-7178db582b3e?source=rss----7d884ac83aa4---4</link>
            <guid isPermaLink="false">https://medium.com/p/7178db582b3e</guid>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[style]]></category>
            <category><![CDATA[geoserver]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[gis]]></category>
            <dc:creator><![CDATA[Krishna G. Lodha]]></dc:creator>
            <pubDate>Sun, 22 Nov 2020 08:38:20 GMT</pubDate>
            <atom:updated>2020-11-30T08:28:32.332Z</atom:updated>
            <content:encoded><![CDATA[<p>Geoserver is without a doubt one of the best ways to share spatial data following OGC standards. Geoserver allows us to expose the data in WMS format, making the life of developers and users pretty easy by showing a ton of vector data in a raster (png, jpeg, etc. ) format.</p><p>This blog introduces one more area of GeoServer capability, i.e. styling the data on the fly. To begin with, the vector data has no face, it is just a file having coordinate information and metadata of that location. It has no sense of styling itself. Hence it is the responsibility of the client side to render this data. Mapping libraries such as <em>OpenLayers</em>, <em>leafletjs</em>, <em>Mapbox</em>, etc. can also take care of styling, but this means that we need to add vector data on the client (browser) which reduces the performance of an overall application. Geoserver solves this problem by providing an on-the-fly styling component thus reducing the efforts for a client to load and then style the data, and also opens the whole spectrum of permutations and combinations of styling. Some of the most widely used styling combinations can be: <br>1. <strong>Attribute-based styling</strong> (Seeing different geometry in different style based on property in the column)<br>An example of this can be a State boundary map of the country, showing states in a different color based on the population it has. e.g. &gt;10M can be red, between 2M and 10M can be yellow and &lt; 2M can be green.<br>This gives us instant judgment of states without even going through the data of each state<br>2. <strong>Zoom based styling</strong> ( Seeing different geometry based on current zoom level) <br>An example of this can be basemap, when we look at any basemap from country-level zoom, we can only see country boundaries, as we start zooming in more and more, details start popping up, etc. This styling allows us to speed up the performance of an application by not loading all the data at the same time<br>3. <strong>Combining Multiple symbols</strong> ( Putting multiple styling on the same geometry)<br>An example of this can be creating a custom symbol when we can have a triangle inside a square inside the circle.</p><p>This Blogpost will walk you through all the different styling types and methods available in GeoServer to play with. Each method has its own pros and cons and depending upon the use case you can pick up the method. Please note that even though the way of writing styling in each method is different, the logic underneath stays the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V6ZAqLzoizOckg0fherkKw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@hamann?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">niklas_hamann</a> on <a href="https://unsplash.com/s/photos/style-map?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fcpIuEWoEpX8aHQsC9qFhw.png" /><figcaption>GeoServer home</figcaption></figure><p>Once the GeoServer is running, go to the style under the Data tab.</p><p>This Tab contains all the existing styles available on GeoServer along with the ability to View, Add, or delete the individual style.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ew88IY2dsygjkpFfZTBChA.png" /><figcaption>Style editor for style named ‘burg’</figcaption></figure><p>When we click on a specific style, a <em>style editor</em> window pops up, which contains various tabs and information. I’ve numbered some important things to check in the style editor<br>1. <strong>Name</strong> — Name of the style <br>2. <strong>Workspace</strong> — Which workspace does the style belongs to, if it is empty, it can be accessed in all workspaces<br>3. <strong>Format</strong> — Format of writing style, These are the methods of writing styles, most widely used methods are :<br>3.1 <strong><em>SLD</em></strong> — SLDs are OGC standards of writing styling, which is by default method selected to create style. Although SLDs are most flexible to write, there are certainly some complications attached to it. (More about it can be found below in the blog)<br>3.2 <strong><em>YSLD</em></strong> — YSLDs are similar to SLDs but written in <a href="https://yaml.org/">YAML</a>, making it easier for authoring<br>3.3 <strong><em>CSS Styling </em></strong>— I think it is safe for me to assume that everyone reading this is familiar with CSS and its basic application, Using this method removed the complex tag writing that is required in <strong><em>SLD</em></strong>, hence this becomes the obvious choice for web developers<br>3.4 <strong><em>MBStyle(JSON) </em></strong>— In a world full of APIs it becomes important to distill down everything to JSON format and using the <strong><em>MBStyle </em></strong>method of writing style allows developers to continue their same love for JSON to define styling.<br>4. <strong>Default Style </strong>— Geoserver allows us to populate some default styles for geometries such as Point, LineString, Polygon, and also raster. This helps in speeding up the process of creating style, since the basic skeleton remains the same most of the time, with a slight change of color, thickness, opacity, etc.<br>5. <strong>Copy Exiting Style </strong>— As the name suggests, you can copy a predefined style and then make modifications to it. <br>An example of this can be if I have a style for different population classification for India, I can copy the same style to create a new style and just change the population number bars, to make it sensible according to USA data.<br>6. <strong>Upload Style file </strong>— Geoserver allows users to upload a style file (e.g. .sld file ) created in a 3rd party application (e.g. QGIS ), saving efforts of developers to rewrite the styling, and also providing the ability for cartographers to create styling on QGIS and use in GeoServer. <br>7. <strong>Preview Legend</strong> — This area shows the styling legend, (which can also be saved as an image, see <a href="https://docs.geoserver.org/latest/en/user/services/wms/get_legend_graphic/index.html">this</a> ) Which helps the user to visualize the styling before using it in the actual app.<br>8. <strong>Text Area</strong> — This is the actual area where we write the styling in the desired method. Whenever we generate a default style or copy an existing style, it is displayed in the text area for further edits. <br>9. <strong>Button Group </strong>— This button group involves 4 buttons <br>9.1 <strong><em>Validate </em></strong><em>— </em>Once the desired changes in styling are made, clicking on this button checks whether all the changes are valid, all the tags are closed and the code is in the desired format.<br>9.2 <strong><em>Save </em></strong>— Once the validation is done, we can save the styling to save it and be on the same page for further changes<br>9.3 <strong><em>Apply</em></strong> — Once the validation is done, we can click on Apply to save the changes and apply it to the layer and get out of the style editor.<br>9.4 <strong><em>Cancel</em></strong> — Clicking on cancel will discard all changes and close the style editor.<br>10 <strong>Publishing (Tab) </strong>— Publishing tab shows the layer list along with <em>Default &amp; Associated</em> checkboxes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cKlVKbY2F3lR_-T4e6FoBA.png" /></figure><p>Layer with default checked represents that those layers use that style as a default style i.e. when that layer is rendered, it will use this style.<br>Layers checked with Associated checkbox represents a layer that can use this styling, Generally, we should associate layer with similar geometrical shape for a given style. <br>11. <strong>Layer Preview </strong>— Layer preview is the quickest way to visualize the style with the actual layer within the style editor, this also allows users to make changes in the style and see it right away.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*86Z6js4qMCvmetYpvclllQ.png" /></figure><p>12. <strong>Layer Attributes</strong> — GeoServer picks up the layer to show its column on which we can apply styling, these columns can hold information such as string, integer, boolean, etc. which then can be used to create more detailed styling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2sNoN8GEN_k857rpa--Ldg.png" /></figure><p>These are all the features that we get for an individual style.</p><h3>Methods of styling in GeoServer</h3><h4>1. SLD Styling (Styled Layer Descriptor)</h4><p>SLD is the most widely used and also the default method of styling in GeoServer. Standards for SLD are set by OGC, you can read the official documentation 👉<a href="https://opengeospatial.github.io/e-learning/sld/text/index.html">here</a> 👈 . In layman&#39;s terms, SLD is an XML document holding information about the styling of that data which includes things like thickness, color, dash, opacity, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wM6JgDkp0LjXp-uR9KWooQ.png" /><figcaption>example of SLD</figcaption></figure><p><a href="https://docs.geoserver.org/stable/en/user/styling/sld/cookbook/">Geoserver’s official documentation for SLD</a> is the best place to learn it. SLD Cookbook on the above link will walk you through general styling scenarios for all geometry types ( Point, Line, Polygon, Raster) including :<br>1. Point layer with different shapes and graphics<br>2. Line and Polygon with different outline properties<br>3. Zoom Based styling (Toggling Display based on current zoom level) <br>4. Labelling the feature, etc.<br>Even though the official doc can walk you through how to write a code, I’ll add some of the tips and tricks while writing SLDs.<br>1. <strong>Using External Images for symbol: </strong><a href="https://docs.geoserver.org/stable/en/user/styling/sld/cookbook/points.html#point-as-graphic">Official Doc</a> represents how to write code, but it can get confusing about where to store the image to use in that code. <br>If you are pointing to the image that is hosted, you can add the link to an image like this</p><pre>&lt;FeatureTypeStyle&gt;<br> &lt;Rule&gt;<br>   &lt;PointSymbolizer&gt;<br>    &lt;Graphic&gt;<br>     &lt;ExternalGraphic&gt;<br>      &lt;OnlineResource<br>        xlink:type=”simple”<br>        xlink:href=”<a href="http://www.pngall.com/wp-content/uploads/2017/05/Map-Marker-PNG-HD.png">http://www.pngall.com/wp-content/uploads/2017/05/Map-Marker-PNG-HD.png</a>” /&gt;<br>      &lt;Format&gt;image/png&lt;/Format&gt;<br>     &lt;/ExternalGraphic&gt;<br>     &lt;Size&gt;6&lt;/Size&gt;<br>    &lt;/Graphic&gt;<br>   &lt;/PointSymbolizer&gt;<br>  &lt;/Rule&gt;<br> &lt;/FeatureTypeStyle&gt;</pre><p>If you want to use the image which is stored on your computer locally, you have to paste that image in ‘<em>geoserver/data_dir/styles/’ </em>then you can refer to the image by its name in the style, like this :</p><pre>&lt;FeatureTypeStyle&gt;<br> &lt;Rule&gt;<br>   &lt;PointSymbolizer&gt;<br>    &lt;Graphic&gt;<br>     &lt;ExternalGraphic&gt;<br>      &lt;OnlineResource<br>        xlink:type=”simple”<br>        xlink:href=”marker.png” /&gt;<br>      &lt;Format&gt;image/png&lt;/Format&gt;<br>     &lt;/ExternalGraphic&gt;<br>     &lt;Size&gt;6&lt;/Size&gt;<br>    &lt;/Graphic&gt;<br>   &lt;/PointSymbolizer&gt;<br>  &lt;/Rule&gt;<br> &lt;/FeatureTypeStyle&gt;</pre><ul><li><strong><em>Quick Note</em></strong>: Allowed image formats includeimage/png, image/jpeg, image/gif, and image/svg+xml</li></ul><p>2. <strong>Zoom Based Styling</strong>: <a href="https://docs.geoserver.org/stable/en/user/styling/sld/cookbook/points.html#zoom-based-point">Official Doc</a> has given a descriptive example about how to create different styles based on Zoom level, but words like <em>MinScaleDenominator, MaxScaleDenominator </em>might confuse you. Zoom based styling is not exactly ✌️Zoom✌️ based, but more like map-scale based. That means you need to write the map scale for which you want to show/hide the styling. Getting the current scale for the map can be tricky depending upon which mapping library you are using. e.g. in Openlayers, <a href="https://openlayers.org/en/v4.6.5/apidoc/ol.control.ScaleLine.html"><em>ScaleControl</em></a><em> </em>can help you add scale on the map, but the quickest way to get the scale is from the style editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PMvtme0_vaLtsxeH3f9pvg.png" /><figcaption>Layer preview of a style</figcaption></figure><p>Once you know the scale at which you want to hide/show the style, next is to put it in either <em>MinScaleDenominator, MaxScaleDenominator. </em>Definition :<em><br>MaxScaleDenominator =&gt;</em> Max scale at which style will work <br><em>MinScaleDenominator =&gt;</em> Min scale at which style will work<br>An example of this can be the following :</p><pre><strong>&lt;MinScaleDenominator&gt;</strong>160000000<strong>&lt;/MinScaleDenominator&gt;</strong><br><strong>&lt;MaxScaleDenominator&gt;</strong>320000000<strong>&lt;/MaxScaleDenominator&gt;</strong></pre><p>The style will work when the scale will be in between <strong>1 : 320000000</strong> to <strong>1 : 160000000</strong></p><p>2. <strong>Multi Styling for a feature</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/64/1*BvRFqgh2p0fVaXN83UKCfw.png" /><figcaption>Multi styling for the same feature</figcaption></figure><p>If you decided to go crazy like me 😛 and add multiple styling to the same feature (e.g. a circle inside a square), you can do that by adding multiple rules in <em>FeatureTypeStyle</em></p><pre>&lt;FeatureTypeStyle&gt;<br>        &lt;Rule&gt;<br>          &lt;PointSymbolizer&gt;<br>            &lt;Graphic&gt;<br>              &lt;Mark&gt;<br>                &lt;WellKnownName&gt;square&lt;/WellKnownName&gt;<br>                &lt;Fill&gt;<br>                  &lt;CssParameter name=&quot;fill&quot;&gt;#ff00ff&lt;/CssParameter&gt;<br>                &lt;/Fill&gt;<br>              &lt;/Mark&gt;<br>              &lt;Size&gt;20&lt;/Size&gt;<br>            &lt;/Graphic&gt;<br>          &lt;/PointSymbolizer&gt;<br>        &lt;/Rule&gt;<br>        &lt;Rule&gt;<br>          &lt;PointSymbolizer&gt;<br>            &lt;Graphic&gt;<br>              &lt;Mark&gt;<br>                &lt;WellKnownName&gt;circle&lt;/WellKnownName&gt;<br>                &lt;Fill&gt;<br>                  &lt;CssParameter name=&quot;fill&quot;&gt;#0000ff&lt;/CssParameter&gt;<br>                &lt;/Fill&gt;<br>              &lt;/Mark&gt;<br>              &lt;Size&gt;15&lt;/Size&gt;<br>            &lt;/Graphic&gt;<br>          &lt;/PointSymbolizer&gt;<br>        &lt;/Rule&gt;<br>      &lt;/FeatureTypeStyle&gt;</pre><h4>2. CSS Styling (Cascading Style Sheet)</h4><p>CSS styling is becoming more and more popular nowadays among developers because it is really easy to write once you understand the gist of it, you can read the official documentation 👉<a href="https://docs.geoserver.org/stable/en/user/styling/css/cookbook/index.html">here</a> 👈 . CSS styling is not pre-packed in GeoServer, you will have to install the CSS plugin separately, for 2.18 you can find <a href="https://sourceforge.net/projects/geoserver/files/GeoServer/2.18.0/extensions/geoserver-2.18.0-css-plugin.zip/download">here</a>. Once the setup is installed, You can see <strong>CSS </strong>in the format dropdown while creating a new style. General Structure of CSS Styling Looks like this</p><pre>/* Apply styling to all data */<br>*{<br>fill : #ff00ff;<br>fill-opacity : 0.5;<br>}</pre><p>‘*’ represents complete selection. If you want to provide any filter, you can write that instead of ‘*’, e.g.</p><pre>/* filtering data */<br>[population &lt; 1000000]{<br>fill : #ff00ff;<br>fill-opacity : 0.5;<br>}</pre><p>You can combine multiple filters as follow</p><pre>/* multiple filters */<br>[population &lt; 1000000] [high_temp &gt; 25] [badge = &#39;friendly&#39;]{<br>fill : #ff00ff;<br>fill-opacity : 0.5;<br>}</pre><p>Here only feature satisfying all 3 conditions will be show, if you want to put <strong>OR</strong> conditions, simple add , in between them</p><pre>/* OR functionality for multiple filters */<br>[population &lt; 1000000],[high_temp &gt; 25],[badge = &#39;friendly&#39;]{<br>fill : #ff00ff;<br>fill-opacity : 0.5;<br>}</pre><p>To create a <strong>zoom based styling</strong> in CSS styling is also very simple, We use the special keyword to denote scale denominator, e.g.</p><pre>/* Only show the stylign when scale is less than 1 : 1000000 */<br>[@sd &lt; 1000000] {<br>fill : #ff00ff;<br>fill-opacity : 0.5;<br>} </pre><p>You can read more about options available for different geometries styling 👉 <a href="https://docs.geoserver.org/stable/en/user/styling/css/properties.html#css-properties">Here</a> 👈, You can read more about options available for filtering 👉 <a href="https://docs.geoserver.org/stable/en/user/styling/css/filters.html#css-filters">Here</a> 👈, <br><a href="https://docs.geoserver.org/stable/en/user/styling/workshop/css/index.html">This page</a> 📄 , will give you more understanding about different styling using CSS Styling</p><p>I think it is a good time to end this blog and for you to start creating some innovative and unique styles using <strong>SLD</strong> and <strong>CSS</strong> methods, Part 2 of this blog post will focus more on YSLD and MBStyle (JSON) methods to create styling. <br>Happy coding till then 😄.<br>You can subscribe to me on <a href="https://www.youtube.com/channel/UC7IQzdf_jn3gkt_9K0TDQmg?view_as=subscriber">Youtube</a>📺, to get the video for the similar topic!<br>Make sure to share your style creation with me on <a href="https://www.linkedin.com/in/krishnaglodha/">LinkedIn</a> 💼 or <a href="https://twitter.com/krishnaglodha">Twitter</a> 🐦</p><blockquote>About me</blockquote><p>Hi, I’m Krishna Lodha, I’m a full-stack Web GIS developer. I’m really enthusiastic about the power of locations and what story it tells us. Read more about me at <a href="http://krishnaglodha.com/">http://krishnaglodha.com</a>, to get more information about this code or suggest a better way to do it. ping me on <a href="https://www.linkedin.com/in/krishnaglodha/">LinkedIn</a> 💼 , <a href="https://twitter.com/krishnaglodha">Twitter</a> 🐦 , and <a href="https://www.youtube.com/channel/UC7IQzdf_jn3gkt_9K0TDQmg?view_as=subscriber">Youtube</a>📺</p><p>I write most of my post for the ‘<strong>Random GIS Talks</strong>’, which is a medium publication dedicated to posts regarding GIS installations, inventions, technologies, Case studies, etc. make sure to hit the subscribe button to stay updated for further posts 👉🏻 <a href="https://medium.com/random-gis-talks">here</a> 👈🏻</p><p>Make sure to leave 👏🏻 to the posts, this boosts the motivation for me to write more 😄</p><p>Adios!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7178db582b3e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/random-gis-talks/styling-guide-for-geoserver-7178db582b3e">Styling guide for GeoServer</a> was originally published in <a href="https://medium.com/random-gis-talks">SpatialOps</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Geometry CRUD in Geodjango using Openlayers (Part 1️⃣)]]></title>
            <link>https://medium.com/random-gis-talks/geometry-crud-in-geodjango-using-openlayers-part-1%EF%B8%8F%E2%83%A3-7882093354ee?source=rss----7d884ac83aa4---4</link>
            <guid isPermaLink="false">https://medium.com/p/7882093354ee</guid>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[geodjango]]></category>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Krishna G. Lodha]]></dc:creator>
            <pubDate>Mon, 26 Oct 2020 10:35:58 GMT</pubDate>
            <atom:updated>2021-01-16T10:56:50.967Z</atom:updated>
            <content:encoded><![CDATA[<h3>Geometry CRUD in Geodjango using Openlayers (Part 1)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V_oiahDwo_e4UI_wlOzE7A.png" /><figcaption>Photo by <a href="https://unsplash.com/@delfidelarua7?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">delfi de la Rua</a> on <a href="https://unsplash.com/s/photos/map?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>What is GeoDjango ? 🌏</h3><p><a href="https://docs.djangoproject.com/en/3.1/ref/contrib/gis/">Geodjango</a> is an extension to the existing django framework where developer can leverage world class framework features available in django with the goodness of Geospatial Data 🌎 .Geodjango supports all databases such as PostgreSQL (PostGIS), MySQL , SQLite (SpatiaLite), Oracle, etc.</p><p>This enables us to use geometry data in the way it is intended, allowing user to do geospatial analysis (buffer, finding nearest points, etc.) . <br>Although best use case scenario for geodjango would be creating APIs and consuming from frontend frameworks like <em>Angular , React, Vue.js , etc. </em>that’s the topic for another post.</p><h3>Prerequisite for this blog 📚</h3><p>Before getting into actual CRUD operations with geodjango and openlayers, I accept you have little bit understanding of :<br>1. Django and Geodjango (Creating Models,Views, Templates, etc.)<br>2. PostgreSQL/ PostGIS (Creating and operating spatial database)<br>3. Openlayers 4 (Creating Map, Draw, Modify feature)<br>4. Excitement 😁 (Otherwise we are wasting time honey!)</p><h3>How to get Started with GeoDjango ? 🐣</h3><p>Geodjango has a fairly simple installation process on top of installing django, official documents can be fetched 👉🏻 <a href="https://docs.djangoproject.com/en/3.1/ref/contrib/gis/install/#geodjango-installation">here</a> 👈🏻. <br>It’s a little bit trickier for Mac OS X though, but no worries! You can find the blog post for that 👉🏻 <a href="https://medium.com/random-gis-talks/setting-up-geodjango-3-on-mac-os-x-%EF%B8%8F-under-15-minutes-2ab8d8ed48fd">here</a> 👈🏻</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*dCqKWoZsq7yHzzwKtz9HVQ.gif" /><figcaption>Image from <a href="https://giphy.com/">https://giphy.com/</a></figcaption></figure><h3>Step 1 : Setup Project 🚀</h3><p>Once the geodjango is installed, follow these steps to setup project. <br>1. Create anaconda environment for django=3.1<br>2. Create Postgres database and install extension postGIS<br>3. Create a django-project and one app inside it<br>4. Make sure the <em>settings.py</em> file in django project has all settings as per the installation blog that you can find 👉🏻 <a href="https://medium.com/random-gis-talks/setting-up-geodjango-3-on-mac-os-x-%EF%B8%8F-under-15-minutes-2ab8d8ed48fd">here</a> 👈🏻</p><blockquote>By the end of these steps you should have something similar to 👉🏻 <a href="https://github.com/krishnaglodha/CRUD-using-geodjango/tree/main/startproject">this</a> 👈🏻</blockquote><p>Once the project is ready open terminal and write</p><pre>python manage.py makemigrations</pre><p>to check if there are any changes in the database tables (We haven’t worked on it as of now)</p><pre>python manage.py migrate</pre><p>to make impression of models either added or edited via <em>models.py</em> file in db</p><p>Above two commands are only required when we make any changes in database tables definitions (adding/removing/updating column or it’s datatype, etc.)</p><pre>python manage.py runserver</pre><p>to start the django server and see the project working (default at <a href="http://localhost:8000/">http://localhost:8000/</a> )</p><p>which will popup this screen confirming everything is working fine. 😁</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a0cRVh_61Cuck3TBpUQbKQ.png" /><figcaption>Screenshot of default django project working successfully</figcaption></figure><h3>Step 2 : Setup Basic Map 🗺️</h3><p>Now the project is running successfully, time to add map on the homepage. <br><strong>A. Setup template for homepage</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*-1sm7CyCfjLFZhMWroHUIw.gif" /></figure><p>Django is a template based framework i.e. every HTML page needs to be added as a template in order to render on screen. <br>To create homepage template we’ll create a <strong>templates</strong> folder in <strong>mainapp, </strong>and then create <strong>home.html</strong> inside templates folder.</p><p>the basic home.html page setup will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4F_JHHdeZLmTmDpqnqHA8Q.png" /><figcaption>mainapp/templates/home.html</figcaption></figure><p><strong>B. Setup view to render template for homepage<br></strong>Open ‘<em>mainapp/views.py’<br></em>and add following view to the file</p><pre>def Home(request):</pre><pre>    return render(request,&#39;home.html&#39;)</pre><p>as we move forward we’ll add more things to the same function to load the location data on map, pass variables, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ggrLsiBESBWugmfYtRL2g.png" /><figcaption>creating view in ‘mainapp/views.py’</figcaption></figure><p><strong>C. Setup url for homepage<br></strong>This part will be little bit tricky, We can directly write url in the ‘<em>crudgeodjangoproject/urls.py</em>’ but doing this will get complicated in larger projects where we have multiple apps (e.g. app handling business logic, app handling authentications, etc.) <br>Thus we create a new <em>urls.py</em> file inside mainapp and then connect it with the central <em>urls.py </em>file using <strong>include method<br></strong>Create a new urls.py file in mainapp folder and paste following code init</p><pre>from django.urls import path<br>from . import views<br>urlpatterns = [<br>path(&#39;&#39;,views.Home, name=&#39;Home&#39;),<br>]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*otgrZWkrU686Bfp79w89EA.png" /><figcaption>mainapp/urls.py</figcaption></figure><p>Now we’ll connect <em>urls.py </em>of <strong>mainapp</strong> with <em>urls.py </em>of <strong>project, </strong>Head back to the <em>urls.py </em>of <strong>project </strong>and paste following code</p><pre>from django.contrib import admin<br>from django.urls import path , include</pre><pre>urlpatterns =[<br>path(&#39;admin/&#39;,admin.site.urls),<br>path(&#39;&#39;, include(&#39;mainapp.urls&#39;)<br>]</pre><p>by providing empty path (‘ ’) in the <em>urlpatterns </em>, we are basically telling django to load the mainapp.urls’ url directly with home route i.e. localhost:8000<br>If I add it like this</p><pre>path(&#39;frommainapp/&#39;, include(&#39;mainapp.urls&#39;)</pre><p>all the urls inside mainapp.urls will be used by adding ‘frommainapp’ in url i.e. localhost:8000/frommainapp</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*53rJn9y394E7k3ic373-fw.png" /><figcaption><em>crudgeodjangoproject/urls.py</em></figcaption></figure><p>Once that is setup, again type the command</p><pre>python manage.py runserver</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a37rw_3ZYMrpUfS8ySghWg.png" /></figure><h4>— — — — — — — — — — - 🎊 The map is alive 🎉 — — — — — — — — — —</h4><p>Before moving ahead we need to register a <em>superuser </em>so that we can access the functionalities of admin panel. Open terminal and put following command</p><pre>python manage.py createsuperuser</pre><p>put username , email (optional) , password to create superuser. Remeber this username for further use</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zQShv7j-J2Y9DGQqUQJtRA.gif" /></figure><h3>Step 3 : Setup Geospatial Model 📄</h3><p>Now that we have map setup, We can concentrate on creating a model (thus table in database) to store the geometry data (feel free to add more columns if you need).<br>I think it’s good time to take a break and have a recap of what we have done till now, make sure that you understand what we did and Why we did! <br>Take time to customise map , add some javascript libraries to make it beautiful ( <a href="https://getbootstrap.com/docs/4.0/getting-started/introduction/">bootstrap</a>, <a href="https://materializecss.com/">materialize</a>, etc. )</p><p>In the next post, we’ll work on model and get started with creating CRUD function . Make sure you subscribe to publication 👉🏻 <a href="https://medium.com/random-gis-talks">here</a> 👈🏻 and If you wanna follow the writer of this post tap 👉🏻 <a href="https://medium.com/@krishnaglodha">here</a> 👈🏻.</p><blockquote><em>About me</em></blockquote><p>Hi, I’m Krishna Lodha, I’m a full stack Web GIS developer. I’m really enthusiastic about the power of locations and what story it tells us. Read more about me at <a href="http://krishnaglodha.com/">http://krishnaglodha.com</a> , to get more information about this code or suggest a better way to do it. ping me on LinkedIn at <a href="https://www.linkedin.com/in/krishnaglodha/">https://www.linkedin.com/in/krishnaglodha/</a></p><p>I write most of my post for the ‘<strong>Random GIS Talks</strong>’ , which is dedicated to posts regarding GIS installations, inventions, technologies, etc. make sure to hit the subscribe button to stay updated for further posts 👉🏻 <a href="https://medium.com/random-gis-talks">here</a> 👈🏻</p><p>Adios!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7882093354ee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/random-gis-talks/geometry-crud-in-geodjango-using-openlayers-part-1%EF%B8%8F%E2%83%A3-7882093354ee">Geometry CRUD in Geodjango using Openlayers (Part 1️⃣)</a> was originally published in <a href="https://medium.com/random-gis-talks">SpatialOps</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up  Geodjango 3 on Mac OS X ️  under 15 minutes!]]></title>
            <link>https://medium.com/random-gis-talks/setting-up-geodjango-3-on-mac-os-x-%EF%B8%8F-under-15-minutes-2ab8d8ed48fd?source=rss----7d884ac83aa4---4</link>
            <guid isPermaLink="false">https://medium.com/p/2ab8d8ed48fd</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[geodjango]]></category>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[spatial]]></category>
            <dc:creator><![CDATA[Krishna G. Lodha]]></dc:creator>
            <pubDate>Sun, 25 Oct 2020 12:37:27 GMT</pubDate>
            <atom:updated>2020-10-25T16:18:27.552Z</atom:updated>
            <content:encoded><![CDATA[<h3>Setting up 🌏 Geodjango 3 on Mac OS X 🖥️ under 15 minutes!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-9ptgZI2qhGwwmBKTsrOrw.png" /></figure><p>I’m a huge fan of <a href="https://www.djangoproject.com/">Django Framework</a> because it is by far one of the easiest , secured and fun 😉 way to create really complicated project. I work in GIS Industry where I deal with geospatial enable data all the time. Which lot of the time includes cleaning data, performing some basic analysis and then consume in the web app and since we live in an era where python provides solutions for almost everything, it is an obvious decision to vote for django above the php frameworks like laravel, zend ,etc.</p><h3>What is Django ?</h3><blockquote>Django is a python based MTV(model, template, view) framework designed to create a simple, elegant, secure, fast project</blockquote><p>You can read everything about Django 👉🏻 <a href="https://www.djangoproject.com/">here</a> 👈🏻 .</p><h3>What is GeoDjango ?</h3><p><a href="https://docs.djangoproject.com/en/3.1/ref/contrib/gis/">Geodjango</a> is an extension to the existing django framework where developer can leverage world class framework features available in django with the goodness of 🌏 Geospatial Data 🌎 .Geodjango supports all databases such as PostgreSQL (PostGIS), MySQL , SQLite (SpatiaLite), Oracle, etc.</p><p>This enables us to use geometry data in the way it is intended, allowing user to do geospatial analysis (buffer, finding nearest points, etc.)</p><h3>Installing GeoDjango on MacOS X 🖥️</h3><p>It’s little bit trickier to install Geodjango on MacOS compared with Windows because some of the geospatial libraries are not available in a executable .dmg</p><p>In this Blog we’ll be working with <strong>macOS </strong>Catelina ( 10.15.7) , Postgres 10, pgAdmin 4, anconda env.</p><h4>🚀 Let’s get started 🚀</h4><p><strong>Step 1: Create environment to work with <br></strong>It is<strong> </strong>important to keep the python libraries used in specific project separate from the universal libraries, hence it’s always a good choice to spin up new env. Put the following code in anaconda terminal</p><blockquote>conda create -n geodjangoenv django=3.1</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zZle7meE1DKa1L5TI6NASw.gif" /><figcaption>Creating Django Environment in anaconda terminal</figcaption></figure><p><strong>Step 2: Installing Home Brew for mac <br></strong>Home Brew is a package manager for mac, most of the softwares or packages for which .dmg or any executable file is not available, home brew can help installing them. More information can be found 👉🏻 <a href="https://brew.sh/">here</a> 👈🏻.</p><p>put the following command in terminal</p><blockquote>/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)&quot;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nM7GWX3qpZ5JTwIDDqRiXQ.png" /></figure><p><strong>Step 3: Installing Geospatial Database </strong><br>As mentioned we’ll be sticking with PostgreSQL (PostGIS) for this blog, feel free to copy the steps for other databases as well.<br>PostgreSQL can be installed in two ways here:<br> <em>Street 1</em> : Installing PostgreSQL can related components via executables by downloading it from 👉🏻 <a href="https://www.enterprisedb.com/downloads/postgres-postgresql-downloads">here</a> 👈🏻.<br><em>Street 2</em>: Installing PostgreSQL can related components via Home brew</p><blockquote>brew install postgres<br>brew install postgis</blockquote><p>Honestly, I like to keep my life simple, so I’ll be sticking with <em>Street 1. </em>Once you go the <a href="https://www.enterprisedb.com/downloads/postgres-postgresql-downloads">download page</a> , find the stable version (I’m downloading 10.x for this blog)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*fnVTLjumFkhokIG87r_9mQ.gif" /><figcaption>Installing Postgres</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*Mxu7G4VIyXMOS3986FB8ww.gif" /><figcaption>Installing PostGIS after PostgreSQL</figcaption></figure><p><strong>Step 3.1: Creating PostgreSQL Database<br></strong>Once the database is installed succesfully, open it by opening the pgAdmin Application to open postgreSQL interface. Then login with the default credentials</p><blockquote>username = postgres ; password = postgres (Pretty lame , right?? 🙄)</blockquote><p>then create a new database by right clicking on “database” , enter the desired name (postgresdb in my case).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ynU6Ur1P0gKScF811fndJw.png" /></figure><p>Once the database is created, right click on name and open <em>query tool</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*7dgU7UvNNdOzxMo_dbPAwA.png" /></figure><p>write the following command in the query window and click on run, this command will install postgis extension in the database, so that database can understand and run spatial queries</p><blockquote>create extension postgis;</blockquote><p><strong>Step 4: Installing Geospatial Libraries<br></strong>This is where we see true super powers of home brew. We’ll install <em>gdal, libgeoip </em>using terminal . <br>Open terminal and type</p><blockquote>brew install gdal</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zXHxWFd-ujMdiyraRp4RdQ.png" /></figure><blockquote>brew install <em>libgeoip</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eEjHecatgVROkjB2u1k1-w.png" /></figure><h4>🎉 Installations complete 👏🏻</h4><h3>Creating GeoDjango project 🚀️</h3><p>Creating geodjango project is exactly similar to creating django project. <br>Step 1 : Open folder in the terminal where you want to create project<br>Step 2: Make sure that the geodjangoenv (or whatever name that you gave) is activated<br>Step 3: Type following in command line to create new django project</p><blockquote>django-admin startproject geodjangoproject</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dL5CD9GoLsjtZD-bZ4PvmQ.png" /><figcaption>create new django project</figcaption></figure><p>Step 4 (optional) : You can create new app inside the django folder according to your need.<br>Step 5 : Go to the settings.py file in the project and add following in <em>INSTALLED_APPS </em>array as following</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*4SQ0dslM66zqhkYDj330_Q.jpeg" /></figure><blockquote><em>INSTALLED_APPS = [<br>***,<br>django.contrib.gis ]</em></blockquote><p>Step 6 : Modify the Database configuration in settings.py to connect django project with the database</p><blockquote><em>DATABASES = {<br>“default”: {<br>“ENGINE”: “django.contrib.gis.db.backends.postgis”,<br>“NAME”: “postgresDb”, #Database name<br>“USER”: “postgres”, #PostgreSQL Username<br>“PASSWORD”: “postgres”, #PostgreSQL password<br>“HOST”: “localhost”,<br>“PORT”: “5432”,<br>}<br>}</em></blockquote><h3>Creating GeoDjango model 📚</h3><p>Generally we create database table via creating entry in <em>model.py </em>file, which looks like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dg_ZxKDHd4_gQVgogOPvEw.png" /><figcaption>Models.py file in django project</figcaption></figure><p>which is now slightly changed in order to add geometry fields as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uwlmKgxHh8Q4vOjfVrKl9A.png" /><figcaption>Geometry enabled modely.py</figcaption></figure><h3>Support in GeoDjango model 📚</h3><p>Geodjango model supports all typed of geometries i.e. <em>Point, Linestring, Polygon, Multi Polygon,etc. </em>More about it can be found 👉🏻 <a href="https://docs.djangoproject.com/en/3.1/ref/contrib/gis/model-api/">here</a> 👈🏻. Once the geodjango model is created successfully, then based on the geometry type used, user can login to admin panel and add geometry to the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GbuvgovkoUAKdfVrnab5lA.png" /><figcaption>Admin panel view of model with polygon field</figcaption></figure><h3>Further development in GeoDjango framework 📈</h3><p>Once the geodjango model is setup properly, you can add and extract geospatial data successfully from database using the <em>views </em>available in django project. Once the data is saved successfully, geodjango api allows us to perform geospatial analysis on this data. Make sure you <a href="https://medium.com/random-gis-talks"><em>subscribe to the publication</em></a> for further blogs on how to use geodjango framework.</p><p>Follow the publications ‘<a href="https://medium.com/random-gis-talks">Random GIS talks</a>’ for my upcoming blogs on :<br>1. Adding and showing the data on opensource Mapping application using geodjango as a framework. <br>2. Getting started with Geoserver<br>and many more 😍…</p><p>Read the existing blogs on :<br>1. Installation of geoserver on <a href="https://medium.com/random-gis-talks/installing-geoserver-binary-on-mac-os-x-322fdae18512">mac</a> / <a href="https://medium.com/random-gis-talks/installing-geoserver-binary-in-windows-9ce2d6348245">windows</a> <br>2. Creating <a href="https://medium.com/random-gis-talks/add-legends-in-mapbox-gl-js-dynamically-3782d6f5d74">Dynamic legend</a> on mapbox<br>and many more 😍…</p><blockquote>About me</blockquote><p>Hi, I’m Krishna Lodha, I’m a full stack Web GIS developer. I’m really enthusiastic about the power of locations and what story it tells us. Read more about me at <a href="http://krishnaglodha.com/">http://krishnaglodha.com</a> , to get more information about this code or suggest a better way to do it. ping me on LinkedIn at <a href="https://www.linkedin.com/in/krishnaglodha/">https://www.linkedin.com/in/krishnaglodha/</a></p><p>Adios!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ab8d8ed48fd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/random-gis-talks/setting-up-geodjango-3-on-mac-os-x-%EF%B8%8F-under-15-minutes-2ab8d8ed48fd">Setting up 🌏 Geodjango 3 on Mac OS X 🖥️  under 15 minutes!</a> was originally published in <a href="https://medium.com/random-gis-talks">SpatialOps</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>