Dr. Stephen Hartley

Spatial Analysis For Ecologists

Help File for SAFE-v01

by Stephen Hartley


Overview

Data File Structure

Commands:            File ... Convert ... Display ... Calc ...

Test Data

Conditions of Use

Known Bugs

Future Developments


(NB. If you are viewing this file online, you may like to save it to disk for future reference)

 Overview

SAFE combines some simple GIS capabilities with more specialised functions of exploratory data analysis that might be useful to ecologists dealing with spatially explicit data. SAFE-v01 is the first version, therefore many of the features are only partially developed in order to illustrate what might be possible. (See Conditions of Use and Future Developments). There are also a number of known bugs. In particular, the program may crash if you enter illogical or out-of-range values into certain input boxes. Please bear with me and let me know what needs fixing, and what else you would like to be included.

Data File Structure

SAFE accepts two basic forms of spatially explicit data: point files and grid files.

 

Point Files

Point Files are a list of points with their x and y co-ordinates.

Each row of the file should consist of three comma-separated values: point-ID, x-coordinate, y-coordinate

E.g.

1,23,45
2,36,78
3,54,21
4,11,63

Data files can be created and read by Excel by "saving as" .csv format. Alternatively they can be typed directly into a text editor such as Notepad, or Word (remembering to "save as" .txt).

If you have trouble reading in a file make sure that the data starts on the first line and that there are no extra commas after the y-coordinates, and no blank lines at the bottom of the file.

Notes

In display, each point is represented by a red square of 1 mapunit by 1 mapunit.

The GB Display option assumes that the map units are kilometres

The text box to the upper left of the main window will display the data that has been read in. Two information boxes above the text box will also display the name of the data file and the number of records read. You should verify that this is correct.

 

Grid Files

Grid Files are used to represent raster data. i.e. the sort of data captured by satellites. The values of each grid cell may represent a spatially continuous variables (such as density or elevation), categorical data (such as land cover types) or binary data ( such presence/absence).

The grid data files contains one row of comma-separated values for each row of the grid, starting with the northern-most row and finishing with the southern-most one. The number of columns is determined by the number of values per row.

E.g. a grid of 5 rows by 6 columns:

5, 0, 3, 2, 1, 0
6, 2, 3, 1, 0, 0
4, 5, 2, 0, 0, 0
3, 2, 1, 1, 0, 1
1, 0, 0, 1, 2, 4

As with point files, grid files can be created and read by Excel by "saving as" .csv format. Alternatively they can be typed directly into a text editor such as Notepad, or Word (remembering to "save as" .txt).

If you have trouble reading in a file make sure that the data starts on the first line and that there are no extra commas after the y-coordinates, and no blank lines at the bottom of the file.

Notes

You should know ahead of loading how many rows and columns are in your data file, and the size of each cell (although a default size of one can be used).

 

Commands:            

Interface Layout

The main interface has a command bar at the top with three fixed windows below.

1. The "Map Window" is the large square window with a blue background to the right. It is used to provide a visual display of the data and/or analysis. At any time one can zoom-in on the map display by highlighting a square sub-section of the window.

2. The "Text Window" is the white window to the upper left. It has vertical and horizontal scroll bars. It displays text information to keep the user informed of what is going on. e.g. it displays the contents of data files that have been imported

3. The "Graph Window" is the white window to the lower left. In later versions it will display graphs relating to the current analysis.

 

File ...

Import Point File

Select a point file to load as the current point file. See Data file Structure - Point Files. The imported file will replace any previously loaded point file, but will not affect the current grid file.

Import Grid File

Select a point file to load as the current point file. See Data file Structure - Grid Files. The imported file will replace any previously loaded grid file, but will not affect the current point file. You will be prompted to enter the number of rows and columns in your data file, as well as the cell size (i.e. resolution) and style of your data. It is up to you to decide on the units being used, but the result of all analyses will be expressed in terms of these map units. In future, different types of data (continuous, categorical and binary) will display differently.

 

Convert...

Convert Point to Grid

As the name suggests, this command will convert a point file into a grid file. You will be prompted to supply a file name and location, the number of rows and columns in the grid, a point of origin and the cell size.

 

Display...

A suite of commands for altering the extent and magnification of the file in view. Shortcuts are provided in combination with the Control key.

 

Clear Screen

Clears the screen.

 

Full Extent

Calculates the minimum extent required to display all of the data and then jumps to this magnification and central location. This is the default when a data file is imported.

 

Select Area

Use the cursor to select a square area on the map window. (Click on one corner of the area using the left mouse button, then drag across to the diagonally opposite corner and release.) The display will zoom-in on this area.

 

GB View

Calculates Sets the map window to display an area from (0,0) mapunits at the lower left corner to (1000,1000) mapunits at the upper right. This encompasses all of Great Britain if the mapunits are kilometres.

 

Zoom In / Zoom Out

Increases or decreases the magnification by a factor of two, located around the current central position.

 

Pan Left / Pan Right / Pan Up / Pan Down

Pan left, right, up or down by three-quarters of a screen. Magnification remains the same.

 

Calc...

Interpoint Distances

Calculates the euclidean distance between every pair of points in a point file. You will be prompted to save the interpoint distance matrix to a text file.

 

Connected Clusters

Firstly, this command will display links between sites that are not further apart (and not closer together) than certain specified distances. Based upon these links there is an option to calculate how many distinct clusters or networks of sites there are. A binary matrix is appended to the text box display, which shows which sites are in the same cluster.

 

Neighbourhood Analysis

There are two sub-options which operate in almost exactly the same way.

Counts in circles

This function centres a circle of radius r around every point and calculates how many other points fall within the circle. The result is then averaged across all points and displayed in a message box. The process is then repeated for a different length radius (different scale). You will be prompted to enter nine different radius values.

Counts in squares

This function centres a square of side length s around every point and calculates how many other points fall within the square. The result is then averaged across all points and displayed in a message box. The process is then repeated for a different side length (different scale). You will be prompted to enter nine different values for (s / 2), i.e. the equivalent of a radius.

Notes

Both of the above commands give you the option of saving the results to a .csv file that can be read by excel. The output file has one row for each point, with column headers indicating the Id, easting, northing, numer of points within distance1, distance2 etc. If you select the "continuous" option you will not see any graphical output and will not be prompted to continue for each scale, but the results can still be written to file.

 

Fractal analysis

These commands are still under development.

 

Test Data

The file testdata.csv contains 60 points with x-coordinate values ranging from 265 to 415 and y-coordinate values ranging from 195 to 316 map units. (It can be thought of as a hypothetical species distribution, concentrated in the south-east of Britain, using map units of kilometres referenced according to the GB National Grid).

Conditions of Use

This software may be distributed freely for non-commercial academic use only. Whilst every effort has been made to create an acceptable working version, no responsibility is accepted for consequential loss or damage of hardware or data caused by use of this software.

 

Known Bugs

The program will usually crash if you enter letters where numbers are required, or if you fail to enter a number or file name when required.

Please e-mail me details of additional bugs not reported here.

 

Future Developments

Calculate the mass fractal dimension of points and grids.

Patch-occupancy analyses

Correlation between two grids, with appropriate adjustment for spatial autocorrelation

Enable SAFE to read D-Map files. I.e. Convert National Grid alphanumeric coordinates to numeric only coordinates (e.g. SE 224 679 = 422.4, 467.9 km)

Please e-mail me with further suggestions


Top of Page

Stephen's Home Page