An Approach to Generate Spatial Voronoi Treemaps for Points, Lines, and Polygons

. As a space-filling method, Voronoi Treemaps are used for showcasing hierarchies. Previously presented algorithms are limited to visualize nonspatial data. The approach of spatial Voronoi Treemaps is proposed in this paper to eliminate these problems by enabling thesubdivisionsfor points, lines, and polygons with spatial coordinates and references. Thedigital distancetransformation is recursively used to generate nested raster Voronoi polygons while the raster to vector conversion is used to create a vector-based Treemap visualization in a GIS (geographic information system) environment. The objective is to establish a spatial data model to better visualize and understand the hierarchies in the geographic field.


Introduction
As a well-known approach of visualizing hierarchical structures, Treemaps use recursive subdivision algorithms to partition an -dimensional plane into the nested regions without producing holes or overlaps.The size of each region corresponds to the value of a data element and the nesting depth represents the depth of the data element in the corresponding hierarchical data structure [1].Treemaps were first presented by Johnson and Shneiderman in 1991 designed to visualize the files on a hard drive [2].Nowadays, they have been widely applied to a variety of domains, such as the sports reporting [3], the photo management [4], the business data visualization [5], and the repository search visualization [6].
Voronoi Treemaps enable the two-dimensional subdivisions of the arbitrary polygons following the norms of Treemaps and Voronoi diagrams within the areas of arbitrary shapes.Since introduced by Balzer and Deussen [11,12] to visualize the software metrics, they have been used in many applications ranging from the biodiversity exhibition [15] to the gene expression [16].But they are rarely used in the field of geography, let alone integrated with the mainstream GIS software.For better integration of Voronoi Treemaps and GIS, we present an approach of generating spatial Voronoi Treemaps for points, lines, and polygons to better visualize the hierarchies in the geographic field.For simplicity, we use the term "SVT" for the spatial Voronoi Treemaps for points, lines, and polygons; except explicit specification is made.
In Section 2, the principles of the SVT and the relevant concepts are introduced.Section 3 elaborates the implementation of the layout algorithm.Section 4 shows several examples.Discussions and the conclusions are given in Section 5.

Preliminary Knowledge
The SVT is a visualization method to create geographical map-like representations of trees with ordinary or weighted V(e 2 ) V(e 3 ) V(e 4 ) V(e 5 ) V(e 6 ) V(e 7 ) V(e 8 ) V(e 9 ) V(e 10 ) V(e 11 ) V(e 12 ) Figure 1: An SVT and its corresponding tree.
Voronoi polygons (or called cells) from a set of generators, such as points, lines, and polygons.As is shown in Figure 1, an SVT is composed of nested cells and their corresponding generators.A level  cell contains all level  + 1 generators that are closer to that level  generator than to any other (e.g., a level 1 cell ( 1 ) contains three level 2 generators  4 ,  5 , and  6 ).Each cell in the hierarchy has a size that is the sum size of its contained leaf cells (e.g., the size of ( 1 ) is equal to the total size of ( 4 ), ( 5 ), and ( 6 )) and a depth that corresponds to its contained generator's depth.The initial boundary of all generators is regarded as the root node, which has an arbitrary shape, mostly a rectangle.As a combination of Voronoi Treemaps and Voronoi diagrams, the SVT is motivated by the work of Balzer and Deussen on Voronoi Treemaps [11,12] and the work of Dong on multiplicatively weighted Voronoi diagrams for point, line, and polygon features [17].Traditional Voronoi Treemaps consist of nested cells without spatial information.Differently, the nested cells and their corresponding generators, both of which have spatial coordinates and references, are used by our proposed Treemap layout to express hierarchies.Generators can represent various kinds of geographic objects, such as cities, railways, and lakes, and cells are their corresponding dominant areas.Voronoi Treemap algorithms usually use centroidal Voronoi tessellations to create nested polygonal structures.In each recursion step, generators are generated randomly and shift to the center of mass of its cell using Lloyd's method [18], whereas generators of different levels are preset and fixed for an SVT.At each recursive subdivision step, the cells are subdivided into smaller polygons from the generators contained within.
Generators can be obtained from the files in shapefile format for an SVT.The shapefile format is a popular geospatial vector data format for GIS software, which is developed and regulated by Environmental Systems Research Institute (ESRI) as an open specification for data interoperability among GIS software products.It can describe vector spatial features (points, lines, and polygons) with spatial coordinates and references.Each feature commonly has attributes to describe itself, such as the name and the location.To clearly convey the idea of the SVT, several key concepts are introduced first.

Relevant Definitions
Definition 1 (see [19]).Let  be a point and let  be a generator (a point, line, or polygon) in  2 ; the distance between  and  is defined as below: where the denotation (, ) represents a specified distance function between two points (  ,   ) and (  ,   ); mostly the Euclidian metric is used, which is defined as In vector mode,   and   are -coordinates and   and   are -coordinates.In raster mode, the coordinates are defined by integer numbers of row and column of raster pixels.Figure 2 shows three distance metrics in raster mode.feature and nonfeature pixels and the features can be points, lines, or polygons, the distance transformation is an operator that converts this binary image to a grey-level image where all pixels have a value corresponding to the distance to the nearest feature pixel [20].It uses only a structuring mask at a time based on the following idea: global distances in the image are approximated by propagating local distances [20].There are various types of distance transformations, depending on which distance metric is used to determine the distance between pixels.In this paper, three most basic metrics are used.They are the Manhattan metric (a cross shaped mask), the Chessboard metric (a 3 × 3 square mask), and the Euclidean metric.
In a digital space, the fulfillment of Euclidean geometry is a complex operation due to the discrete structure [21].In order to get a better approximation of Euclidean distance transformation, several approaches are proposed, such as chamfer distance algorithms [20], sequence algorithms [22,23], and parallel algorithms [24].To simplify the calculation, octagonal distance is used to approximate Euclidean distance transformation, which is an alternate usage of Chessboard distance and Manhattan distance [20].It needs to point out that it is not our intention to acquire a better approximation of Euclidean distance transformation.Such discussions will be encouraged following this paper.

The SVT Algorithm
The SVT uses a recursive layout algorithm to segment a twodimensional plane into nested cells from a set of generators.Generators can be points, lines, and polygons that represent different forms of spatial objects in the real world, among which points are abstracted as their locations, lines represent their skeletons, and polygons depict their boundaries.Each generator is assigned two initial parameters.One is "level" that represents generator's hierarchy and the other is "weight" that reflects generator's certain property.
The construction of SVTs is as follows: first, classify generators into different sets in accordance with their level values.Then, regard the initial boundary and its contained level 1 set of generators as a digital image and process it via distance transformation.The output is a set of raster cells, which makes up a raster ordinary or weighted Voronoi diagram of level 1.For the next hierarchy level, this procedure is performed recursively for all level  + 1 generators within respective level  cells.When the recursion ends, converting the digital images to vector files and overlaying them, a complete layout of SVT is obtained.
For simplicity, let   represent an ordinary Voronoi diagram () or a weighted Voronoi diagram (, ()) of level  in the hierarchy, and let   () denote an ordinary Voronoi region   (  ) or a weighted Voronoi region   (  , (  )) of   ; except explicit specification is made in this section.
The function GetLevelGenerators() (Algorithm 2) is to acquire a level  set of generators from .
A weighted SVT subdivides the two-dimensional space recursively with consideration of both location and weight of each generator, while an ordinary SVT partitions space only considers generator's location.The different division approaches necessitate a different handling of the auxiliary functions PixelsAssignment() and PixelsTransformation() in Algorithm 1.
The function PixelsAssignment() ( Algorithm 3) is to assign values of generators to pixels correspondingly if pixels intersect with generators in the two-dimensional raster space, which is a vector to raster conversion of spatial objects in essence.Specifically speaking, assign (  ) to   (  ) and set (  ) to 0 if a pixel   intersects with a generator   .In  addition,   (  ) is set to (  )/ max((  )) for a weighted SVT.It can be known that   (  ) ∈ (0, 1], which determines the speed of distance transformation of pixel   .  (  ) is an accumulator of   (  ).In this function, define   (  ) =   (  ).Figures 3(a The function PixelsTransformation() (Algorithm 4) is to create a raster Voronoi diagram or weighted Voronoi diagram via distance transformation.For an ordinary SVT, each pixel   with (  ) = 0 will propagate in each loop in accordance with a structuring mask , which can be a cross shaped mask (the Manhattan metric), a 3 × 3 square mask (the Chessboard metric), a disk shaped mask (the Euclidean metric), and so forth.Once a pixel   propagates, its state (  ) will change to 1, which means that this pixel will cease to be processed in For a weighted SVT, we use the property   (  ) to control whether a pixel   with (  ) = 0 propagates in each loop.If   (  ) is less than an established threshold, it continues to execute accumulation.Once it exceeds the threshold,   will propagate and its state (  ) will change to 1.In Algorithm 4, as the maximum of original transformation speed is 1, so the threshold is set to 1.If   's neighbor  pixels   ( ∈ [1, ]) own the same father node with   (  (  ) =   (  )) and have not been processed (  (  ) < 0), the properties of   will be assigned as follows:   (  ) =   (  ),   (  ) =   (  ) and   (  ) =   (  )−1.It can be known from Algorithm 4 that a pixel with a higher original transformation speed owns a higher priority to execute distance transformation.For example, a pixel   with   (  ) = 1 will propagate every time and a pixel   with   (  ) = 0.5 will propagate every two times.From the point of view of vector space, it means that a generator with a bigger weight will dominate more area.Figures 3(d), 3(e), and 3(f) describe the first three steps of distance transformation for a raster layer of a weighted SVT and the variations of pixel properties.
The function PixelsUpdate() (Algorithm 5) is to update the status of pixels and calculate the parameter count.In each loop, if a pixel   has been assigned values by a neighbor pixel (  (  ) > 0) yet has not executed distance transformation ((  ) = −1), set (  ) to 0, which means that this pixel will participate in the next distance transformation.Figures 3(c) and 3(d) show an instance of the function PixelsUpdate() and the variations of pixel properties.
The function TreemapExport() specifies the output mode of SVTs: for each level set of generators   = { 1 ,  2 , . . .,   } ( = 1, 2, . . ., ℎ), a level  set of pixels   = { 1 ,  2 , . . .,   } that represents a raster ordinary or weighted Voronoi diagram for points, lines, and polygons is exported correspondingly.Pixels that have the same identifier will be converted to a vector ordinary or weighted Voronoi polygon   () ( = 1, 2, . . ., ) through a raster to vector conversion.Then, a vector file in shapefile format   with (a) Figure 3: The core process of the subdivision for a raster layer of a weighted SVT: (a) three generators  1 ,  2 , and  3 within a 10 × 10 binary image, where  1 is a square with ( 1 ) = 10,  2 is a line with ( 2 ) = 6, and  3 is a point with ( 3 ) = 4; (b) pixels assignment for  1 ,  2 , and  3 .A pixel   ( = 1, 2, . . ., 100) will be marked with a sign "  (  )/(  )" if it intersects with a generator, in which   (  ) is the current transformation speed of the pixel and (  ) is the status.Blank pixels are marked with "0/ − 1" in default.(c) The Manhattan distance transformation for  1 ,  2 , and  3 for the first time.If   (  ) < 1, it continues to execute accumulation, else   will propagate and (  ) will change to 1.(d) Pixels update for  1 ,  2 , and  3 for the first time.The state (  ) of the pixel   will change to 0 if   has been assigned values yet has not executed distance transformation ((  ) = −1).(e) The Manhattan distance transformation and pixels update for  1 ,  2 , and  3 for the second time.(f) The Manhattan distance transformation and pixels update for  1 ,  2 , and  3 for the third time.spatial coordinates and references can be obtained.Overlaying  1 ,  2 , . . .,  ℎ with  1 ,  2 , . . .,  ℎ , we can construct a final hierarchical layout suitable for GIS environment.

Examples
Four Treemap layouts shown in Figure 4, respectively, use the data set with 200, 130, 100, and 130 generators that are randomly generated without spatial references at 4 hierarchy levels.We implemented the SVT algorithm in C# and used ArcGIS Engine (a complete library of embeddable GIS components) to read shapefile and execute conversions between vector and raster data.The hardware of our experiments is an Intel Pentium Dual-Core E5800 3.2 GHz and 4 G RAM, running under Microsoft Windows 7. In this experiment, the program is running in single thread mode using one core of the CPU.The computations of four layouts shown in Figure 4 require 1.80 min, 1.88 min, 1.99 min, and 2.13 min, respectively.For many GIS applications, the speed is acceptable.
To better visualize the spatial hierarchies in the real world, we use the SVT to express the spatial pattern of the population landscape as shown in Figure 5, which is motivated by the research of Mu and Wang [25].The point generators are abstracted as the locations of cities that are municipal level and above in China (342 cities in all, not including Zhoushan, Hong Kong, Macau, the Hainan Province, and Taiwan Province of China).The boundary is the inland border of China.They are, respectively, obtained from a point file and a polygon file in shapefile format at a scale of 1 : 100,000, that is, the Lambert projection-based maps.
According to [25], we only choose population as the weight of each city.The population data were obtained from the Tabulation on the 2010 Population Census of the People's Republic of China by Township.In China, cities can be divided into five categories based on the urban concentration of the population.They are "Mega" city, "Macro" city, "Large" city, "Middle" city, and "Micro" city.Their population sizes are "10,000,000 and above," "5,000,000-10,000,000," "1,000,000-5,000,000," "500,000-1,000,000," and "1-500,000," respectively.As the proportion of "Middle" and "Micro" city is small ("Mega": 13, "Macro": 76, "Large": 213, "Middle": 19, and "Micro": 21), we combined them with the 213 "Large" cities.Thus, an urban population hierarchy can be defined as in Table 1.
Using the SVT subdivision algorithm, we can get a spatial Voronoi Treemap that represents the population landscape pattern of urban hierarchy (Figure 5).In Algorithm 1, the generators  = { 1 ,  2 , . . .,   } denote the cities in China and  = 342.For each   ∈ , the unique identifier (  ) is set to , the level (  ) corresponds to the value in field "Level" in Table 1, and the weight (  ) is equal to the population of the city. 0 is the inland border of China.

Discussions and Conclusions
This paper presents an approach for the generation of SVTs.Contrary to the existent Voronoi Treemaps that are used to visualize hierarchical nonspatial objects, our proposed layout  algorithm allows to create Voronoi Treemap visualizations for geographical objects with spatial coordinates and references, which can serve as a spatial data model to express urban hierarchies, organization structures, region differences, and so forth.
The SVT approach accepts point, line, and polygon files in shapefile format, classifies generators into different groups according to their level values in their attribute tables, uses a vector to raster conversion to create an initial raster layer, and then generates raster images using distance transformation.Through a raster to vector conversion, layers of ordinary or weighted Voronoi diagrams in shapefile format can be generated to construct a Treemap layout, which can be applied in mainstream GIS software.Input generators and output Treemap layers can be stored together in geodatabase and flexibly change their styles.All GIS symbols and layout styles can be used to enhance the visual effect of Treemaps and to support the user in the perception and interpretation of the Treemap visualizations; for example, Figure 4(a) uses star, square, triangle, and circle symbols to depict different levels of point features.
The layout algorithm needs to loop through all generators one by one to generate an SVT, so the process may be relatively slow while facing massive input features.Because the major processing steps are raster-based, it is possible that an input generator does not have an output Voronoi polygon if that generator is very close to others and raster cell

Figure 2 :Definition 3 .
Figure 2: The Euclidean, Manhattan, and Chessboard distance in raster mode.(a) A raster region of   ≤ 3, (b) a raster region of   ≤ 3, and (c) a raster region of   ≤ 3.
Input: a set of pixels   = { 1 , ) and 3(b) describe the variations of pixel properties for a weighted SVT after executing the function PixelsAssignment().

Figure 4 (
a) is an ordinary SVT for points based on the Manhattan metric; Figure 4(b) is an ordinary SVT for lines based on the Chessboard metric; Figure 4(c) is a weighted SVT for polygons based on the Euclidean metric; Figure 4(d) is a weighted SVT for points, lines, and polygons based on the Euclidean metric.Different legend symbols represent different sets of generators.Border thickness expresses the

Figure 5 :
Figure 5: The population landscape pattern of urban hierarchy for China based on the Manhattan metric.

Table 1 :
Urban hierarchy by population in China.