Welcome to the Building Geospatial Multi-Lay Apps with Snowflake and Streamlit quickstart. Today you will learn how to analyse and transform geospatial data in Snowflake. You will be using Ordnance Survey open datasets available on the marketplace as well as the worldwide open overture buildings dataset provided by CARTO.

This is a progressive learning experience from viewing points on a mapk right through to building a multi layer app - which pulls together buildings with unique property reference numbers, the road network and urban extents.

You will be covering:

Thoughout the experience, you will demonstrate the concepts with Snowflake Notebooks and Streamlit.

Structure of the session

The Lab consists of three notebooks and two Streamlit applications.

What You Will Learn

What You'll Build

Prerequisites

Open up a new SQL worksheet and run the following commands. To open up a new SQL worksheet, select Projects » Worksheets, then click the blue plus button and select SQL worksheet.

CREATE DATABASE IF NOT EXISTS ANALYSE_LOCATION_DATA;

CREATE WAREHOUSE IF NOT EXISTS LOCATION_ANALYTICS;

CREATE SCHEMA IF NOT EXISTS NOTEBOOK;
CREATE SCHEMA IF NOT EXISTS STREAMLIT;
CREATE SCHEMA IF NOT EXISTS DEFAULT_SCHEMA;
ALTER ACCOUNT SET CORTEX_ENABLED_CROSS_REGION = 'ANY_REGION';

CREATE OR REPLACE WAREHOUSE XX_LARGE_HEAVY_LIFT
WITH 
  WAREHOUSE_SIZE = '2X-LARGE'
  AUTO_SUSPEND = 60
  AUTO_RESUME = TRUE
  INITIALLY_SUSPENDED = TRUE;


Ordnance Survey Datasets

alt text

Carto Datasets - Obtain the following datasets from the marketplace

This dataset provides sample building polygons all over the world.

alt text

Are you ready to start learning about location data in Snowflake?

This tutorial will take you through how you can use location data to perform spatial calculations, joins, and visualise the data using the popular Pydeck python package. We will be using the freely available datasets which you have now installed to step through examples of how geospatial data can be handled.

import

This app gives you an example of how you can bring all these datasets together to form a multi layered mapping visual.

You will add a selection of supporting files for the app. In this example, you will import a logo, a style sheet and create a config.toml file. All of which provide additional styling to the app.

Download and the following Style Sheet and add to the app directory. The app directory is located in the side pane under the Files tab.

To add a file, you will need to click on the + and select upload from local.

Browse to the downloaded file and upload.

Download the following Logo and add to the app directory in the same way as previously.

The following notebook will leverage building data from the UK Nationall Geographic database. You will combine this with historic solar elevation data in order to determine what solar power could be generated from these buildings.

The following streamlit will allow you to visualise the buildings within any urban extent that has available sample building data to understand the potential solar radiation.

Download the following Logo and add to the app directory

Run the app

You will be able to select an urban area which will give you summary details as well as the buildings information. Each building is color coded based on the level of potential energy efficiency.

the side bar will give you more information about the buildings and weather in the selection.

You will note that when you Run Cortex it leverages the Anthropic LLM which gives you written analysis about the building with the most potential.

Conclusion

Congratulations on completing the Building Geospatial Multi-Layer Apps with Snowflake and Streamlit Quickstart! Throughout this session, you've explored how Snowflake can be used to analyze and transform geospatial data, combining multiple datasets to generate valuable insights.

What You Learned

Next Steps

With this foundational knowledge, you can extend your analyses by:

We hope this hands-on lab has provided you with the confidence and skills to apply geospatial analytics in your own projects. Happy analyzing! 🚀

Related Resources

Source code

Further Related Material