1.12.11

Some GIS analysis

Ok, so I'm fed up of doing something in GIS, forgetting to write it down and then having to repeat the process due to an update of GIS data, or a change in my model needs etc that I am now trying to make a note of the main GIS analysis to get the data into some format that I can then use in my models, so here goes.

Data I need at the moment:
Habitat Map in raster format, cells of size 100m x 100m
Roads and trails, in raster format, cells of size 100x100
Cockscomb, raster - a simple map of where the protected forest is
CameraTraps - a shape file of the location of all 47 camera traps (in suitable projection to match the raster data
Sample area - a raster dataset of a buffer around the camera traps that represents the sampling area of the traps
Rivers, in raster formation, cells of size 100x100
Model Area, a shape file created to represent the area to be used in the model

Each of these datasets also needs to be of the same area (an annoying problem in some cases)

So, all data was provided in shape file format which meant it all had to be converted or processed and then converted to raster.

All information is relevant to ArcGIS version 9.3. (ArcMap unless otherwise stated).

HabitatMap
1. A simple conversion from 'feature to raster', using Ecosystem field as the field of interest and stating a cell size of 100.
[Conversion Tools - To Raster - Feature To Raster]

2. This raster then covered the entire area of Belize, so it needed to be clipped to meet the model area of interest. (I'll discuss how to create a shape file of the required area next), but otherwise use the 'clip' command. Some commands from the various toolboxes only work on specific types of dataset, such as the clip command within the Analysis Tools toolbox only works with feature/shapefile data and NOT with rasters. For Rasters, use the following, putting the shape file to use as the 'clipping' feature in the 'output extent' box and selecting the 'use input features for clipping geometry box', otherwise you can designate your own coordinates to create a rectangle to use to clip...

 [Data Management Tools - Raster - Raster Processing - Clip]

3. Now we should have a raster of cell size 100x100, but only having data for the required region/area of Belize. This now needs to be converted to an ASCII file for me to use and import into RePast.

[Conversion Tools - From Raster - Raster to ASCII]


Model Area
For this we need to create a new shape file and then amend it to create a new polygon for the area we want to use as our model area.

1. Open Arc Catalog, locate the folder you want the file to be created in.

2. Right click in the main box (showing contents of the folder you are looking at), go to New, and shape file. Then give it an appropriate name.

3. Ok, now go back into ArcMap and add the new shape file to the display.

4. Now you need to edit the shape file
[View (from the top bar) - Toolbars - Editor - Editor - Start Editing]

5. At this point, you may need to select the fold or database which you would like to edit. Select the folder which houses the newly created and added shape file, click OK.

6. Make sure the correct shape file is displayed in the Target box on the Editor Toolbar

7. Now you need to create a polygon of the area you want to be the model area
[Editor -More Editing Tools - Advanced Editing]

8. A new toolbox should have popped up called Advanced Editing. Select the rectangle icon (last but one on the right) and now you should be able to draw a rectangle within the correct shape file layer. You can have other layers open so you can see where to draw the rectangle. If the rectangle is selected it can also be deleted so it doesn't matter if it isn't correct first time. Once you have the area you are happy with, go back to the editor toolbar
[Editor - Save Edits- Stop Editing]

9. There should now be a shape file with a single polygon representing the outline of the model area you want to use. This shape file can now be used to 'clip' any dataset required (as in step 2 above).


Cockscomb
1. Ok, so I was given a dataset with all the protected areas outlined on it, as well as a single dataset with the outline of Cockscomb Basin Wildlife Sanctuary. This simply needed to be clipped to the model area (my model area only covers a portion of the sanctuary) and then converted to a raster and then ask ASCII.
So first, clip the polygon of Cockscomb, and use the newly created ModelArea file (above) as the 'clip features'
[Analysis Tools - Extract - Clip]

2. Now convert it to raster (you could also convert it to a raster first and then use the raster clip function (outlined above) to clip the raster).
[Conversion Tools - To Raster - Feature To Raster]

3. Now convert the raster to an ASCII file
[Conversion Tools - From Raster - Raster To ASCII]


Roads/Trails and Rivers
1. These are both done in the same manner so can be dealt with together. They came in polyline format (shape file) so they need processing and then converting to a raster. Firstly, they needed transforming form they current WGS-1984 projection to the required NAD1927-16N projection (all GPS and camera data information is in the latter format). This is relatively simple. If you have other data open when you add the roads/rivers data it will tell you it is in a different coordinate system and you can change it from that pop-up box, otherwise do the following:
[View (top bar) - Data Frame Properties - Coordinate System]

2. You should now see what coordinate system your current data is in, if it needs to be change:
[Transformations - Select the correct coordinate system in the 'Convert from' box and make sure the correct new coordinate system is in the 'Into' box, now select a transformation technique from the 'Using' box, (they should all do the same job), then press OK - Apply - OK] 
Data should now match.

3. Now the data is in the correct coordinate system, it needs to be processed. I had several different files that needed merging together to create a single file of the entire road/river network. This can be done several ways, but the easiest (and most effective) way I found was via the editor toolbox. I also needed to create some additional trails from point data supplied.

4. Creating new trails, need to create a new shape file layer in Arc Catalog (as above for the Model Area). Add the new empty layer into ArcMap. Display the data of points that represents the information you need. 
[View - Toolbars - Edtor - Editor - Start Editing]

5. Now all you need to do is draw over the points to create a line. The trick is to make lots of joins to make sure the line follows the points. Selecting the pencil icon on the editor toolbar allows you to draw onto the empty shape file layer. A single click make a join and a double click ends the current line. You can connect separate lines together at the end, so I zoomed in and make several lines that I then joined up at the end to create the entire trail network. Once all the lines have been drawn, you can then merge them.

 [Click on the arrow head on the editor toolbar - draw a large square around your newly created lines to select them all - Editor - Merge]

6. Now all the lines should be joined up but still selected. Selection(from top bar) - Clear Selected Features, will clear a selection at any time. Now you need to join the newly created trails with the several existing datasets. A similar process can work successfully, or you can do it via the Data Management Tools 
[Data Management Tools - General - Merge]

7. Now you should have one layer with all the relevant roads or rivers in. Now this needs to be clipped using the Model Area shape file.
[Analysis Tools - Extract - Clip]

8. Again now convert it to a raster and then to an ASCII file.

9. Some problem I encountered - the original roads data was given to me, not of the whole of Belize, but of a small area within the area I was using as my model area. Therefore the dataset was SMALLER than the model area I needed. Problem!

10. Much investigation didn't come up with a good process for extending the display of the dataset (it only needed additional NoData information to make up the entire area). You can extend the display of the layers 
[right-click on the layer - Properties - Extent - choose any layer in the 'set the extent to' drop down box]

11. Whilst this seemed to work when I converted the layer to a raster it lost this additional extent. So do this instead, you need to convert the ModelArea shape file to a raster and then add the two raster layers together:
[ModelArea = Conversion Tools - To Raster - Feature to Raster]
[View(top tool bar) - Toolbars - Spatial Analyst - Options - Extent - Union of Inputs] then
[Spatial Analyst - Raster Calculator - select the new raster of the modelArea then select the + and then select the roads raster file]

12. This should create a raster layer of the roads that same size as the modelArea. The raster layer of the ModelArea needs to have a non-negative, non-zero value (mine went to 1 automatically) so that this value is added to the value of the roads (I have 6 classes of roads all with a value from 1 to 6 representing the class). The values of my new raster went from 2 to 7 so I used the reclass function to put them back to 1 - 6, with the NoData values sticking at -9999. I had some problems converting these values to anything else in the reclass function so I left them at the default value.

[Spatial Analyst Tools - Reclass - Reclassify - choose the new roads raster and enter in the new values in the NewValues column in the box in the centre]

Camera Traps
1. These were fairly straightforward. I had the data as x and y coordinates in an excel spreadsheet. So add the spreadsheet to the ArcMap display:

[right click on the spreadsheet - Display XY Data - and choose the correct columns that represent the x and y data - choose the correct coordinate system, via - Edit - Select - Projected Coordinate Systems - UTM - NAD 1927 - NAD 1927 UTM Zone 16N.prj - Add]

2. You might then need to make the layer permanent, to do this you need to export it as a shape file:

[right-click on the new 'events' - Data - Export Data - then choose All Features in the 'Export' box and the folder you want in the 'Output shape file or feature class' box and give it a name you want - OK]

Sample Area
1. So this is the effective sampling area of my dataset - basically just a circle around each camera Trap of a specified radius - calculated from the average home range of a jaguar - 1784m in this case (half of the full estimated diameter of 3568m - taken from thesis if Rebecca Foster (currently working for Panthera in Belize and collaborating on this work)). So to do this you use the buffer function: 

[Analysis Tools - Proximity - Buffer - new cameraTrap file as the 'Input Features', choose an appropriate name and location for the output file, put the radius in the 'Linear Unit' box and make sure the next box is in the correct units]

2. This now needs to be converted to a raster and made the same size as the modelArea, then converted to an ASCII.

All these files need to be converted to .pgm files (apart from the cameraTraps) for importing into RePast. I'll cover this in a later post.


Book

An interesting new book but Alison Heppenstall, Andrew Crooks, Linda See and Mike Batty
"Agent-Based Model of Geographical Systems"





as stated on Andrew Crooks' blog 'GIS and agent-based modelling':

[the book] brings together a comprehensive set of papers on the background, theory, technical issues and applications of agent-based modelling (ABM) within geographical systems. This collection of papers (see below) is an invaluable reference point for the experienced agent-based modeller as well those new to the area. Specific geographical issues such as handling scale and space are dealt with as well as practical advice from leading experts about designing and creating ABMs, handling complexity, visualising and validating model outputs. With contributions from many of the world’s leading research institutions (see map below), the latest applied research (micro and macro applications) from around the globe exemplify what can be achieved in geographical context.


This book is relevant to researchers, postgraduate and advanced undergraduate students, and professionals in the areas of quantitative geography, spatial analysis, spatial modelling, social simulation modelling and geographical information sciences.

Book Contents:

Part 1: Computational Modelling: Techniques for Simulating Geographical Systems
  1. Perspectives on Agent-Based Models and Geographical Systems.
  2. A Generic Framework for Computational Spatial Modelling.
  3. A Review of Microsimulation and Hybrid Agent Based Approach.
  4. Cellular Automata in Urban Spatial Modelling.
  5. Introduction to Agent-Based Modelling.
Part 2: Principles and Concepts of Agent-Based Modelling.
  1. Agent-Based Models - Because they're Worth it?
  2. Agent-Based Modelling and Complexity.
  3. Designing and Building an Agent-Based Model.
  4. Modelling Human Behaviour in Agent-Based Models.
  5. Calibration and Validation of Agent-Based Models of Land Cover Change.
  6. Networks in Agent-Based Social Simulation.
Part 3: Methods, Techniques and Tools for the Design and Construction of Agent-Based Models: 
  1. The Integration of Agent-Based Modelling and Geographical Information for Geospatial Simulation.
  2. Space in Agent-Based Models.-
  3. Large Scale Agent-Based Modelling: A Review and Guidelines for Model Scaling.
  4. Uncertainty and Error.-
  5. Agent-Based Extensions to a Spatial Microsimulation Model of Demographic Change.
  6. Designing, Formulating, and Communicating Agent-Based Models.-
  7. Agent Tools Techniques and Methods for Macro and Microscopic Simulation.
Part 4: Fine-Scale, Micro Applications of Agent-Based Models: 
  1. Using Agent-Based Models to Simulate Crime.
  2. Urban Geosimulation.
  3. Applied Pedestrian Modelling.
  4. Business Applications and Research Questions using Spatial Agent-Based Models.
  5. Using Agent-Based Models for Education Planning. Is the UK Education System Agent Based?
  6. Simulating Spatial Health Inequalities.
  7. ABM of Residential Mobility, Housing Choice and Regeneration.-
  8. Do Land Markets Matter? A Modelling Ontology and Experimental Design to Test the Effects of Land Markets for an Agent-Based Model of Ex-urban Residential Land-Use Change.
  9. Exploring Coupled Housing and Land Market Interactions Through an Economic Agent-Based Model (CHALMS).
Part 5: Linking Agent-Based Models to Aggregate Applications Macro:
  1. Exploring Urban Dynamics in Latin American Cities using an Agent-Based Simulation Approach.
  2. An Agent-Based/Network Approach to Spatial Epidemics.
  3. An Agent-Based Modelling Application of Shifting Cultivation.
  4. Towards New Metrics for Urban Road Networks. Some Preliminary Evidence from Agent-Based Simulations.
  5. A Logistic Based Cellular Automata Model for Continuous Urban Growth Simulation: A Case Study of the Gold Coast City, Australia.
  6. Exploring Demographic and Lot Effects in an ABM/LUCC of Agriculture in the Brazilian Amazon.
  7. Beyond Zipf: An Agent Based Understanding of City Size Distributions.
  8. The Relationship of Dynamic Entropy Maximising and Agent Based Approaches in Urban Modelling.
  9. Multi-Agent System Modelling for Urban Systems: The Series of SIMPOP Models.
  10. Reflections and Conclusions: Geographical Models to Address Grand Challenges
Looks particularly interesting but I'll be waiting to hear a few more reviews before I take the plunge and buy it on impulse. Very interesting though....