com.supermap.data

Class SpatialIndexType



  • public class SpatialIndexType
    extends Enum

    This class defines spatial index constant

    Spatial index is used to improve spatial query efficiency. SuperMap provides RTree, QTree, sheet index and multi-tier grid index.

    The index methods above are only fit for vector data.

    A dataset can only adopt one kind of index at a time. But this dataset can delete its current index and change the index to a new one. SuperMap automatically maintains the index if the dataset is under editable status. Noted that if a dataset is edited serveral times, SuperMap will ask you whether to rebuild spatial index due to the impact of index efficiency reduced.

    1. UDB and PostgreSQL datasource only supports RTree. DB2 datasource only supports multi-tier grid index.
    2. The point dataset in the database doesn't support QTree and RTree.
    3. Network dataset doesn't support spatial index.
    4. CAD dataset doesn't support multi-tier grid index.
    5. Route dataset doesn't support multi-tier grid index.
    6. Tabular dataset doesn't support spatial index.
    7. For database type datasource, the number of records should be greater than 1000, so that the spatial index can be built.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static SpatialIndexType MULTI_LEVEL_GRID
      Multi-level Grid Index Multi-tier grid index adopts advantages of both RTree index and QTree index.
      static SpatialIndexType NONE
      No spatial index No spatial index is fit for the small size of data
      static SpatialIndexType QTREE
      Quadtree Index Quadtree index is an effective 2D spatial index, and its basic idea is: the entire working space is encoded to 0, with horizontal and vertical lines divided into four parts, which are encoded to 00, 01, 02 and 03 as the order, the upper left corner is 00, the lower right corner is 03; the same way to divide each grid, e.g., the grid 00 is divided into 000, 001, 002 and 003.
      static SpatialIndexType RTREE
      RTree index R-tree is an index structure based on disk, which is an natural extension to the B-tree (one dimension) in the multi-dimension space.
      static SpatialIndexType TILE
      Tile Spatial Index In SuperMap SDX+, the spatial objects are classified according to one attribute field or a given range (sheet length and width).
    • Field Detail

      • NONE

        public static final SpatialIndexType NONE
        No spatial index No spatial index is fit for the small size of data
      • RTREE

        public static final SpatialIndexType RTREE
        RTree index R-tree is an index structure based on disk, which is an natural extension to the B-tree (one dimension) in the multi-dimension space. It is convenient to integrate the current database system, such as Oracle, SQL Server, etc, and it supports diversified spatial query operation. In fact, it has been widely used and is one of the most popular spatial indexes. The R-tree spatial index defines several rectangles to contain geometric objects, that is, a rectangle contains some objects which have the close spatial locations. So the rectangle is regarded as the spatial index, which includes the pointers of the geometric objects.As shown in the figure, the rectangle named A includes the geometric objects such as D, E, F. The rectangle named B includes the geometric objects such as H, I, J and K. The rectangle named C includes the geometric object such as M, L. An example of R-tree spatial index displays as below.

        If you perform the spatial index, you should first determine which rectangles are in the search window, then determine which geometric objects are in those rectangles. In this way, the query will be speed up. Note:

        1. R-tree index is suitable for static data, e.g,, the base map data and the data which doesn't often need to be edited (except the attribute data editing) are recommended to establish the R-tree index.

        2. This index supports concurrency operation.

      • QTREE

        public static final SpatialIndexType QTREE
        Quadtree Index Quadtree index is an effective 2D spatial index, and its basic idea is: the entire working space is encoded to 0, with horizontal and vertical lines divided into four parts, which are encoded to 00, 01, 02 and 03 as the order, the upper left corner is 00, the lower right corner is 03; the same way to divide each grid, e.g., the grid 00 is divided into 000, 001, 002 and 003. According to the need, you can also continue to divide them. The dividing layers depend on the number and the average size of the objects in the research area. If the object shown above is objects contained by the entire dataset, then its quadtree index structure is established as shown below:

      • TILE

        public static final SpatialIndexType TILE
        Tile Spatial Index In SuperMap SDX+, the spatial objects are classified according to one attribute field or a given range (sheet length and width). The spatial objects are managed by the index to improve the query speed. As shown in the figure below shows the map according to the given range to create the tile spatial index:

        In particular, the tile spatial index can also be cached to the local (in the form of binary file), so that it can further improve the speed of query and retrieval. File caching is an intelligent distributed storage scheme, which is provided by SuperMap SDX+ to balance the network and server load and improve the whole performance. After you open the file cache option, when the application is accessing data stored in the spatial database, it will firstly check whether the data exists in the local cache libarary, if there is no corresponding cache data or the cache data is not the latest version, it will read the data from the server and update the local cache data, so the next time it can read the local cache data. If the local cache has the latest version of the corresponding data, it does not need to use the network to access the server to request data, but directly read the local cache data to complete the display or analysis. Through this solution, the database server load and network load can be reduced greatly, and the whole performance of the application is greatly improved.

      • MULTI_LEVEL_GRID

        public static final SpatialIndexType MULTI_LEVEL_GRID
        Multi-level Grid Index

        Multi-tier grid index adopts advantages of both RTree index and QTree index. It has good feature of concurrency editing. If you don't know which spatial index is good for you, you can choose multi-tier grid index.

        Adopt the method of dividing multi-level grid to manage data. The basic method of grid index is to divide the dataset into equal or unequal grids according to certain rules and record the grid location of each geographic object. Commonly used in GIS is the regular grid. When the user performs spatial query, first the grid of the query object is calculated, and then quickly query the selected geography object through the grid to optimize the query operation.

        As the picture shows:

        The spatial grid index has three grid levels, namely one, two, and three grid levels in current version, and each level has its own distinct cell size. The first grid level has the smallest cell size, and the data of 50% belongs to the first level. The second and third cell size must be larger than that of the preceding. SuperMap helps you calculate the grid size and level count, so you don't need to set those parameters. Advantage: The multi-tier index will improve the speed when browsing the data. Note: this index type supports dynamic concurrency editing, supports database datasource.