An Introduction to Geographical Information Systems
Running ArcView Scripts
This is a relatively short exercise designed to who you how to run ArcView Scripts on the
central network system. It uses a quick script for finding the centre point of a polygon
theme, which surprisingly is not possible using the menus in ArcView!
Running these scripts on the UoA network system is a little different to running them on
a standalone PC because of the general lack of access to read/write permissions.
STEP 1: Locating the Centroid Script and unzipping it to a folder
ArcView Scripts may be found at:
In the Search window/dialogue box enter: Polygon Centroids
When the search returns with the page of example scripts, find the one called:
Polygon Centroid to Point Event Theme
This one works quite well, but remember not all do work!
Download the script (in a ZIP file) to either the S: drive space or to the H:drive (your
Unzip the file using WinZip or PKZip software (this should be found in the Common
Applications/Utilities folder on the desktop). Unzip to the default folder name: as11413
Take note of the name of the folder (as11413) where the ArcView script resides, just
so you can find it later on!
STEP 2: Copying a polygon file to the S: or H: drive
Using the Windows File Manager (MyComputer) Locate the folder:
Copy the following files to the S: drive space or your own H: drive homespace:
STEP 3: Running ArcView, Loading the Province map and the Centroid Script
Start ArcView 3.3 as normal
Open the province.shp file as normal (View, Add Theme)
Tick the Legend box to view the file
Minimise (but do not close) the View (probably View1 window)
In the window that lies immediately behind you will see a list of icons (View at
the top, Tables, Layout, and Scripts)
Click in Scripts, and click on New
A blank Scripts window opens. It is this window that you will now load the script into.
Usually Scripts that come with ArcView and reside in the scripts folder can be accessed
Scripts, New Script, Load System Script
In this case the script you will use does not reside in this folder. Instead select:
Scripts, New Script, Load Text File
Navigate to the drive and the as11413 folder and select the polycent.ave script
You will now see the script (.ave indicates it is written in the ESRI Avenue programming
language) in the window.
STEP 4: Running the PolyCent Script
Go back to the View Icon and open your View1 window again. Make sure View is
visible and province.shp in the legend is selected.
Return to the Script window with your Centroid script
The next stage is to compile the script: Scripts, Compile
Nothing really happens at this stage so just assume it has compiled – unless you
get an incomprehensible message!
The next stage is to run the script: Scripts, Run
You should then be prompted with a message telling you that a Point theme will
be added to the View
A new theme will be added to the View comprising Points (which are the
centroids for each Polygon in the province.shp Theme.
Take a look at the Table. You will notice that two extra columns or fields have
been added automatically, comprising X and Y co-ordinates defining the co-
ordinates for the centroid of each irregular polygon (which is why visually they
do not at first appear to be centrally located!)
If you wished to retain the new Polygon file (as I will not automatically have
been saved for you, you could select Theme, Save as Shapefile) – but this is not
Print out and submit the Table.