Friday, June 20, 2014

GIS Programming Module 5 - Geoprocessing with Python

In this week's GIS Programming lab, we learned a lot about using Python to access the ArcMap tools.
This week was something of a watershed for me, because the help pages for the tools makes  much more sense than it did before, and I am also more comfortable with the syntax of modules and functions, in their operation as toolboxes and tools.  Python, as it works with ArcGIS, is falling into place.

In the figure above, the results are shown for the script this week: the messages for running the tools.  
Our task was to first assign XY coordinates to a point shapefile, then buffer it, then dissolve the buffer using the Dissolve tool in Data Management.

The summary of my process for writing this script can be accessed at this link:.

Process Notes for Module 5

Monday, June 16, 2014

Module 4 - Applications in GIS - Crime Analysis




This week's lab covered spatial and temporal crime analysis by comparing three different methods of determining crime hotspots.  The map layout here shows the kernel density method, grid analysis, and local Moran I method.  They are based on distribution of points representing locations of burglaries.
To use the kernel density tool, we used the point data for burglaries to make contour map and showed the hotspot with the values at least 3 times the mean density. With the grid-based thematic mapping, burglary point data is overlaid on a grid and the occurrence of burglaries within each grid cell  is shown.  The top 20% or quintile of the grids are used to create a single polygon which represents the hotspot.  The local Moran's I method is a little different, because can be thought of as having a predictive quality.  Rather than only representing the current year's burglary point density, it also shows clusters of higher than normal density.  Areas with slightly lower crime densities that would not show up on the kernel or grid map hotspots do show up on this map because of their proximity to high crime areas.  This goes along with criminology near repeat theories that state that crimes are much more likely to occur where they have occurred in the past, as well as near those areas. Examples in the above map are the pink areas that do not intersect the blue (grid) and yellow (kernel density) hotspots. These are areas that police should monitor a little more carefully, because of their proximity to high-crime areas, and the tendency of crime to spread spatially.  
The Kernel and local Moran I analyses were carried out using tools in the Spatial Analyst toolbox: Kernel Density and Cluster and Outlier Analysis tools.  The Grid map was accomplished using the Spatial Join tool in the Analysis Overlay toolbox. Point data for burglary locations in 2007 and 2008.

Friday, June 13, 2014

GIS Programming Module 4 - Python Fundamentals Part 2

This week we learned more about Python scripting, especially conditional statements using IF and WHILE.  We also did more with lists and started working with modules that must be imported into PythonWin.

The results of the scripting assignment are shown here.  The first block is a virtual dice-rolling game that generates random numbers using the imported RANDOM module.  We only had to correct a couple of errors in the existing script.  In the second block, we generated a list of 20 random numbers, again using the RANDOM module, and a WHILE loop and a counting variable.  Finally, in the last block, we took that list of random numbers and removed all instances of an "unlucky" number from it.  For this, I used the remove method, inside a WHILE conditional loop, with IN and NOT IN operators.
 In addition, I imported the SYS method to Python and used it to allow the user to enter their own unlucky number into the Run Script dialogue box before running the script..  This was discussed in chapter 4 of our text and is very straightforward and convenient way to get input from the user.

Here is a portion of my process in this lab:

Part 1, Step 4: Removing numbers from the list. Explain how you created this block of code.

1.      I used in and not in within an if, else conditional structure to determine if the unlucky number was there or not.
2.      After the else, I used a new while loop containing the remove method: 
while unlucky in list:
list.remove (unlucky)

This ran the code until the in condition no longer applied in the while loop.

Wednesday, June 11, 2014

GIS Participation Assignment # 1: How is GIS used in the real world?

For this assignment, I read about a very interesting application of GIS Network Analysis, which could be expanded and applied to many needs.  As we learned in Intro to GIS class, ArcMap Network Analysis is well-developed for use by all kinds of motorists, and especially useful to emergency personnel such as EMT’s, the police, and firefighters to plan the most efficient route among any number of destinations or stops.  While planning out a route, it incorporates various forms of impedance to traffic flow, such as stop signs, speed limits and one-way streets. 

The authors of this article realized that people in wheelchairs face impedance every day, in the form of stairs, rough pavement and curbs, as they try to navigate around their cities.  Their goal was to develop a mapping application to help people in wheelchairs easily plan the best routes.  The researchers manually digitized the center-lines of sidewalks in the city of Northampton, UK, then incorporated DEM's to obtain slope for separate segments of the routes.  At this point, Event Tables were developed from field work, which measured surface quality (starting and rolling resistance), and the presence of any type of obstacle that might frustrate a wheelchair user:  steps, gutters, raised manhole covers, fixed furniture, narrow sidewalks, and several more.   This latter part of the field survey was actually carried out in the company of disabled volunteers in wheelchairs, who helped the researchers identify impediments.  

The application was developed in ESRI’s ArcView (the precursor to ArcGIS for Desktop Basic) and featured a user-friendly interface.  The routes were calculated by considering impedance or “cost” with the network analysis environment as well as user physical ability and type of wheelchair.  Two modes of route selection were offered via dialogue boxes: a single best route from one location to another, or all wheelchair-suitable routes from a starting point.
The authors tested their map application with 18 wheelchair users in that city and got very favorable reviews about its usefulness and clarity. 

This type of network analysis would be very useful in any area where pedestrians need to navigate, especially tourists, for mapping restaurants, bus stops, presence or absence of sidewalks, etc.  These data can also be crowd-sourced, for  example, with OpenStreetMap, which we read about in our Cartography class. 

This article can be accessed at this link: Mapping for Wheelchair Users: Route Navigation in Urban Spaces . 
Source:  Beale, L., Field, K., Briggs, D., Picton, P., and Matthews, H. (2006). Mapping for Wheelchair Users: Route Navigation in Urban Spaces. The Cartographic Journal, Vol. 43 (No. 1), pp. 68–81.

(I have placed the PDF in my UWF I:\ drive because it was downloaded from my local library’s EBSCO database, for which access is limited to local card holders.)

Monday, June 9, 2014

Module 3 - Applications in GIS - Damage Assessment

In this week's Applications in GIS lab assignment, we studied damage assessment, specifically for Hurricane Sandy, which hit the east coast of the United States in October 2012.

This figure shows a portion of the New Jersey coast, with post-storm imagery for structures in three city blocks.  We used ArcMap to compare post-storm and pre-storm images and assigned degrees of damage to each building in this study area.  The damage assessment was based on structural damage, wind damage and inundation of each building.  Because of the presence of sand and moisture on the streets of these blocks post-storm, I concluded that probably all of the structures had been inundated to some degree.  For a house to be classified as destroyed (red dots), part or all of it had to have been reduced to a pile of rubble.  Major structural damage was assigned to a house that still retained its pre-storm shape, but is surrounded by rubble and has other structures pushed against it.  Wind damage was judged partly by the exposure of a structure to the coast, and condition of trees around it, and the presence or absence of debris near it.

Here is a table classifying the houses based on their degree of damage and distance from the shore.  I used Select by Attribute and Select by Location to tabulate this data.

Results Table for Distance from Coastline vs.  Damaged Property

Friday, June 6, 2014

GIS Programming Module 3 - Python Fundamentals Part 1

In this week's GIS Programming lab, we learned more about how to write scripts, and the nature of some of the data types in Python, such as numeric values, strings and lists.  We learned the definitions of expressions, statements, functions, methods and objects.  We practiced using methods and wrote a small script in which the input is our full name, in the form of a list.  Running the script causes the last name only to be output, as well as the number of letters in the last name times 3.
My output is shown above. It consists of my last name, and the number of letters in it (5) times 3 (15).

In order to write this code, I utilized the split method, to separate the whole name string into separate names/strings in a list, then indexing to select the last name from the list, and the length function combined with a simple multiplication operator, to find the number of letters in the last name times 3. Print statements were also included in the script to show the last name and for the number of letters times 3.

Monday, June 2, 2014

Module 2 - Applications in GIS - Coastal Flooding

Impact of sea level rises up to 6 feet on the population of Honolulu
This week in Applications in GIS we learned a lot about working with raster data.  There is a lot to learn.  I really started to have an appreciation for the elegance and simplicity of raster logic this week.  We used DEM imagery of the coast of Oahu at Honolulu to construct ahypothetical scenarios of 3-foot and 6-foot sea level rises.  This was done by selecting those portions of the raster elevation data below 3 or 6 feet, then converting it into a vector polygon and draping it across the coastal areas of Honolulu.  We then applied US Census data to the map, by tract, and showed the population density compared to sea level rise.

In the second part of the exercise, we took a closer look at the demographics in Honolulu, and compared the percentages of white, home-owner, and older than 65 years in the census blocks to zones of possible inundation.
Here is a table showing some demographics of Honolulu compared to the expected zones of inundation..


The white population is seen to be somewhat more impacted by sea-level rises.  Owner-occupied houses are less impacted.  People over 65 years old are not disproportionately impacted.

In the second part of the lab, we analyzed the effects of a storm surge in Collier County, Florida on buildings in the city of Naples.  We compared the results using a USGS DEM imagery created from photogrammetry, and LIDAR imagery, to get an idea of their relative reliability.  We used the DEM's to construct a zone of 1 meter storm surge inundation and overlaid the resulting polygons on shapefiles of the city buildings' footprints.  Then, by calculating errors of omission and commission, we evaluated the reliability of the USGS DEM against the presumably more accurate LIDAR DEM.

This table shows numbers of different types of buildings impacted by a        1-meter storm surge, as evaluated by the USGS and LIDAR DEM's.
We are assuming the LIDAR data is superior, so errors of omission are those buildings that counted by LIDAR as being impacted, but NOT counted by the USGS DEM.  The errors of commission, on the other hand, are those buildings that are incorrectly counted by the USGS DEM analysis, but do not show up when LIDAR is used.  The percentage error for each is calculated against the total LIDAR building counts.