All Products
Search
Document Center

Lindorm:Overview

Last Updated:Oct 16, 2024

Lindorm GanosBase enhances the capabilities of primary key indexes and secondary indexes provided by Lindorm to accelerate the execution of spatio-temporal queries. Spatio-temporal queries are queries in which spatial columns that store coordinates or geometry objects or a combination of spatial columns that store coordinates or geometry objects and time columns are specified as conditions. This topic describes the concept, types, and scenarios of spatio-temporal indexes.

Z-ORDER indexes

When you create a primary key index or a secondary index in Lindorm GanosBase, you can use the Z-ORDER indexing function to add indexes for spatial columns that store geometry objects or a combination of spatial and temporal columns that store geometry and time data. The Z-ORDER indexing function returns an encoded value, which is called the Z-ORDER code or spatio-temporal code. This code is used as a part of the primary key index or secondary index. The spatio-temporal index of Lindorm GanosBase is an embedded expansion of the primary key index or secondary index of Lindorm to accelerate spatio-temporal queries.

Types of Z-ORDER indexes

Z-ORDER primary key index

If a Z-ORDER code is included in a primary key index, this index is a Z-ORDER primary key index. Example: PRIMARY KEY(Z-ORDER(g)).

Z-ORDER secondary index

If a Z-ORDER code is included in a secondary index, this index is a Z-ORDER secondary index. Example: Z-ORDER(g).

For more information about how to create a Z-ORDER index, see Create a spatio-temporal index.

Z-ORDER indexing function

Lindorm GanosBase calculates the spatio-temporal code based on the input parameters that you specify for the Z-ORDER function. The following table describes the methods that you can use to specify the input parameters of the Z-ORDER indexing function.

Note

If two spatial objects are only a few centimeters away in distance, the spatio-temporal codes generated by the Z-ORDER function for the two objects may be the same.

Format

Parameter

Scenario

Z-ORDER(Point) or Z-ORDER(X, Y)

  • A column that stores points.

  • Two columns that store the longitude and latitude of points.

An index is created for the specified points. You can use the index to accelerate queries in which spatial ranges are specified as conditions.

Z-ORDER(Point, Time) or Z-ORDER(X, Y, Time)

  • A column that stores points and a column that stores time data.

  • Two columns that store the longitude and latitude of points, and a column that stores time data.

Indexes are separately created for the specified points and time data. You can use the indexes to accelerate queries in which spatial and time ranges are specified as conditions.

Z-ORDER(LineString) or Z-ORDER(Polygon)

  • A column that stores line strings.

  • A column that stores polygons.

An index is created for the specified line strings or polygons. You can use the index to accelerate queries in which spatial ranges are specified as conditions.

Z-ORDER(LineString, Time) or Z-ORDER(Polygon, Time)

  • A column that stores line strings and a column that stores time data.

  • A column that stores polygons and a column that stores time data.

Indexes are separately created for the specified line strings, polygons, and time data. You can use the indexes to accelerate queries in which spatial and time ranges are specified as conditions.

S2 secondary indexes

Important

Only LindormTable that is later than V2.6.5 supports S2 secondary indexes.

If you use the S2 indexing function on a column that stores POLYGON, MULTIPOLYGON, LINESTRING, or MULTILINESTRING data when you create an index, LindormTable automatically creates an S2 secondary index for the index. You can use S2 secondary indexes to filter and calculate data based on S2 cells. You can use S2 secondary indexes to filter and calculate data based on S2 cells.

S2 secondary indexes divide the space into evenly sized S2 cells and allocate an unique ID for each cell based on the Google S2 algorithm. Each cell intersects one or more faces. The intersection information is recorded in an index.

S2 indexing function

Syntax

The S2 indexing function accepts a geometry object and an S2 level as input parameters and returns the IDs of S2 cells that are covered by the specified geometry object at the specified level. For more information about how to create an S2 index, see Create a spatio-temporal index.

Set<Long> S2(String geomColumnName, int level)

Parameters

Parameter

Description

geomColumnName

The name of a column that stores POLYGON, MULTIPOLYGON, LINESTRING or MULTILINESTRING data. The coordinates of the data in the column must be WGS84 coordinates.

Important

LINESTRING or MULTILINESTRING data is supported only in LindormTable 2.6.7.5 and later versions. If you cannot upgrade LindormTable in the console, contact the technical support (DingTalk ID: s0s3eg3).

level

The level of S2 cells. Valid values: [1,30].

Select an index

Scenarios of Z-ORDER indexes

Z-ORDER indexes are suitable for filtering spatial points. If you need to determine the spatial relationship between spatial points in query conditions, you can use the Z-ORDER function in a format to create an index based on your requirements. For more information about the scenarios of the Z-ORDER indexing function, see Z-ORDER indexing function.

Z-ORDER indexes are applicable to the following scenarios:

  • Spatio-temporal range query: You can use Z-ORDER indexes to query the trajectory of a vehicle in an area over a specified period of time.

  • Surrounding query: You can use Z-ORDER indexes to query vehicles within a specified distance around a location and obtain the real-time locations of the vehicles.

  • Trajectory statistics: You can use Z-ORDER indexes to collect the statistics of a trajectory point that enters and leaves an area, including the entry time, leaving time, duration of stay, and number of trajectories.

Z-ORDER indexes can also be used in simple query conditions to filter line or polygon data.

  • Query line data: You can use Z-ORDER indexes to query roads within a specified distance around a location. The information of each road is stored as a LINESTRING or MULTILINESTRING object in the database.

  • Query polygon data: You can use Z-ORDER indexes to query business districts within a specified area. The information of each district is stored as a POLYGON or MULTIPOLYGON object in the database.

Scenarios of S2 indexes

Compared with Z-ORDER indexes, S2 indexes are more suitable for filtering line strings and polygons. For non-aggregate queries, you can use S2 indexes to filter out data in cells that do not match query conditions to accelerate the queries.

  • Geofencing monitoring: You can use S2 indexes to query the geofences in which trajectory points are located in real time. For a query performed on a dataset that contains millions of geofencing data records, the result can be returned within milliseconds.

  • Surrounding query: You can use S2 indexes to query business districts within a specified distance around a location in real time.

In addition, S2 indexes can be used to update the stored statistics in real time. Therefore, you can use S2 indexes to aggregate and collect data based on cells.

  • Quantity counting: You can use S2 indexes to count the number of business districts and trajectories based on cells.

  • Collect area statistics: You can use S2 indexes to collect statistics such as vegetation coverage and the sum of transaction volume by cells.