Primitives which may be referred to as spatial data or primitive data, are basic elements, such as lines, curves, and polygons, which can be combined to create more complex graphical images. In the context of an electronic document such as a map created by a mapping application, primitive data may define locations on the map. Primitive data may be described by a Cartesian coordinate system such as an X-Y convention in two-dimensional space.
A group of primitive data may make up a particular shape. In the context of a map, the particular shape (i.e., group of primitive data) may define a city, county, state, etc. Entity data may be associated with primitive data or a group of primitive data. Such entity data can describe or provide detail (information) as to the particular primitive data or group of primitive data. For example, entity data may include the name, demographics, and population of a particular region defined by the group of primitive data.
In a specific example, a group of primitives may represent the shape of the United States at a particular resolution. A different set of primitives might be used to represent the shape of the United States at a higher resolution. Each set of primitives needs to be stored at a different level of detail. Such levels of detail may be represented by a quad-tree arrangement, where a given level is the grids of the previous level divided into four equal-sized grids. The primitives assigned to that level are associated with the quadrants they intersect. At the subsequent level of detail, each quadrant is sub-divided into four equally sized smaller quadrants, each occupying a proportionally smaller part of the coordinate space. The higher detail primitives assigned to this level are again associated with the quadrants they overlap. The division of grids in a quad-tree can continue to infinitesimal degrees of level of detail. Additionally, at each level of detail new features which had no appropriate representation at higher levels may be introduced. As an example, the lowest level of detail might contain only the primitives for the United States. The next higher level of detail would contain primitives for the United States and each of the states. The next higher level would contain higher resolution primitives for the United States, all of the states, and introduce primitives representing the counties, and so on.
If entity data is used to describe the primitive data or groups of primitive data that represent the United States, the state of Texas, the city of Amarillo, and a street in Amarillo, separate entries would have to be made for each group of primitive data. In other words, the group of primitive data representing the United States would have its own entry for entity data, the group of primitive data representing the state of Texas would have its own entry for entity data, the group of primitive data representing the city of Amarillo would have its own entry for entity data, and the group of primitive data representing a street in Amarillo would have its own entry for entity data.
In many situations, it is necessary to retrieve information through spatially directed queries. An example of such a query would be to return all the primitives and associated entity data that intersects some subset of a given coordinate space. It is desirable to have the entity data stored such that a minimum amount of information is scanned in order to retrieve the data required to satisfy the query. It is also desirable to store entity data likely to be retrieved together in physically close locations on storage media to minimize retrieval time.
When storing multiple levels of detail of primitive data in a quad-tree arrangement as described above, it may be necessary to determine a reasonable storage location and reference system for the entity data to be associated with primitive data or groups of primitive data. An approach is to store the entity data in a relational table tied to the primitive data (i.e., groups of primitive data) with a key. A second approach as described above is to duplicate the entity data with each association of primitive data (i.e., groups of primitive data). The first approach has the drawback of losing storage locality when accessing the entity data, while the second approach involves wasteful duplication of entity data.