SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Push Down a Spatial Workload to SAP HANA Database in SAP HANA Cloud

Learn how to create SQL views using hexagonal clustering and QGIS and apply basic styling on a base map.

Overview

🎓 beginner 10 min. SAP HANA CloudBeginnerSAP HANA CloudSAP HANA DatabaseSAP HANA Spatial

You will learn

  • โœ”How to create an SQL view using hexagonal clustering
  • โœ”How to add an SQL view into QGIS
  • โœ”How to apply basic styling to the SQL view on base map
Unknown U Unknown November 1, 2022
Created by July 2, 2021
Contributors

Prerequisites

Prerequisites

Steps

Intro

This tutorial group will comprise of the following tasks:

  1. Install SAP HANA ODBC Driver

  2. Install QGIS

  3. Connect QGIS to SAP HANA Cloud

  4. Upload your first spatial dataset

  5. Visualize data on a base map

  6. Pushing down the spatial workload to SAP HANA database in SAP HANA Cloud

This tutorial will cover the sixth task.

Finally, let’s check how to execute spatial workloads on the database level and get the results to QGIS. Since all spatial processing functions on SAP HANA Cloud are part of the SQL syntax, the best way to go is to create a SQL view which can be consumed in QGIS. So, you need to open the SAP HANA Database Explorer, create an SQL View and consume it in QGIS.


Step 1 Create a SQL view using hexagonal clustering
โ€”

Follow the steps to create an SQL view doing a hexagonal clustering and counting the number of POI’s (points of interest) per cluster:

  1. Go to the SAP BTP cockpit and navigate to your SAP HANA database instance in SAP HANA Cloud. You should see your created and running instance.

  2. Click on Actions and Open in SAP HANA Database Explorer.

  3. You may be prompted for your user credentials. Use the same user, that you have setup in QGIS (i.e. DBADMIN).

  4. Click on the SQL icon in the upper left corner to open a new SQL Console.

  5. Copy the following SQL statement into the SQL Console and execute:

    Code

CREATE VIEW POI_DENSITY AS ( SELECT ST_ClusterId() AS cluster_id, ST_ClusterCell() AS cluster_cell, COUNT(*) AS count_pois FROM “gis_osm_pois_free_1” GROUP CLUSTER BY “geom” USING HEXAGON X CELLS 100 ) ```

You can find more information on Spatial Clustering in the SAP HANA Spatial Reference.

Step 2 Add SQL view into QGIS
+
Step 3 Apply basic styling to the map
+
Step 4 Learn more about SAP HANA Spatial
+
Step 5 Test yourself
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 5
1. Create a SQL view using hexagonal clustering 2. Add SQL view into QGIS 3. Apply basic styling to the map 4. Learn more about SAP HANA Spatial 5. Test yourself

Learn more →