Weighted Voronoi Diagram Extension for ArcGIS

Weighted Voronoi Diagram Extension for ArcGIS 9.x
User's Guide
(Version 1 created on 3/3/2008; Updated troubleshooting on 10/23/2012)
Pinliang Dong, Ph.D.
Associate Professor
Department of Geography
University of North Texas
1155 Union Circle, #305279
Denton, TX 76203, USA
E-mail: [email protected]
http://www.geog.unt.edu/~pdong
Table of Contents
1.
2.
3.
4.
5.
6.
7.
8.
9.
Disclaimer
Introduction
Installing Weighted Voronoi Diagram Extension for ArcGIS
Generating ordinary Voronoi diagrams
Generating weighted Voronoi diagrams using a weight field
Generating weighted Voronoi diagrams using any numeric field
Updating Vonoroi diagrams
Troubleshooting
Recommended citation
1.
Disclaimer
The Weighted Voronoi Diagram Extension may be freely used and redistributed. It is provided
"as is", without warranty of any kind, expressed or implied, by statute or otherwise. The author
does not warrant that the operation of the extension shall be uninterrupted or error free. User
bears all risk as to the quality and performance of the extension. Technical support is not
available. The author appreciates any feedback regarding bug reports or suggestions for future
improvement.
2.
Introduction
A Voronoi diagram is an interdisciplinary concept that has been applied to many fields for space
partitioning and spatial modeling. In geographic information systems (GIS), existing capabilities
for generating Voronoi diagrams normally focus on ordinary (not weighted) point (not linear or
area) features. For better integration of Voronoi diagram models and GIS, a raster-based
approach is developed, and implemented seamlessly as an ArcGIS extension using ArcObjects.
The extension has the following features: (1) it works for point, line, and polygon vector
features; (2) it can generate both ordinary and multiplicatively weighted Voronoi diagrams in
vector format; (3) it can assign non-spatial attributes of input features to Voronoi cells through
spatial joining; and (4) it can produce an ordinary or a weighted Euclidean distance raster dataset
1 of 14
for spatial modeling applications. The results can be conveniently combined with other GIS
datasets to support both vector-based spatial analysis and raster-based spatial modeling.
The Weighted Voronoi Diagram Extension for ArcGIS is developed using Microsoft Visual
Basic 6.0 and ESRI's ArcObjects 9.x. The Graphical User Interface (GUI) has two tabs: Generate
and Update. Using the Generate tab, the user can generate ordinary or weighted Voronoi
diagrams from point features. A raster showing normal Euclidean distance or adjusted Euclidean
distance (if weights are used) is generated, as well as a Voronoi polygon shapefile. Point
attributes can be transferred to Voronoi polygons automatically through spatial joining. Once a
distance raster is generated, the user can use new points to update the distance raster and create
updated Voronoi polygons. The output Voronoi diagram (shapefiles) and distance raster datasets
can be used in spatial analysis and modeling for various applications. The following sections
illustrate how to generate and update ordinary or weighted Voronoi diagrams for point features.
The same procedure can be used for line and polygon features.
3.
Installing Weighted Voronoi Diagram Extension for ArcGIS
The extension can be downloaded from http://www.geog.unt.edu/~pdong/software.htm. To
install the extension, unzip file WeightedVoronoi.zip, then run setup.exe to start installation. The
zip file also includes two sample point shapefiles and an ArcMap project file "Project1.mxd" in
the "SampleData" folder. The extension can be activated once the install completes. To activate
the extension, follow these steps: (1) Start ArcMap; (2) Click Tool -> Extensions; (3) Check the
Weighted Voronoi Diagram; (4) Click Close; (5) Click View -> Toolbars, then select the
Weighted Voronoi Diagram toolbar. The Weighted Voronoi Diagram toolbar has two buttons:
Click the first button to start the program, and the second button to open this document with your
default web browser. You need ESRI’s Spatial Analyst Extension license before you can use
this extension.
4.
Generating ordinary Voronoi diagrams
(1) The sample project "Project1.mxd" has two point layers (shapefiles "Original Points" and
"New Points" (Figure 1). The attribute tables of the two layers are shown in Figure 2 and
Figure 3 respectively.
2 of 14
Figure 1. Two point feature layers.
Figure 2. Attributes of original points
Figure 3. Attributes of new points.
(2) Click the "Start Voronoi" button (see Figure 1) to open the Weighted Voronoi Diagram
3 of 14
form. The form has two tabs: Generate and Update. For generating Voronoi polygons,
use the "Generate" tab (Figure 4). The "Update" tab will be described in the section
"Updating Voronoi diagrams" (see Table of Contents). Provide input point feature layer,
output adjusted distance raster, and output shapefile for the weighted Voronoi diagram.
For generating ordinary Voronoi diagrams, uncheck the "Use Weight Field" checkbox.
Check "Join Points and Voronoi Polygons Spatially", so that the attributes of the points
can be added to the corresponding Voronoi polygons through spatial joining. Check
"Add To ArcMap" so that the output can be added to ArcMap automatically.
Figure 4. Weighted Voronoi diagram form.
(3) Clicking "Help" will open the help document with your default web browser (Note: you
are reading an updated help document that was not included in the original installation
program. See the “Troubleshooting” section of this document for new updates). Click
"OK" to generate the ordinary Voronoi diagram. The status bar at the lower-left corner of
ArcMap will show the progress of the program. The distance raster is shown in Figure 5.
The ordinary Voronoi diagram and attribute table are shown in Figure 6 and Figure 7,
respectively. It can be seen that the sides of the ordinary Voronoi polygons are straight
line segments.
4 of 14
Figure 5. Distance raster for original points.
Figure 6. Ordinary Voronoi diagram (shapefile).
5 of 14
Figure 7. Attribute table of the ordinary Voronoi shapefile.
5.
Generating weighted Voronoi diagrams using a weight field
(1) In Figure 8, a weight field named "weight" is added to the attribute table of the original
points. The values in the weight field can be based on certain criteria in your application,
or calculated from other field(s).
Figure 8. A weight field in the attribute table.
(2) Open the Weight Voronoi Diagram form, check "Use Weight Field" and select a field
"Weight" from the combo box. Specify output distance raster and Voronoi shapefile, then
click OK to run the program (Figure 9). The adjusted distance raster is shown in Figure
10, and the weighted Voronoi shapefile is shown in Figure 11.
6 of 14
Figure 9. Weighted Voronoi
Diagram form.
Figure 10. Adjusted distance raster.
Figure 11. Weighted Voronoi diagram (shapefile).
6.
Generating weighted Voronoi diagrams using any numeric field
(1) In addition to a specific weight field, any meaningful numeric field can be used as a
weight field for generating weighted Voronoi diagrams in your application. During
calculation, the field values will be scaled to (0, 1] range by dividing the field value by
7 of 14
the maximum field value. Since a weight value should be greater than 0, a field value of 0
will be changed to 0.001 during calculation.
(2) In Figure 12, the field "MEDIANRENT" is used as the weight field. The adjusted
distance raster and weighted Voronoi diagram are shown in Figure 13 and Figure 14
respectively. The labels in Figure 14 show the median rent of each city.
Figure 12. Weighted Voronoi diagram form.
Figure 13. Adjusted distance raster.
8 of 14
Figure 14. Weighted Voronoi diagram (shapefile) generated using "MEDIANRENT" as weight
field. The labels show the median rent of each city.
7.
Updating Voronoi diagrams
(1) Sometimes new data points are collected and the existing Voronoi diagrams need to be
updated. Because a distance raster needs to be calculated for each point, it would be timeconsuming if all data points (both existing and new) are processed every time an update
is needed, especially if there is a large number of existing data points. For example, if
you have generated a Voronoi diagram for 200 points, and you want to update the
Voronoi diagram using 3 new points in the study area. Ideally, you would like to process
only the 3 new points instead of 203 points. The Update tab provides an efficient way to
update Voronoi diagrams using new data points within the extent of the existing data
points.
(2) It should be noted that the Update tab can only update points within the extent of existing
data points. Any point outside the existing extent will be ignored. If the extent of the new
points is not completely contained by the existing extent, it is recommended to append
the existing points with the new points first, then use the Generate tab to generate
Voronoi diagrams.
(3) Figure 15 shows the attribute table of 3 new points, with weights in the weight field.
Figure 16 shows the 3 new points (triangles) along with 9 original points (dots). The
labels show the weight for each point. Now we would like to update the original Voronoi
diagram (Figure 11) with the 3 new points.
9 of 14
Figure 15. Attribute table (part) of 3 new points.
Figure 16. Map display of original points (dots) and new points (triangles). The labels show the
point weights.
(4) Select Update tab in the Weighted Voronoi Diagram form (Figure 17). Select the new
points as the input point feature layer, and select "Weight" as weight field. The next step
is to select the existing distance raster and point shapefile. Finally, specify output
distance raster and new Voronoi shapefile. Click OK to run the program.
10 of 14
Figure 17. User interface for updating Voronoi diagram.
(5) Figure 18 and Figure 19 show the updated distance raster and updated Voronoi diagram
respectively. Figure 20 is the attribute table of the updated points. Figure 21 shows the
attribute table of the updated Voronoi polygons after spatial joining. The updated
distance raster, the updated Voronoi diagram, and the attribute tables are created
automatically after clicking OK.
Figure 18. Updated distance raster
11 of 14
Figure 19. Updated Voronoi diagram
Figure 20. Attribute table of updated points
Figure 21. Attribute table of updated Voronoi polygons after spatial joining
12 of 14
The above examples are based on points. Ordinary and multiplicatively weighted Voronoi
diagrams for line segments and polygons are shown below.
(A)
(B)
Figure 22. (A) Ordinary Voronoi diagram for line segments; (B) Multiplicatively weighted
Voronoi diagrams for line segments (using segment length as weight).
Figure 23. (A) Ordinary Voronoi diagram for polygons; (B) Multiplicatively weighted Voronoi
diagrams for polygons (using polygon area as weight).
8.
Troubleshooting

Although the extension has been tested many times, it is possible that some bugs still
exist. A temporary shapefile named "temp<your output shapefile name>.shp" and several
temporary grids are created in the output folder. These temporary files are deleted
automatically after the output files are created successfully. Even if the output files are
not created because of error messages, the temporary files will be deleted when you run
the program the next time. If ArcMap crashes when the extension is in use, the temporary
files in the output folder may not be deleted completely, and the user may need to
manually delete these temporary files. Also, some users may not be able to use raster data
in ArcMap and will get an error message: "Invalid raster dataset. Failed to create raster
layer." Please check out ESRI's website for that error message.
13 of 14

Sometimes a single Voronoi polygon is created for several points that are very close to
one another. To ensure that the input points have separate Voronoi polygons, a larger cell
size factor (which means a smaller cell size) can be specified on the interface. In the next
version of this extension, this parameter will be replaced with cell size which is more
convenient for users.

This Extension only works for ArcGIS 9.x, not ArcGIS 10.x.

Some users may get a Run-time error ‘406’ when using the Extension – “Non-modal
forms cannot be displayed in this host application from an ActiveX DLL, ActiveX
Control, or Property Page.” In that case, please try the following steps:
(1)
(2)
(3)
(4)
9.
Find your ArcGIS 9.x installation DVD (suppose it’s called H:\);
Run H:\SDK_VBA\Setup.exe to reinstall VBA;
Run H:\Desktop\VBA\VBAOF11.msi;
Run H:\Desktop\VBA\1033\VBAOF11l.msi.
Recommended citation
Dong, P., 2008. Generating and updating multiplicatively weighted Voronoi diagrams for point,
line and polygon features in GIS. Computers & Geosciences, Vol. 34, pp. 411-421.
14 of 14