Using space-filling curves to improve the quad tree for spatial indexing

Spatial indexes, like the ones that are based on Quad Tree, are important in spatial data-bases for the effective implementation of queries with spatial constraints, particularly in the case where queries include spatial links. The quad trees are a very interesting subject, given the fact that they give the ability to solve problems in a way that focuses only on the important areas with the highest density of information. But it is not without the disadvantages because the search process in the quartile suffers from the problem of repetition when reaching the terminal node and return to the behaviour of another way in the search and lead to the absorption of large amounts of time and storage. A database management system can handle data very easily if the object is one-dimension (sequential). 
In this paper, improve the quad tree by combining one of the space filling curve types, including the Hilbert curve and the Z-ordering curve with a quad tree. It will convert from two-dimensional to one-dimensional and sequentially search and end the problem of repetition whenever it reaches a terminal node Ordinary quad tree. Resulting in reduced storage space requirements and improved implementation time.


Introduction
Spatial indexing is based on physically grouping indexed items.For instance, countries may be grouped according to the continent.With spatial indexing, there is even a possibility of providing virtual reality (VR) fly through (or over, or under) for the sake of helping users in maintaining their search context while users narrow or expand their search domain.
Spatial indexing has richness which parallels the indexing with an author or a subject.Spatial indexing concept is quite powerful, that for the management of records, they are found according to their correlation with a place.Numerous records are strongly coupled to a place.Like other indexing forms, geographical indexing can be combined with other indices.There is a wide range of cases when we need to find a subset of spatial information for various Purposes.For example, when we talk about things that happened in the past, we try to link them with the years or our ages, and in this way we treat the events as a time sequence and index the events with time.The power of indexing lies in a commonly used strategy humans have used for thousands of years: divide and conquer.
Quad trees are a very straightforward spatial indexing technique; effectively we divide the whole search area into four quarters and ignore three quarters when our target is definitely not there.We keep on dividing the search space into four quarter until we find what we need [7].A space filling curve (space filling curves) is a continuous path that passes through each one of the points in a space, which gives a one-to-one correlation between point coordinates and the 1-D-sequenced numbers of the points on the curve.Spacefilling curves were commonly utilized in math and for the transformation of multi-dimensional tasks to 1-D forms.For scientific applications, ordering calculation or data along space-filling curves may be utilized to exploit locality in the case of partitioning to parallel systems or in the case of restructuring for exploiting memory hierarchy [3].The presented paper has been organized in the following: Section 2 discusses related works.Section 3 includes a description about quad trees, section 4 gives a brief survey about Space filling curves.Section 5 explains method for quad tree building, Section 6 gives experimental results.Section 7 includes the paper conclusions.

Related work
This section presents the studies about the spatial index with several published researches related to the goals of this work: 1. Julian Hirt (2010) Implemented a method for path finding on a 3m * 3m board for the mobile robot, combining the A* algorithm with the quad tree, resulting in an optimal path and shorter time than using the A* algorithm with the regular Grid [2].
2. Amitava Chakraborty (2011) balanced the quad tree with the use of point pattern analysis; because the effectiveness of the search approach is dependent on the tree height, arbitrarily inserting point features could result in the tree being unbalanced and result in longer searching time.Post implementing this algorithm, it has been noticed that its performance enhanced [8]. 4. Phyo Wai (2014) Provide a proposed compression system for GIS by Using a quad tree way that is an integral part of Cluster encoded method.This system was produced to be more convenient to pressure more than other pressure methods.It is effective in sending data over the current network [1].
5. Ashwaq Talib Hashim (2016) presented a color image compression approach for increasing the ratio of compression with no impact on the original scene by distortion or noise.With the use of low lossy rate quad-tree compression approach for increasing the association amongst pixels with the use of Quantizing and encoders of entropy like shift encoding and run length encoding will additionally compress the image.the results of CR (i.e.Compression Ratio) of the presented approach on average to be about 1:29 of the original image size, higher ratio of compression may be accomplished with the increase of the levels of compression, this high ratio of compression has been considered an optimal ratio in comparison to the achieved PSNR (Peak Signal to Noise Ratio) of decompressed-compressed image [6].
6. Satori Tsuzuki (2019) a method was proposed to create a central graph of the geometrically complex road map using a quad tree pyramid to simulate cellular automation and trace the distant leaves of the tree that used Morton's curve.The leaves were chosen to maintain a certain distance between the previously selected sheets as a graph.Each specific node searches the adjacent nodes and stores them as glyphs.The shortest path of the resulting graph was produced using the Dextra algorithm.It is quite possible that done develops a new technology to create a suitable network diagram for vehicle simulation studies in transport research [11].

Quad Tree Basics
A quad tree is a tree data structure where every one of the internal nodes has precisely 4 children.Quad trees are the 2-D analog of octrees and are usually utilized for partitioning a 2-D space via the recursive sub-division of that space to 4 areas or quadrants.The data which is related to a leaf cell differs according to the application, but the leaf cell denotes a "unit of interesting spatial information".The sub-divided areas could be rectangular or square shaped, or they could be of a random shape.This data structure has been referred to as a quad tree by R. Finke and J.L. Bentley in 1974.An analogous partitioning is referred to as Q-tree as well.All quad trees forms have some features in common: 1.They decompose space into adaptable cells 2. Each cell (or bucket) has a maximum capacity.When maximum capacity is reached, the bucket splits 3. The tree directory follows the spatial decomposition of the quad tree.
Quad trees could be categorized based on the data type that they represent, and that includes points, areas, curves, and lines.Quad trees could as well be categorized according to whether the tree shape is not dependent on the order of data processing (fig 1) and (fig 2) Represent points and region by quad tree [7] .

Space filling curves (SFC)
An SFC is a continuous trajectory visiting each one of the points in space precisely one time in a specific order thereby resulting a one-to-one correlation between points' coordinates and the one-dimensional sequence numbers of points on the curve.Which gives a way for linear ordering of a grid points.The aim is conserving locality, thus the points that are near in space have to be stored close to one another in a linear ordering [2].
The concept of multi-dimensional space mapping to the 1-D space has a significant impact on applications which include multi-dimensional data.Multi-media data-bases, Geographic Information Systems (GISs), and Image processing are examples of multi-dimensional applications.By using a mapping scheme, a point in the D-dimensional space can be represented with one integer reflecting the different dimensions of the original space.Space filling curve can be used for mapping from multi-dimensional space to 1-D space.
There are various space-filling curve types.They differ in the way they map into the 1-D space.Choosing the suitable curve for any application based on knowing the mapping approach which is given by every space-filling curve.Some space filling curve examples are the Hilbert curve, and the Z-order curve [1].The space filling curves may be utilized to create a quad tree structure and construct relevant data of higher dimensions.The order of how these four sub-regions are closely related to the area fill curve is related.If a multidimensional application applies a Z-order or H-order curve, a quad tree in SW, SE, NW, and NE will be created more efficiently to access the data.Work has been done on the map of the province of Baghdad, the capital of Iraq, which contains points representing intersections and each point has a two-dimensional events as shown in the fig ( 5):

Performance results
In the process of spatial indexing, The hybrid structure of quad tree and Hilbert curve or Z-order mapping may benefit of each of the retrieval (time) and storage (size).The objects have been split and represented, Determine the minimum number of points at which the division of the quartile is divided into quarters is k = 10 (This means that each quarter contains 10 points or less not divided into four quarters) , Work has been applied to intersections in Baghdad's two-dimensional map, where each point has coordinates (x, y) on the map.After quad tree is applied to the points, the required amount of storage was calculated in bytes and then the hybrid structure of quad tree and Z-curves, quad tree and H-curves was applied.This resulted in a significant reduction in the amount of storage required, as the points in the hybrid state were serialized.Note that the hybrid structure is equal in terms of storage for quad tree with Z-curves and quad tree with H-curves for each number of points.The experiment was carried out each time as shown in (table 1).When the above storage results are represented by the graph, the difference is clear.The black line represents quad tree, the red line represents Z-curves with quad tree, and the blue line represents H-curves with quad tree, as shown in the (fig 6).6): As the required storage for each case In the same way, when calculating the amount of time it takes, it will not retrieve the point information which is (X: 44.42574332115971, Y: 33.30565709558853) looking for each time for a different number of points.The time taken when applying quad tree alone is much greater than applying the hybrid state of Z-curves with quad tree and H-curves with quad tree, as shown in (table 2) .In previous experiments the focusing was on a certain point (constant) for a different number of points each time.Now, different points have been taken from the map and work on it and at all intersections points in the Baghdad map of 16039 points (fixed).Where x and y are the coordinates for each point that are searched each time, as shown in (table 3) of size.
3. A. A. El-Harby (2012) presented a new Quad tree-based Color Image Compression Algorithm By dividing thecolor of the image into RGB components and then dividing the blocks on the way of the quad tree The ratios of compression of the second were in the range from 0.25 to 0.80 at a value of threshold equal to 0.1, and from 0.78 to 0

Table ( 1
): The storage size taken for each case, with number of k = 10

Table ( 2
): The Response Time taken for each case, with number of k = 10.