In addition to the default spatial index, Ganos provides a multi-bounding-box spatial index to accelerate queries on geometric line objects.
Syntax
CREATE INDEX index_name ON table_name USING GIST(geom_column_name operator_class);Parameters
Parameter name | Description |
geom_column_name | The name of the target column on which to create the multi-bounding-box spatial index. |
operator_class | To create a multi-bounding-box spatial index, you must specify an operator class. Valid values are:
|
Description
For LineString and MultiLineString objects that contain many points or have a large spatial span, the object is split during index building to create a multi-bounding-box spatial index.
The index split mode is specified by the ganos.geometry.mbbox_split_mode parameter. Valid values are
lengthandpoints, which specify splitting by object length or by the number of points. The default value islength. The rules are as follows:When you split by object length, the length of each segment is specified by the ganos.geometry.mbbox_split_length parameter. The maximum number of segments is specified by the ganos.geometry.mbbox_split_max_segments parameter. If splitting the object by the specified length results in more segments than the maximum allowed, the length of each segment is recalculated as: Total Length / Value of the `ganos.geometry.mbbox_split_max_segments` parameter.
When you split by the number of points, the number of points in each segment is specified by the ganos.geometry.mbbox_split_points parameter. The maximum number of segments is specified by the ganos.geometry.mbbox_split_max_segments parameter. If splitting by the specified number of points results in more segments than the maximum allowed, the number of points in each segment is recalculated as: Total Points / Value of the `ganos.geometry.mbbox_split_max_segments` parameter.
Queries are transparent and require no changes to SQL statements.
Examples
Geometry type
CREATE TABLE line_test(id int, geom geometry); INSERT INTO line_test VALUES(1, st_geomfromtext('Linestring(0 1, 0 0, 1 0, 2 1,2 2,3 3)')); --- Create a 2D spatial index CREATE INDEX line_test_gist_geom_2d ON line_test USING GIST(geom); --- Create a 2D multi-bounding-box spatial index CREATE INDEX line_test_gist_geom_2dx ON line_test USING GIST(geom gist_geometry_ops_2dx);Geography type
CREATE TABLE line_test(id int, geog geography); INSERT INTO line_test VALUES(1, st_geogfromtext('Linestring(0 1, 0 0, 1 0, 2 1,2 2,3 3)')); --- Create a 3D spatial index CREATE INDEX line_test_gist_geog_3d ON line_test USING GIST(geog); --- Create a 2D multi-bounding-box spatial index CREATE INDEX line_test_gist_geog_2dx ON line_test USING GIST(geog gist_geography_ops_2dx);