Geospatial Index
The Geospatial Index has been created to provide a more efficient way of building queries associated with regions and location information. It is designed to be used for spatial access methods, for example, for indexing multi-dimensional information such as geographical coordinates, rectangles or polygons.
When you create a database in Geo SCADA Expert and add items, each item has associated with it location data.
The following example illustrates how a query can be rewritten to make use of the geospatial index:
The first example illustrates a more traditional query using the tables within the database directly, in this case GISLOCATION and the using the de-reference operator to select the field GEOPOSITION.
SELECT
CDBOBJECT.FULLNAME, CDBOBJECT.GISLOCATION->GEOPOSITION
FROM
CDBOBJECT CROSS JOIN CGISREGION
WHERE
CDBOBJECT.GISLOCATION->GEOPOSITION WITHIN CGISREGION.GEOREGION AND CGISREGION.NAME = 'R1'
This query would search the whole database to identify the items within the region (R1), which if there are many items may take time.
The same query can be written using the index and will be more efficient in producing a result.
SELECT
CDBOBJECT.FULLNAME, CDBOBJECT.GEOPOSITION
FROM
CDBOBJECT CROSS JOIN CGISREGION
WHERE
CDBOBJECT.GEOPOSITION WITHIN CGISREGION.GEOREGION AND CGISREGION.NAME = 'R1'