Querying Spatial Data: Oracle Query Model


        This page is a summary of chapter four in the Oracle8i Spatial User's Guide and Reference versions 8.1.5 and 8.1.6.  For a more detailed explanation and more examples see these reference guides.



The Oracle Query Model:
    To query spatial data, each geometry must be represented in tiles.  Tiles are fully tesselated regions defined in a total specified area.  Each geometry is contained in one or more tiles, so the tiles can represent the approximate location of each geometry.  Tiles are important for quick and accurate selection of geometries which are queried spatially or spatial joined  because tiles contain a subset of all the geometries within the total area defined.  Therefore, only a subset of the geometries have to be manipulated.  Oracle uses a primary filter to find the tiles for all geometries used in a specific spatial query or join.  These tiles are then used in a secondary filter to find the exact result for the spatial query or spatial join.  By using this two-tier query model Oracle can quickly extract relavant tiles (which contain the geometries) and then compute the complex spatial query or join only on the geometries contained in these tiles.     In order to define a spatial query in Oracle three parameters must be defined: two geometries used in the spatial query or join and parameters defining the type of spatial query or join.
 

Examples:

                            Tessellated Layer with Multiple Objects


                                                                        Figure 4-1 Oracle8i Spatial User's Guide and Reference:  4-2

    This example shows a tessellated layer with equal sized tile.  The tile are signified by T# and the geometry object are represented by a number.  The spatial indexing would be represented as followed:  Geometry 1013 is in tiles T1, T2, T3, and T4; Geometry 501 is in tiles T2 and T7;  Geometry 12 is in T3 and T4; Geomety 1243 is in tiles T3, T4, T5, and T6; and Geometry 61 is in tiles T8 and T9.

    This next example shows a typical spatial query, Requesting all objects that lie within a defined fence or query window.

                Tessellated Layer with a Query Window

                                                        Figure 4-2 Oracle8i Spatial User's Guide and Reference:  4-2

    To find the objects that lie within the defined query window the primary and secondary filters will be used

    Primary Filter

    Secondary Filter