# PDF Archive

Easily share your PDF documents with your contacts, on the Web and Social Networks.

## s trubetskoy adv gis lab8 .pdf

This PDF 1.3 document has been generated by Pages / Mac OS X 10.11.4 Quartz PDFContext, and has been sent on pdf-archive.com on 01/06/2016 at 22:05, from IP address 128.135.x.x. The current document download page has been viewed 570 times.
File size: 189 KB (4 pages).
Privacy: public file

### Document preview

Sasha Trubetskoy
Prof. Schuble

25 May, 2016

Lab 8

Proximity to McDonald’s in Virginia (cont.)
In this lab we created a cohesive spatial procedure in order to answer a given question. In
this case, the question was: How much of Virginia’s population lives within 5, 10 and 20 miles of a
McDonald’s restaurant? To find out, I needed McDonald’s locations, a general shape of Virginia,
and population data as precise as was available. The McDonald’s locations were taken from a
free dataset, courtesy of FastFoodMaps.com. The shape of Virginia and block-level census data
came from Data.gov TIGER/Line shapefiles. I constructed a model in Model Builder with
ArcCatalog, and then modified it slightly after exporting to a python script. The full python code
can be seen on the last pages.
The file from FastFoodMaps.com was a .csv, so the first thing I had to do was to project it.
This can be easily done with the Convert Coordinate Notation tool. The file included the
locations of all major fast food restaurant chains, including Burger King and Wendy’s, which I
was not interested in. In order to work only with the McDonald’s locations, I created an update
cursor which went through the rows of the converted coordinate points, and removed rows where
Field2 != “m”; a value of “m” there indicates that the restaurant is a McDonald’s.
Next I wanted to get rid of McDonald’s locations that were not close to Virginia, in order
to simplify a final map and to improve performance speed. I accomplished this by first taking a
buffer of Virginia, which theoretically only had to be 20 miles; I took a 30-mile buffer to be safe,
mitigating “on-the-line” exclusions. A simple clip of the McDonald’s locations by the Virginia
buffer removes extraneous locations.
The next task was to perform several buffers around the McDonald’s locations. Using a for
loop with a predefined range of [“5”, “10”, “20”], we created the necessary distance values Dist
for our Buffer tool. Adding the string “ Miles” to the Dist variable fixes the problem of units. The
function produced intervals at 5, 10, and 20 miles.

LAB 8

!1

The task of calculating population within the buffers was done using the precise TIGER
shapefile. The TIGER file contained population data for every census block in Virginia, which I
converted into a point using the Feature to Point tool. This point served as an approximation for
the entire block, though admittedly there is some inaccuracy due to small parts of census blocks
being neglected. However, I do not expect this inaccuracy to significantly affect the results.
Once the TIGER population points had been created, I spatially joined them to each
buffer. Within the options for the spatial join, the merge rule for the field “POP10” (which
represents the 2010 population for each census block) I set to “SUM”. Once all the points had
been merged to the buffers, looking at the attribute tables revealed the following figures:

Buffer distance

Population

Percent of VA total

5 miles

6,653,384

83.16%

10 miles

7,532,814

94.15%

20 miles

7,987,342

99.83%

8,001,024

100.00%

Virginia total

While the 20-mile figure was consistent with my expectations, I was not expecting that 4 of
5 Virginians were within 5 miles of a McDonald’s, as the crow flies. This is likely because I
measured Euclidean distance with this demonstration, while in reality accessibility and travel time
are determined by Manhattan distance. It may be an interesting future project to determine how
many people are within 5 Manhattan miles of a McDonald’s restaurant. The output of my

LAB 8

!2

project can be summarized in the map below.

!
The python script follows:
#
#
#
#
#
#
#

-*- coding: utf-8 -*--------------------------------------------------------------------------grapes.py
Created on: 2016-05-25 22:02:23.00000
(generated by ArcGIS/ModelBuilder)
Description:
---------------------------------------------------------------------------

# Set the necessary product code
# import arcinfo

# Import arcpy module
import arcpy

# Local variables:
\va_blocks&quot;
\virginia_shape&quot;
\lab7.gdb\\virginia_shape_Buffer&quot;
\va_mcd_locs&quot;

LAB 8

!3

\va_mcd_locs_Buffer&quot;
\va_blocks_pts&quot;
\va_mcd_buffer_join&quot;
\lab7.gdb\\va_mcd_buffer_join_Statistic&quot;
# Process: Convert Coordinate Notation
arcpy.ConvertCoordinateNotation_management(ff_table, ff_locs, &quot;Field9&quot;, &quot;Field8&quot;,
&quot;DD_2&quot;, &quot;DD_2&quot;, &quot;&quot;, &quot;GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',
6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',
0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000
10000;8.98315284119522E-09;0.001;0.001;IsHighPrecision&quot;,
&quot;GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',
6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]&quot;)
# Create update cursor for feature class
#
with arcpy.da.UpdateCursor(ff_locs,
[&quot;Field2&quot;]) as cursor:
# Delete all rows that have a roads type of 4
#
for row in cursor:
if row[0] != &quot;m&quot;:
cursor.deleteRow()
# Process: Buffer
arcpy.Buffer_analysis(virginia_shape, virginia_shape_Buffer, &quot;30 Miles&quot;, &quot;FULL&quot;,
&quot;ROUND&quot;, &quot;ALL&quot;, &quot;&quot;)
# Process: Clip
arcpy.Clip_analysis(&quot;ff_locs&quot;, virginia_shape_Buffer, va_mcd_locs, &quot;&quot;)
# Process: Feature To Point
arcpy.FeatureToPoint_management(va_blocks, va_blocks_pts, &quot;CENTROID&quot;)
for i in [&quot;5&quot;]:
Dist = i + &quot; Miles&quot;
# Process: Buffer (2)
arcpy.Buffer_analysis(va_mcd_locs, va_mcd_locs_Buffer + i, Dist, &quot;FULL&quot;,
&quot;ROUND&quot;, &quot;ALL&quot;, &quot;&quot;)
# Process: Spatial Join
arcpy.SpatialJoin_analysis(va_mcd_locs_Buffer + i, va_blocks_pts,
va_mcd_buffer_join + i, &quot;JOIN_ONE_TO_ONE&quot;, &quot;KEEP_COMMON&quot;, &quot;POP10 \&quot;POP10\&quot; true true
\va_blocks_pts,POP10,-1,-1&quot;, &quot;INTERSECT&quot;, &quot;&quot;, &quot;&quot;)
# Process: Summary Statistics
arcpy.Statistics_analysis(va_mcd_buffer_join + i,
va_mcd_buffer_join_Statistic + i, &quot;POP10 SUM&quot;, &quot;&quot;)

LAB 8

!4