<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sarma Tangirala</title>
    <description>The latest articles on DEV Community by Sarma Tangirala (@stangirala).</description>
    <link>https://dev.to/stangirala</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F764722%2Fefdfabb6-c8c9-4a71-8ea3-9df48292d484.jpg</url>
      <title>DEV Community: Sarma Tangirala</title>
      <link>https://dev.to/stangirala</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stangirala"/>
    <language>en</language>
    <item>
      <title>Greppo: All you need is 4 minutes to build an Interactive Geospatial Webapp</title>
      <dc:creator>Sarma Tangirala</dc:creator>
      <pubDate>Tue, 30 Nov 2021 00:27:22 +0000</pubDate>
      <link>https://dev.to/stangirala/greppo-all-you-need-is-4-minutes-to-build-an-interactive-geospatial-webapp-4jok</link>
      <guid>https://dev.to/stangirala/greppo-all-you-need-is-4-minutes-to-build-an-interactive-geospatial-webapp-4jok</guid>
      <description>&lt;h1&gt;
  
  
  Introduction
&lt;/h1&gt;

&lt;p&gt;Looking to build a Geospatial dashboard for your python script? This blog post is for you! Read along for 3 easy steps to get started with Greppo, a python prototyping tool to quickly build interactive Geo-spatial web apps.&lt;/p&gt;

&lt;p&gt;For this tutorial we will be building an app that will visualize some Geospatial data from San Francisco. The data lists the public amenities available in the city. We will plot this data and summarize the count of amenities within an area selected by the user using a Bar Chart.&lt;/p&gt;

&lt;p&gt;The code used in this tutorial can be found &lt;a href="https://github.com/greppo-io/greppo-demo/tree/main/Basic-amenities-in-SFO" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you’re like me and like to quickly jump to the end of a tutorial and play around with the web app simply,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clone this &lt;a href="https://github.com/greppo-io/greppo-demo" rel="noopener noreferrer"&gt;repo&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Navigate to &lt;code&gt;Basic-amenities-in-SFO&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Install greppo via pip &lt;code&gt;pip install greppo&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;On a console run, &lt;code&gt;greppo serve app.py&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Alternatively, &lt;a href="https://greppoapps.page.link/sf-amenities" rel="noopener noreferrer"&gt;here’s&lt;/a&gt; a link to a deployed app instance that is currently running if you want to play around hands-free.&lt;/p&gt;

&lt;h1&gt;
  
  
  3 Easy Steps
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Setup Dir
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir greppo-quickstart
cd greppo-quickstart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Greppo
&lt;/h3&gt;

&lt;p&gt;It is recommended that you install &lt;code&gt;greppo&lt;/code&gt; inside a Python virtual environment. For this tutorial we are going to use virtualenv (see &lt;a href="https://docs.greppo.io/installation.html#python-environment-management" rel="noopener noreferrer"&gt;here&lt;/a&gt; for other environment managers)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;virtualenv ENV
source ENV/bin/activate
pip install greppo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Setup the Python Script
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Create an empty python script
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch app.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Import Greppo
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;greppo&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;geopandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;gpd&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First let's import greppo and geopandas. For greppo, &lt;code&gt;app&lt;/code&gt; is the entry point for adding interactive and visual components to your application. With &lt;code&gt;app&lt;/code&gt; we can instruct greppo to add a map layer, or a bar chart, or set up APIs to variables. Geopandas is imported as &lt;code&gt;gpd&lt;/code&gt; by convention to read vector data.&lt;/p&gt;

&lt;h4&gt;
  
  
  Read in the data using Geopandas
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;sfo_amenities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gpd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./SFO_Amenities.geojson&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;amenities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sfo_amenities&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;amenity&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;unique&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For this tutorial go ahead and download the data from &lt;a href="https://github.com/greppo-io/greppo-demo/blob/main/Basic-amenities-in-SFO/SFO_Amenities.geojson" rel="noopener noreferrer"&gt;here&lt;/a&gt; and &lt;a href="https://github.com/greppo-io/greppo-demo/blob/main/Basic-amenities-in-SFO/SFO_Selection.geojson" rel="noopener noreferrer"&gt;here&lt;/a&gt; in the Greppo demos github repo (you can download with wget or curl, or simply copy the raw contents via github).&lt;/p&gt;

&lt;p&gt;In the snippet above we read the geojson file and get a list of the amenities available using &lt;code&gt;.unique()&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Setup Base Layer for Map
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;base_layer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CartoDB Light&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;visible&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://cartodb-basemaps-a.global.ssl.fastly.net/light_all/{z}/{x}/{y}@2x.png&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;subdomains&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;attribution&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;&amp;amp;copy; &amp;lt;a target=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;_blank&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; href=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://osm.org/copyright&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;&amp;gt;OpenStreetMap&amp;lt;/a&amp;gt; contributors | Carto Tile&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The base layer is the map interface onto which we will project our (computed) data. Here we are using a basic CartoDB Light variant.&lt;/p&gt;

&lt;h4&gt;
  
  
  Setup the Data as an Overlay Layer
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;overlay_layer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;sfo_amenities&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SFO Amenities&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Location of some basic amenities in San Francisco&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;fillColor&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;#F87979&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="n"&gt;visible&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the base layer setup from the previous snippet, we now set up the data that will be visualized on the map. This is done with the &lt;code&gt;overlay_layer&lt;/code&gt; API, and the first argument is the geojson file that we read in step 1.&lt;/p&gt;

&lt;h4&gt;
  
  
  Setup Draw Feature
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;default_area_selection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gpd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./SFO_Selection.geojson&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;area_selection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;draw_feature&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Draw area selection&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;features&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;default_area_selection&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;geometry&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Polygon&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For this tutorial, to demonstrate the flexibility and power of Greppo, we set up a draw feature that the user can interact with. In this example we read a set of default draw features as a geojson. The default features can be omitted (ie. don’t pass in &lt;code&gt;default_area_selection&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Here &lt;code&gt;area_selection&lt;/code&gt; is a list of polygons. For interactivity Greppo binds the state of the user interaction to this variable &lt;code&gt;area_selection&lt;/code&gt;. That is, whenever app.py runs or is updated, &lt;code&gt;area_selection&lt;/code&gt; will contain all the polygons as seen on the screen. To be clear, app.py can always assume area_selection will have the &lt;em&gt;data&lt;/em&gt; it cares about and can perform computations on that (see next step).&lt;/p&gt;

&lt;h4&gt;
  
  
  Perform computation on the data
&lt;/h4&gt;

&lt;p&gt;With the variable binding setup in the snippet above, we can now use the polygons from the draw feature to perform some computation,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;selected_amenities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sfo_amenities&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sfo_amenities&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;within&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;area_selection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;geometry&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])]&lt;/span&gt;
&lt;span class="n"&gt;selected_amenities_count_df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;selected_amenities&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;amenity&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;value_counts&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code snippet we take the first polygon from &lt;code&gt;area_selection&lt;/code&gt; and filter out the counts of amenities within the &lt;code&gt;selected_amenities&lt;/code&gt; data frame, and create a new data frame &lt;code&gt;selected_amenities_count_df&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Next we get the counts by values from the created data frame as an example of some python processing that is performed in a usual business setting,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;selected_amenities_count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;amenity&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;amenities&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nf"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amenity&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;selected_amenities_count_df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;selected_amenities_count&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;selected_amenities_count_df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;amenity&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;item&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;selected_amenities_count&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Plotting the Data as a Chart
&lt;/h4&gt;

&lt;p&gt;We are almost done with our app now! With the main parts in the previous snippets out of the way, let’s plot a bar chart of the counts. This is a common scenario where we have some data that we manipulate on the map layer and we want to summarize the data and visualize it.&lt;/p&gt;

&lt;p&gt;Let's do that with a bar chart,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bar_chart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;amenities-sfo-select&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Amenities in SFO&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The count of the basic amenities within the selected area in SFO.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;amenities&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;selected_amenities_count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;backgroundColor&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rgb(200, 50, 150)&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Serve the Grepp App :)
&lt;/h4&gt;

&lt;p&gt;With &lt;code&gt;app.py&lt;/code&gt; ready, let’s serve the app with Greppo and look at our output!&lt;/p&gt;

&lt;p&gt;Simply run the serve command on the console,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;greppo serve app.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Note: It will take a few seconds to run if this is the first time you’re prototyping with Greppo because Python is generating cached &lt;code&gt;.pyc&lt;/code&gt; for fast execution)&lt;/p&gt;

&lt;p&gt;You should get the following output,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INFO:     Started server process [76886]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, head on over to &lt;code&gt;http://0.0.0.0:8080&lt;/code&gt; in your favorite browser and viola!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffqb22u9w902z1mmuy5po.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffqb22u9w902z1mmuy5po.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the right you should see,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The base layer.&lt;/li&gt;
&lt;li&gt;The data as an overlay layer.&lt;/li&gt;
&lt;li&gt;A default draw feature on the right.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On the left you should see,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Some options to change the base layer. &lt;/li&gt;
&lt;li&gt;An on/off toggle for the overlay layer.&lt;/li&gt;
&lt;li&gt;lat/long details of the draw feature as seen on the right.&lt;/li&gt;
&lt;li&gt;A bar chart.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now go ahead and interact with the map! Edit the existing polygon by hitting the edit button on the toolbar,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1qhdl3h58264jo1p4ml9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1qhdl3h58264jo1p4ml9.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;which should change to,&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8dtaq6mly7okalba6wxz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8dtaq6mly7okalba6wxz.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you hit edit the existing polygon will show up with it’s edges, &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fud41vw1dfbjyp9p6tm8i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fud41vw1dfbjyp9p6tm8i.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go ahead and drag the points around the red dots on the map and hit &lt;code&gt;Save&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Hit the update button which should now turn red, and note the numbers on the bar chart refresh!&lt;/p&gt;

&lt;p&gt;As an exercise, modify the code from step 6 to account for multiple polygons on the draw feature and try combining the values (hint: simply loop through the list of polygons, extract the geojson data and add them up!)&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;It took us about 4 mins to get started with this simple example and that’s the flexibility of Greppo. &lt;a href="https://docs.greppo.io/index.html" rel="noopener noreferrer"&gt;Here’s&lt;/a&gt; a link to the docs if you’d like to learn more!&lt;/p&gt;

&lt;p&gt;Feel free to reach out with questions or feedback!&lt;/p&gt;

&lt;p&gt;Happy hacking!&lt;/p&gt;

</description>
      <category>geospatial</category>
      <category>webdev</category>
      <category>python</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
