AZTool


1. Introduction

This software is provided as-is; use at your own risk! Neither the authors nor their employers can be held responsible for any damages resulting from its use.

AZTool is an automated zone design tool. It takes an input set of geographical "building blocks" and iteratively aggregates them into a number of larger zones optimised to meet user-specified constraints. The software is written in VB.NET using the .NET framework version 2. No GIS software is required to run AZTool, however data preparation and visualisation of the results may require such software.

These notes assume a basic familiarity with zone design problems and GIS operation.


2. History

The zone design approach implemented in AZTool is based on the automated zoning procedure (AZP), first developed by Openshaw (1977a; 1997b) and then enhanced by Openshaw and Rao (1995). AZP was further developed into the AZM software by Martin (2003), which is available here. The algorithm was subsequently used by the Office for National Statistics (ONS) to create the 2001 Census output geographies for England and Wales (Martin et al, 2001). The functionality of AZM was further developed by Cockings and Martin (2005) and has subsequently been used by a wide range of researchers for different applications in various countries. The current version of AZTool was developed by the ESRC-funded Census2011Geog project, in collaboration with ONS.


3. Download / Install

(a) AZTool

Download AZTool Current version 1.0.3 25/8/11

Change history

The zip file contains the latest AZTool executable, along with a sample dataset (shapefile), parameter file (.xml), command script (.bat) and description of the tool and parameters in a Word doc. Start with the Readme.txt file!

Note that full paths need to be specified in the AZTool parameter (.xml) file. The sample .xml file is set up to run from the c:\AZT_Demo directory. If you are installing or running AZTool from any other location you will need to specify the full pathnames in the .xml file.

Note that this version of AZTool does not have a full GUI front-end. The options for the program are driven by the .xml parameter file: this makes it more flexible and allows it to be used in batch mode (using the .bat file) for large jobs.

(b) AZTImporter

Download AZTImporter Current version 1.0.1 20/10/10

Change history

Data are provided to AZTool in a bespoke format which is based on ArcInfo coverage polygon and arc attribute tables (.pat and .aat). Input files may be comma or tab delimited, but not fixed format. A Shapefile to .pat/.aat convertor (AZTImporter) has been written that does not require an ESRI licence. This tool takes an ESRI Shapefile containing polygon data, and generates .aat and .pat files in the format required by AZTool. Again, start with the Readme file!

The outputs are comma delimited, and headers are included in the .pat attribute file. An AZM_ID attribute is added that is the FID of each feature: this corresponds to the ID used in the .aat contiguity file. The AZM_Area attribute is also added, containing the area of each polygon.

A row for an External Polygon is generated, but is assigned an ID one greater than the last FID value of the data rather than 0 as would be the case if genuine ArcInfo coverage attribute tables were used. The area value for the External Polygon is set to -1 to flag it as such.


4. A typical AZTool run

AZTool and its associated AZTImporter are flexible and can be run in various combinations to address different problems. For the guidance of novice users, the steps involved in a typical run are described below:

(a) Read the academic papers on automated zone design to be sure that you understand the basic principles: see references below.

(b) Create a shapefile of your building blocks. This should contain the zones that you want to use as building blocks in the zone design process and the attributes to be used as constraints. Examples might include population (e.g. to be used as a target and/or minimum threshold), region (e.g. a higher-level geography code within which you wish zones to be constrained), homogeneity variables (such as tenure or accomodation type, for designing zones which are as internally homogenous as possible with respect to these variables).

(c) Use the AZTImporter to convert your shapefile into the.pat and .aat files required by AZTool. Check the output and ensure that it makes sense! Make a note of the columns and their positions: you will need to define these in the .xml parameter file. Also check that the number of records matches the number of zones you expected. Note that if you have any islands (zones with no neighbours except the external polygon), you can alter the contiguity matrix (.aat file) at this stage to artifically enable them to become neighbours of mainland zones. If you do this, you should set the shared boundary length for any of these zones to -1 so that their perimeter length is ignored in subsequent calculations.

(d) Set up the .xml parameter file. Specify the location of your input (.pat and .aat files) and specify and define the various parameters, constraints and column positions of the variables to be used in the run. For further details on the AZTool algorithm and the various parameters and metrics that can be employed, see the AZTool_M_Overview.doc document contained within the AZTool.zip file which you downloaded to install the software.

(e) Run the AZTool_M.exe. In the simple GUI, specify the locations of the .xml parameter file and the directory to which you want outputs to be written.

(f) A log file (.log) is written to the output directory that you specified. Inspect this to see whether all zones were resolved, whether there were any problems and which iteration produced the optimal combination of tracts.

(g) The results of the run are written to a tract composition file (.csv). This contains the ID of each input building block and the tract to which it has been assigned. If you want to visualise the results of this aggregation or to carry out further analysis using the newly created tracts, you will need to import this tract composition file into another program e.g. a GIS, and DISSOLVE the building block boundaries based on the TRACT_ID. You may also wish to produce summary statistics (grouping or totalling by TRACT_ID) for the new tracts.

Note that if you want to run AZTool in batch mode (which is very useful for multiple runs) you will need to set up the .bat batch file. Specify the full path locations of the AZTool_M.exe, the .xml parameter file, the .aat input file and the file to which you want the output tract composition to be written. You can then run AZTool using this batch file instead of the AZTool_M.exe.


5. References and acknowledgements

Publications using AZTool should contain the following references:

Cockings S, Harfoot D, Martin D, Hornby D, 2011. Maintaining existing zoning systems using automated zone design techniques: methods for creating the 2011 Census output geographies for England and Wales, Environment and Planning A, 43(10), 2399-2418. doi:10.1068/a43601

Martin D (2003) Extending the automated zoning procedure to reconcile incompatible zoning systems, International Journal of Geographical Information Science 17 181-196

Authors using AZTool in their work may wish to include the following:

"The authors gratefully acknowledge the use of the AZTool software, which is copyright David Martin, Samantha Cockings and University of Southampton."

Other useful references include:

Cockings S, Martin D (2005) Zone design for environment and health studies using pre-aggregated data, Social Science & Medicine 60 2729 - 2742

Martin, D (1998) 2001 Census output areas: from concept to prototype, Population Trends 94 19-24

Martin D, Nolan A, Tranmer M (2001) The application of zone design methodology to the 2001 UK Census, Environment and Planning A 33 1949 - 1962

Openshaw S (1977a) A geographical solution to scale and aggregation problems in region-building, partitioning and spatial modeling, Transactions of the Institute of British Geographers, New Series 2 459 - 472

Openshaw S (1977b) Algorithm 3: a procedure to generate pseudo-random aggregations of N zones into M zones, where M is less than N, Environment and Planning A 9 1423 - 1428

Openshaw S, Rao L (1995) Algorithms for re-engineering 1991 Census geography, Environment and Planning A 27 425 - 446


6. Support / Contact

No formal support is provided for AZTool.

Informal requests for help may be addressed to: Prof David Martin or Samantha Cockings on the following email: aztool at soton.ac.uk

A list of problems encountered by users is provided below:

  1. I get the below error when I run the tool.
    Reading PAT File
        Error in AZM run:
    Index was outside the bounds of the array.

    A:The XML parameter file has entries for the two homogeneity (IAC) variables from the demo data still. Removing these lines, or setting the IACStartIndex value to 0 should fix the index error - the tool will try to read data described in the config file even if the variable is disabled

    Looking at your data files, The AAT file looks as though it is fixed width format, which the tool will get confused with as it expects delimited data. The PAT file is also fixed width, and doesn't have an entry for polygon ID 0 - if the data has been exported from an Arc coverage, poly 0 is normally the universe polygon and will have a negative area, the tool still expects a row for it in the PAT file.

  2. I converted my shapefile using the importer and then tried to run the zoning tool and it gave me an error along the lines of "cannot convert AZM_ID to integer". I figured out that the header row in the file was causing the problem so I removed it and ran it again and got an error about a value being outside of an array. This is where I got stuck!

    Interestingly, when I ran the demo data you had provided (the .pat and .aat files) it worked fine. However if I went back to your source shapefile and used the importer to convert that I ran into the same problems as I had with my data. So I guess there is a problem with the way the data is coming out of the importer.

    I compared the .pat and .aat files you had created with the ones coming out of the importer and noticed the following differences:

    A:It sounds as though your parameter file is not matching the PAT structure. Headers are optional - but there is a header tag in the parameter file that should be set to true or false accordingly.

    The value outside array sounds like one of the variable definitions in the parameter file pointing to a column that doesn't exist in the data. A possible culprit is the IAC data - if you don't have any in your dataset then you need to set the IACStartIndex value to zero, or delete any IAC variable group definitions as the tool will attempt to read IAC data even if the use of IAC in the zone design is disabled.

    The parameter file is key! It pays to go through each line and make sure it is correct for your data. In the case of PAT files created by the importer, there will always be headers, the FID column will be first, and an area column last.

  3. We are experiencing a problem understanding the IAC result reported in the stats output file. We have 1 homogeneity var - a categorical variable, which is in fact a deprivation classification (1-5). All our runs give us a result of NaN, which we don't know how to interpret, and more importantly, we're obviouly trying to maximise the IAC.

    A:The problem you're encountering is because the tool expects IAC data to be supplied as counts in reach category - you need to expand your single categorical IAC attribute 'DepClass' into five attributes, one for each category in the deprivation classification, and then populate these with a count.

    Some example lines of the PAT file would be:

    IDPopulationAreaDepClassDepr1Depr2Depr3Depr4Depr5
    2362500110000
    3462500400010
    418462500110000
    530362500201000
    611062500110000

    The relevant lines of the XML parameters file should be:

      <IACStartIndex>5</IACStartIndex>
      <IACSet>true</IACSet>
      <IACWeight>100</IACWeight>
      <IACvarGroups>
        <IACvarGroup>
          <Name>DepClass</Name>
          <Weight>100</Weight>
          <CategoryCount>5</CategoryCount>
        </IACvarGroup>
      </IACvarGroups>