Partition and Cover Field Tree

Project Figure

Project Goal

Partition and Cover Field Tree data structures are implmented for storage of 2D rectangualr objects. Buttom-up tree provides the benefit of being usable for dynamic space size.

Project Details

  • Partition and Cover Field Tree is developed as a final project for the graduate course: Geographical Information Systems and Spatial Databases.
  • Language used: C#
  • Source code is available at GitHub.
  • Package is published as an open source to nuget.

Introduction

Various data structures exist for storing spatial objects. Quadtrees are the most popular structures for storing points and lines. Storing objects like rectangles becomes more challenging due to decisions regarding big objects. For this MX-CIF Quadtree can be very beneficial. In MX-CIF Quadtree, each object can be stored in a node that can completely encapsulate it. Therefore, an object cannot be stored in multiple nodes. This causes a space efficiency problem. To understand this better, let’s look at the following schematic in Fig. 1. When object A is added to the tree, it can be stored in the root, as the tree is empty. Adding object B, causes the root to overflow and requires partitioning. However, Both objects A and B intersect with multiple children, so neither can sink down to lower levels, hence storing becomes inefficient.

Image 1

To Solve this problem and improve the efficiency for storing spatial objects, the following structures were designed:

For implementation purposes, it must be noted that, since children share parents, some of the children may already exist if a neighboring parent has already partitioned. Therefore, it is necessary to search for existing children before creating all the children. A similar situation needs to be considered when deleting objects and merging nodes. Merging can cause children of neighboring parents to become incomplete, therefore a good convention can be merging children of a node if all siblings of the center node are either empty or non-existent.

Bottom-up trees

As is the problem with all quadtrees, the size of the space (width and height), needs to be known to create the root node. This brings a problem that such data structures are not suitable for applications with dynamic space size. Hence, the design of a bottom-up quadtree can be beneficial here. In this project, bottom-up cover field tree is discussed and implemented. In bottom-up cover field tree, the tree is initially empty and there is no root node. When adding object A, an encapsulating node with a size of power of 2 is being created as the root node. Upon adding object B, since B is not encapsulated by the root node, a new parent in the direction to encapsulate B is being created. The new root then creates the remaining children. This way, the structure has high space efficiency and can grow in both directions (smaller and bigger) to accommodate new objects. This is shown in Fig. 4.

Image 4