25.4.14

Displaying movement map in R as raster

So I've been busy trying to output suitable information from my model to demonstrate the area sin which agents are moving. I want to get some idea of how well used the map is, and if agents are able to successfully negotiate the central section of the landscape where heterogeneity is highest.

I've outputted a text file that has the number of steps taken in each grid cell and converted this to an ASCII file, replacing all commas with spaces and adding the relevant information at the start of the file as below:


ncols         608
nrows         506
xllcorner     299006.96538007
yllcorner     1898128.1510276
cellsize      100
NODATA_value  0

I can now read this into R with the following:
(which requires several packages - raster, rgdal and scales)


Map1 <- raster ("/Users/aw4g09/Dropbox/ThesisChapters/CorridorLandscapePaper/simulationData/RawData/long_corridorModelOutput/GISMovementMap_1.txt")

and display with several options:
plot(Map1)
or

map.spdf <- as(Map1, "SpatialPixelsDataFrame")
map.df <- as.data.frame(map.spdf)
head(map.df)
gMap <- ggplot(map.df, aes(x=x, y=y)) + geom_tile(aes(fill=layer)) + coord_equal()
gMap <- gMap + theme(panel.background = element_rect(fill='white'))
gMap <- gMap + scale_fill_gradient2(limits = c(0, 30000), low=muted("green"), mid="red", high="white", midpoint=15000)
gMap
This latter option allows me to manipulate the legend extent, choose gradient colours etc.

I also found a VERY cool way to generate a 3D plot of the raster which can be manipulated. This requires some extra packages including rasterVis, rgl and sp, at which point you can simply enter plot3D(Map1). Another application opens to display the 3d plot.

although I am still struggling to figure out how to save an image of the output!

now I'm starting to try and figure out how to compare movement across simulations, i.e. compare the distribution and density of movements between different rasters... I found a very useful website that is helping with this

http://evansmurphy.wix.com/evansspatial#!raster-analysis-in-r/c1n3l

so I'm hoping I should have something more solid to present in my last thesis chapter than a subjective description of movement... fingers crossed.



3.4.14

Clip polygon layer by another polygon layer

Ok, so I did this once, didn't write it down and then couldn't figure out how to do it again.

I continue to lament on the 'improvements' to arcGIS. Version 10 is not my idea of good software design.
Anyway, I have a number of polygon shape files, that design buffers around existing agricultural areas in the landscape. However, I want to remove the existing urban read from these files to ensure that agricultural expansion cannot override existing landscape features - roads, protected areas, urban centres etc. I don't have the 'erase' tool seeing as this requires the advanced version of arcGIS10.

So what I figured out I need to do is use the 'clip' function, but in reverse; i.e. create a shape file that identifies all the areas outside of protected areas, urban centres, etc and then clip the agricultural files by this 'non' file.

Analysis Tools - Extract - Clip

Finally!

A bit of a workaround, but this seems the best that arcGIS10 has to offer.

To create the 'non' file, use the Union function:

Analysis Tools - Overlay - Union
select Urban polygon file
select corridor outline shapefile

output file identifies urban areas on top of corridor file
then simply remove the urban areas via the attribute table - select urban polygon and delete from the file. done!

then need to do this again with the corridor designs 1 and 2.

repeat with the urban area - removing existing agricultural areas as well as protected reserves and corridor designs (in separate files).

2.4.14

Arc GIS 10

I am completely frustrated by this newest version of Arc GIS. My previous version of 9.3 was easy to use, straight-forward and functional. This new version has a complicated menu arrangement and features that were easy-to use and 'available' in version 9 are now not available in the new version!

I have to say, the look and feel of the programme has not been improved either. Floating menu boxes make it easy to lose menus, and the map does not adjust to fit the screen when a new menu is added: for instance, when I add Arc Toolbox, which now seems to be hidden within the Geoprocessing option in the toolbar, I have to adjust the underlying map and the toolbox sits awkwardly at the side of the screen.

I have also been attempting to use a simple feature of GIS all day - all I want to do is clip a shape file by another shape file so that polygons in one file do not overlap with polygons in the second file and it seems impossible! Apparently, the erase tool (which online sources seems to suggest will perform this function) is only available under the advanced software download. Ridiculous!

I am NOT impressed.