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

Connect Nodes, Centroids and Voronoi Cells to POI

Learn how you can enhance a table with POI's by adding columns that hold Voronoi cells, Centroids and Node references that can be used for calculating shortest paths between POI's.

Overview

🎓 beginner 10 min. SAP HANA CloudBeginnerSAP HANA SpatialSAP HANA CloudSAP HANA DatabaseSAP HANA Multi Model Processing

You will learn

  • How to assign Voronoi cells to nodes of a transportation network
  • How to assign a centroid to a Point of Interest
  • How to add a node reference to a POI table
Unknown U Unknown November 1, 2022
Created by July 14, 2021
Contributors

Prerequisites

Prerequisites

Steps

Intro

In your dataset, you have points of interest (table LONDON_POI) as well as nodes of the transportation network (table LONDON_VERTICES). Of course, there is a spatial relation between both (e.g. distance measured by ST_Distance). In this tutorial, you will learn how to assign each POI to its closest node in the transportation network. You can think of example- assigning a bar to its closest street corner.

This way, you will later be able to calculate shortest paths between points of interest. These are the steps involved:

  • Assign Voronoi cells to all Nodes
  • Assign a centroid to each Point of Interest
  • Enhance the POI table with node reference

Step 1 Assign Voronoi cells to all nodes

The first thing you need to do is to enhance the table LONDON_VERTICES by a column VORONOI_CELL that holds the Voronoi cell of the respective vertex/node as an ST_Geometry.

To enhance the existing table, execute this statement:

SQL
ALTER TABLE LONDON_VERTICES ADD (VORONOI_CELL ST_Geometry(32630));

Then use MERGE INTO to update the values and assign it with the respective Voronoi cell using this statement:

SQL
MERGE INTO LONDON_VERTICES
USING
(
	SELECT "osmid", ST_VoronoiCell(shape, 10.0) OVER () AS CELL
	FROM LONDON_VERTICES
) v ON LONDON_VERTICES."osmid" = v."osmid"
WHEN MATCHED THEN UPDATE SET LONDON_VERTICES.VORONOI_CELL = v.CELL;
Step 2 Assign a centroid to each Point of Interest
+
Step 3 Enhance the POI table with node reference
+
Step 4 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 4
1. Assign Voronoi cells to all nodes 2. Assign a centroid to each Point of Interest 3. Enhance the POI table with node reference 4. Test yourself

Learn more →