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

Identify Relevant Networks in Spatial Data

Learn how to identify a relevant area in your spatial data in SAP HANA Cloud, SAP HANA database.

Overview

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

You will learn

  • โœ”How to identify a sub-network that represents only the area relevant to your route
  • โœ”How to create a circle to identify a relevant area in your spatial data
  • โœ”How to flag nodes of the transportation network located in a circle In this tutorial, you will learn how to identify a relevant area in your spatial data. Now that you know the distance from your location to the target destination you want to go to, your next task is to find a route in the transportation network. Instead of finding the path while considering the whole transportation network, it is more useful to first select a meaningful sub-network that represents only the area of the network relevant to your route.
Unknown U Unknown November 1, 2022
Created by July 14, 2021
Contributors

Prerequisites

Prerequisites

Steps

Intro

We will show you how to do that in these two steps:

  • Create a Circle for the Relevant Area
  • Add Flags for all Nodes in the Circle

Step 1 Create a circle for the relevant area
โ€”

First, you need to construct a circle to identify the relevant area for the transportation network. The circle should have a minimal size and should contain origin and destination with a buffer of 500 meters around it. To illustrate how the query is being built we will use step-by-step queries with sub-SELECT statements.

Note, that generally, the center point of the smallest circle, which includes two points, is the center point of their direct connection line.

You can see in this image the circle you will create:

transportation area
transportation area

  1. First, select the two points from the previous tutorials using this statement:

    SQL

SELECT ST_GeomFromText(‘POINT (706327.107445 5710259.94449)’, 32630) AS START_PT, SHAPE AS TARGET_PT FROM LONDON_POI lp WHERE “osmid” = 6274057185; ```

  1. To create a line geometry, which is connecting both points, you can then use the function ST_MakeLine(*).

    SQL

SELECT ST_MakeLine(START_PT, TARGET_PT) AS CONN_LINE FROM ( – previous statement ); ```

  1. To retrieve an arbitrary point on this line, we need to use function ST_LineInterpolatePoint(*), which takes a fraction of the line as argument. For retrieving the center point of the line, we pass the value 0.5.

    SQL

SELECT CONN_LINE.ST_LineInterpolatePoint(0.5) AS CENTER_PT FROM ( – previous statement ); ```

  1. As a final step, we would like to draw a circle with radius distance (start, target)/2 + 500 around CENTER_PT. The respective function, which takes the radius as an input, is called ST_Buffer(*).

    SQL

SELECT CENTER_PT.ST_Buffer(4835) AS AREA FROM ( – previous statement ); ```

  1. The above steps can be combined into a single select using method chaining.

    SQL

SELECT ST_MakeLine( ST_GeomFromText(‘POINT (706327.107445 5710259.94449)’, 32630), SHAPE ) .ST_LineInterpolatePoint(0.5) .ST_Buffer(5000) AS AREA FROM LONDON_POI WHERE “osmid” = 6274057185; ```

Step 2 Add flags for all nodes in a circle
+
Step 3 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 3
1. Create a circle for the relevant area 2. Add flags for all nodes in a circle 3. Test yourself

Learn more →