Friday, July 29, 2016

Module 11 - Sharing Tools

Our module this week took sharing scripts to the next level.  We learned to take an existing script, place it in a toolbox.  Once it was in our toolbox, we could now add various parameters using sys.argv[ ] avoiding hard coding paths.  While providing comments in a script is very useful, for someone unfamiliar with python, reading the script would be difficult.  The script tool uses a gui interface; this gui, is not automatically populated with descriptions about the various parameter.  Last week we learned where to place the description of the tool in the tool properties.  This week we learned how to use the Item Description tab in AcrCatalog to edit the syntax section for each of the parameters.  Adding information here provides built in help/guidance for the end user so that they know what type of information is expected for each parameter.  This allows them to execute the tool without a working knowledge of scripting.  Another advantage to using a script tool is that it can be embedded into the toolbox.  This allows for simpler sharing since only the toolbox would need to be shared, not the underlying script related to the tool.  In addition, once the script is embedded a password may be assigned.  The tool functionality is not affected by the password, but the ability to view and export the actual script is prohibited unless you know the password.   This prevents script piracy and ensures your hard work remains your hard work and others cannot take credit or modify its contents. The combined screenshots below illustrate the gui interface for the script tool and the results of utilizing said tool within ArcMap.




As this is our final blog post for the semester, we were asked to summarize the most memorable, interesting or useful things learned about Python with ArcGIS.  Honestly, the most memorable/useful thing from this course has been overcoming my fear of scripting.  After the first couple of assignments, I no longer dreaded the thought of tackling the next one.  This was huge for me and will greatly help not only future GIS work but also work involving other programming languages as I will not have the mental block I once had.  From the course overview perspective, I think the raster module will prove particularly useful and time saving in the future.  Additionally, the ability to setup scripts for repetitive tasks and be able to set them to use workspace parameters rather than hard coded locations is huge.  Combine that with the ability to share these time saving tasks with coworkers and you look like the department rock star.

Monday, July 25, 2016

Module 10 Creating Custom Tools

This week we focused on the use of custom tools to both automate workflow and share time saving processes with others.  Our goal was to create a tool box to house a script which would perform a clip on multiple objects.

Here are the notes from my process summary  about how to create a script tool and a valuable tip I learned, the hard way!
This list assumes you have a functional stand-along script named SAScript.py
1.       In either Arc Catalog or ArcMap, navigate to the location you want to create the script tool.
2.       Right click on the folder intended to house your script tool and select New, Toolbox.  Name your tool box.  In this case SAScript.tbx
3.       Right click SAScript.tbx and choose add script
4.       In the dialog box name your script (in this case SAScript); repeat in the label field and add a description of what your script does in the description field.  Toggle the Store relative path names to on before choosing next.
5.       Browse for your script file, choose open and then choose next.
6.       At this time, you can skip the adding parameters and just choose finish.
7.       Run the tool either in ArcCatalog or ArcMap; it will say there are no parameters but it will run and either work or return errors if your script has an issue.

8.       After checking this, right click on your script and choose properties.  You may know enter your parameters which will be dependent on the type of script you created.

TIP:  Don't overthink or apply "common sense" to the parameter properties.  Your output file location direction parameter should say Input!  If you change it to output as I did, the tool cannot write to an output file.  This will cause great consternation if you don't catch your mistake!



Tool dialog, Tool results and flow chart for creating the script tool:






Tuesday, July 19, 2016

Module 9 Working with Rasters

This module was all about working with rasters and the arcpy.sa module and functions.  We learned to list and describe raters, use them in geoprocessing, incorporate map algebra into the geoprocessing and use classes to define raster tool parameters.  Below you will find the area in which I struggled with the lab, my flowchart and my final raster result showing two classes, 0 and 1.

Which step did you have the most difficulty with? Describe 1) the problem you were having, and 2) the solution or correct steps to fix it. Be detailed with your explanation.
1.       I had the most trouble with the checking out of the spatial analyst extension.  Despite finding my code to appear accurate and the SA extension to be available my if else statement returned “The Spatial Analyst license is not available” from the else statement
2.       I carefully checked my code and the indentions.  All appeared correct.
3.       I confirmed within ArcMap that the extension was in fact toggled on, which it was.
4.       I closed ArcMap and ArcCatalog and checked the task manager to make sure nothing was open which would be using the license.
5.       I closed and reopened pythonwin, ran the script and received the same error.
6.       Online research indicated that this is a glitch and can often be resolved by rebooting.  I performed a reboot, but my script still returned the same message.
7.       Since I work locally, I tried doing the same steps in PythonWin on the Citrix server with the same results.
8.       I tried another reboot and when I still had no success, I rewrote the entire section of the script.  Success!


Sunday, July 17, 2016

Module 9 GIS for Local Government, Scenario 1 and 2

Our focus this week was learning to obtain information regarding parcel data, zoning, use of the public land survey system.  Once we understood this process we were ready to work with the data by performing parcel edits, using advanced editing techniques and create data driven pages to produce a map book.  Scenario one required that we analyze information about the "Zuko" parcel on the Marion County Property Appraiser Website.   After viewing the aerial imagery on the appraiser's site, I contemplated a site visit but was deterred by the fencing and guard house and opted to  use the tools on this site to create a quarter mile buffer around the "Zuko" property and export the parcel data to a .csv file for later use.  Mr. Zuko desired a map book parcel data report illustrating all adjacent parcels, zoning and property owner data.  Due to the large area, cramming all of this information onto one sheet would have been impractical thus the need for data driven pages to not only save time but also provide consistency from one map page to another.  Using various joins and data extraction we were able to identify the surrounding zoning, the target parcel and adjacent parcels.  We were also able to use select by location to create a dataset of the parcels within a quarter mile of the "Zuko" parcel. By adding fields to various attribute tables we were able to not only keep our data organized, but also join when necessary in order to meet the final goal of creating the parcel report.  Critical to the usefulness of the map was appropriate symbology.  We needed to present a lot of information in a manner that was easy to interpret for the client.  Steps used to create the data driven pages and Key map can be seen at the end of the first portion of this blog.  Here is one sheet from the map book:


I.                   Part 3:  Utilize Data Driven Pages to Create a Map Book
A.                 Step One: Data Driven Pages
1.                  Save the existing zoning map as Zoning_DDP.mxd
2.                  Zoom to the qtmi_parcels layer
3.                  ArcToolbox/Cartography Tools/Data Driven Pages/Grid Index Features
a)                  Output Feature Class: Index2400 to MarionCounty.gdb
b)                  Input Features:  qtmi_Parcels
c)                   Check Use Page Unit and Scale
d)                  Map Scale (optional) 2400
4.                  Select features from zoning that intersect Index 2400 and export to Zoning_Index
5.                  Symbolize the zoning using unique values.  Be sure to include the descriptions of the zoning types found in Municode.
6.                  Make sure Parcels and streets are in map and symbolize appropriately.
7.                  Switch to layout view and use a premade template or one you created.
a)                  You will want a layout with a standard data frame and a separate strip for essential map elements.
8.                  Enable the Data driven toolbar, Cusomize/Tooolbars/Data Driven Pages
9.                  Add a short integer field names scale to the Index2400 attribute table; use the field calculator to set the values to 2400
10.              Choose the Data Drive Page setup and mark the following parameters:
a)                  Index Layer: Index2400
b)                  On the extent tab click data driven scale radio button and choose scale from the dropdown box.
11.              Insert Dynamic Text, Data Driven Page Number
12.              Insert a new Data Frame named Locator Map
13.              Copy the Index2400 and the qtmi_Parcels layers from the original data frame to the Locator Map data frame.
14.              Within the Locator Map data frame, create a new feature class by right-clicking the Index2400 layer and exporting the data to Locator_Mask and add to dataframe.
15.              Right click the Locator_Mask and select copy
16.              Right click the Locator Map data frame and choose paste layer(s)
17.              Rename the new Locator_Mask to Locator_Mask Current Page
18.              Choose the symbology tab for the Locator_Mask Current Page
a)                  Make the symbol hollow with a black outline with a width of one
b)                  On the definition tab, click page definition button.
(1)                Check the enable check box
(2)                Choose PageName from the Page Name Field
(3)                Choose match and click ok and then ok again to exit the properties box.
19.              Open the symbology tab for the Locator_Mask
a)                  Make the color black with an outline width of zero
b)                  On the definition tab, choose page definition.
(1)                Check the enable check box, select PageName from the Page Name Field and choose Don’t Match and click ok
c)                   On the display tab set 60% transparency
20.              Change the Index2400 symbology to hollow with a white outline and width of one.
21.              Choose Label and use Page name for the label field, Arial Black 20, Bold, labels on
22.              Add dynamic text Date Saved and at least one more of your choosing to the map.

The second scenario for our lab required that we evaluate parcels in Gulf County, update the base parcel data to reflect newly acquired property by Gulf County and split that property into two parcels.  Since the purchased parcels were initially two separate parcels owned by an individual, they needed to be merged so that they could be later reconfigured to meet the Gulf County requirements.  Once merged and the attribute table updated to reflect the new owner, we needed to use the short legal description provided to create the new configuration splitting one large parcel into two.  This was done through the use of editing options, cutting polygons, creating straight segments and using length and direction flyouts along with snap settings.  Once we "closed" the parcel we chose the Finish Sketch tool to create the new record on the map and in the attribute table.  We were then able to add information to the new parcel and edit the acreage for the original and the new parcel. We then needed to identify parcels that were county owned, 20 acres or larger and vacant so that they could be reviewed for potential as the location for the new extension office.  Using select by attributes we were able to identify the parcels which were owned by Gulf County.  Since we needed acreage, we added a field and calculated geometry in our new Gulf County owned feature class.  Using a query builder we identified only the parcels which were 20 acres and larger.  We then joined this with the VICD (vacant-improved) Table to analyze for our final criteria of vacant.  The final result was exported to the ExtensionSites feature class.  The attribute table was used to create a parcel report showing the Parcel IDs, Owner Name, Short Legal and acreage.


Participation Assignment - GIS for Local Government

The first portion of this assignment provided an overview of how to perform property research within your local area.  This also provided insight into how said government maintains the land record data.  We were tasked with the following:

1. Conduct a web search to locate a property appraiser’s office in your area.
Q1:  Does your property appraiser offer a web mapping site? If so, what is the web
address? If not, what is the method in which you may obtain the data?  Martin County has both a GIS site and a separate appraisers site both.  Appraiser site: https://pa.martin.fl.us/tools/property-map-searches , http://geoweb.martin.fl.us/general/.

2. Most property appraiser’s websites offer a list of recent property sales by month. Search for the month of June for the current year and locate the highest property sold.
Q2:  What was the selling price of this property? What was the previous selling price of this property (if applicable)?   Take a screen shot of the description provided to include with this answer.
The highest selling price was $210,000.00.  The previous selling price was $93,000.00


3. The selling price and assessed price will differ in most cases (higher or lower). You may choose to search for a different property based on location/owner name or use the same result from the previous question to answer the following questions.
Q3:  What is the assessed land value?  Based on land record data, is the assessed land value higher or lower than the last sale price?  Include a screen shot.  The assessed land value is $72,000.  The assessed land value is lower than the last sale price.




Q4:  Share additional information about this piece of land that you find interesting.  Many times, a link to the deed will be available providing more insight to the sale.  If you look at the assessment and exemptions information for this parcel, you will note the drastic jump in land value during 2006-2007.  This was when the Florida real estate market was extremely over inflated which led to the subsequent economic downturn affecting property owners, home buyers, developers, surveyors, engineers and the like.  Values have begun to increase in the last two years and will hopefully return to a more normal level.  This is also evident by looking at the land value from the past two years.  The Warranty Deed for this property is recorded in Official Record Book 2858, Page 1546.-


Part two of this lab focused on understanding and mapping assessed values.  For ethical, political and legal reasons, such assessments must be performed equitably.  Items affecting value include lot size, improvement size, age, condition, location, proximity to waterfront and land use.  Within these areas there is usually a diverse mix of land values between neighboring parcels due to various combinations such as mixed zoning, varying home values, and homes ranging greatly between age.  More uniform areas typically have more uniform values as can be seen in subdivisions.  Our job was to review West Ridge Place subdivision and determine if there were any accounts which needed to be reviewed in order to maintain fair and equitable assessments.  Here is the resulting map created for analysis purposes:



Q5.  Which accounts do you think need review based on land value and what you’ve learned about assessment?  

Based on the graphic analysis, there are seven parcels which I would review.  Parcel 090310165 stands out as it has one of the highest values.  Parcels 090310175, 090310320, 090310325, 090310260 and 090310245 have slightly lower values than the majority of the adjacent properties.  Parcel 090310105 has a lower value than the adjacent properties.  



Saturday, July 9, 2016

Module 8 Geometries

Pseudocode:

#Import all modules, classes, enable overwrite output setting and set workspace, import file input,
START
set file output path
Set Variable for rivers.shp
Set Variable for text fie output rivers_RHamaty.txt
Create Search Cursor (.shp variable, OID@, SHAPE@, NAME)
Print “Search Cursor created and gathering information and creating results in text file”
      Create for loop for row in cursor
      Set vertexid equal to 0
      Create for loop for point in row 1; getPart(0)
            Output to text file (row 0 vertex id  x,y coordinate, row 2) “\n”
Close output file
Print “Text file created Successfully”
Delete Row
Delete Cursor

END



Module 8 Urban Planning, Location Decsions - Welcome to the SWAMP!!!

This week’s module focused on making locations decisions based on using basemap layers, Euclidean Distance analysis, Reclassifying Data, Weighted Overlays, attribute table field calculator, Page layouts and model builder.  Since multiple data frames were needed for each map, it was important to create some base map layers and to be sure that when adding data frames the correct coordinate system was chosen.  With this lab we continued to practice reviewing our metadata and the appropriately organizing both provided data and created data New this week was the use of Euclidean (as the crow flies) Distance analysis, raster data reclassification and weighted overlays.  Blending these tools gave us the ability to make location decisions based on criteria provided by a client.  Creating a model for the weighted overlay portion allowed us to save time as we could simply tweak our parameters rather than starting from scratch with each raster each time.  Because of the various steps involved in this week’s map production, I felt it useful to outline my steps.  Below you will find my outline and the two resulting maps.





Organize and Document WorkA.                 Examine the Data
1.                  The data has already been downloaded and clipped to Alachua County
2.                  It is all in GCS NorthAmerica 1983 Projection NAD 1983 UTM Zone 17N, Meter
3.                  See separate table within this document containing Metadata information.
B.                 Organize and Document your Work
1.                  Make a new folder in Lab08_Location Analysis named Results.
2.                  Within the results folder create a new geodatabase named results.  This is where analysis results  (data files) will be saved.
3.                  Open ArcMap and save document as Location1_rh
4.                  From File Menu, choose Map Document Properties
a)                  Add a title, author and descriptive text
b)                  Set default geotabase to results.gdb
c)                   Always check box “Store relative pathnames to data sources”
C.                 Set the Environments
1.                  View Menu/Data Frame Properties/Coordinate System tab/Projected Coordinate Systems/UTM/NAD193/Zone 17N
2.                  Geoprovessing menu/Environments/expand workspace, output coordinates and processing extent
a)                  Current workspace: Data\Location.gdb
b)                  Scratch workspace: Results\results.gdb
c)                   Output Coords:  Same as Display
d)                  Processing Extent: choose Location.gdb and select cns_tracts
e)                   Raster Analysis settings: limit to cns_tracts by using a mask
(1)                Cell size “as Specified Below”, 300
(2)                Mask: Cns_tracts
3.                  Select OK and save map
D.                 Conduct Analysis
1.                  Add cns_tracts, county, publands, places and roads from arc catalog
2.                  Symbolize layers; right click data frame and select New Basemap Layer and drag all layers under this group layer
3.                  Right click on Basemap layer and select Analyze Basemap Layer
a)                  Review error report to identify potential drawing performance issues and how to address them.
4.                  Using the effects toolbar, adjust the Dim Level
a)                  If at a later time you need to make data edits or layer updates, drag the map layer out of the basemap, edit it and then return it to the basemap layer group.
E.                  Calculate Distance from North Florida Regional Medical Center
1.                  Insert a new data frame named Hospital Distance
a)                  Set the coordinate system in the data frame properties
2.                  Create a selection to select North Florida Regional medical Center
3.                  Export as NFRMC to results.gdb, use same coordinate system as data frame and make sure to export as feature clas.
4.                  Remove the original hospitals layer
5.                  Symbolize and label the NFRMC.
a)                  Add field Abbrev to attribute table, text
b)                  Use field calculator, string, “NFRMC”
c)                   Use this field as the label field
6.                  Spatial Analyst Tool/Distance/Euclidean Distance
a)                  Input: NFRMC
b)                  Output raster: dist_hosp_rh in results.gdb
c)                   Cell size: 300
7.                  Use the reclassify tool to edit proximity zones to whole number values and 9 defined intervals.
a)                  Spatial analyst/reclass/reclassify
b)                  Input rater: dist_hosp
c)                   Reclass field: Value
d)                  Output raster: results.gdb\reclass_hosp_rh
8.                  Classify, Defined Interval, interval size 5000
9.                  Click Reverse New Values to flip the value order so that 9 is the most favorable and 1 is the least favorable.
10.              Remove the dist_hosp_rh once the reclass_hosp_rh is complete.
11.              Select an appropriate color scheme for reclass_hosp_rh
12.              Make the cns_tracts hollow and save the map
F.                  Calculate Distance from UF (University of Florida) CHOMP CHOMP
1.                  Insert new data frame named College Distance and set the coordinate system in the data frame properties
2.                  Add cns_tracts and schools
3.                  Isolate UF from the schools layer and export as a feature class.  Label and symbolize appropriately and then remove the schools layer. UF_rh in Results.gdb
4.                  Perform Euclidean Distance Analysis for UF.  Export as dist_uf_rh
5.                  Reclassify the output
a)                  Defined interval 5000 which will generate 8 values
b)                  Reverse new values so that 8 equates to the most favorable location closest to UF and 1 the least favorable.
c)                   Name the output reclass_UF_rh
d)                  Remove dist_UF upon completion
6.                  Choose an appropriate colorscheme for reclass_UF_rh and save the map.
G.                 Calculate Percentage of Population Aged 40-49
1.                  Insert a new data frame named 40-49 and set the coordinate system in the data frame properties
2.                  Add cns_tracts
3.                  Open the cns-tracts attribute table and click options/add field
a)                  Name: perc_pop
b)                  Field type: float
c)                   Click ok
4.                  Right click the new perc_pop field and select Field Calculator.  Click yes to edit outside of a session.  Perform the following calculation:
a)                  [AGE_40_49]/[POP2010]*100 click ok
5.                  Display cns_tracts by Quantities, Graduated colors, Value: perc_pop and save yor map.
H.                 Convert Tracts to a Raster for Age Range and reclassify
1.                  Conversion tools/To Raster/Feature to Raster
a)                  Input cns_tracts
b)                  Field: perc_pop
c)                   Output raster: results.gdb\IdealAge_rh
2.                  Once IdealAge loads, turn off cns_tracts
3.                  Reclassify as whole number values.  Use the default of 9 classes, reclass_age_rh
4.                  Once reclass_Age_rh loads, remove IdealAte
5.                  Select appropriate color scheme for reclass_Age_rh
6.                  Turn on cns_tracts and make hollow
7.                  Add Uf and NFRMC, symbolize and layer each feature.  Save your map
I.                    Calculate Percentage of Population of Homeowners
1.                  Insert a new data frame called Percent Homeowners, set coordinate system
2.                  Add Census Tracts
3.                  Add a new field called perc_own use the field calculator to generate percent homeowners (owners/(owners+renters))*100
4.                  Convert cns_tracts Feature to Raster based on perc_own field; output = Perc_Own_rh
5.                  Reclassify the outut, 9 natural break classes where nine is the most suitable class/value. Reclass_Own_rh
6.                  Symbolize and display cns_tracts as hollow
7.                  Add UF and NFRMC, symbolize and label.
J.                   Creating Weighted Overlays
1.                  Save Location1_rh as Location2_rh
2.                  Insert new data frame named Weighted Analysis and set coordinate system.
3.                  Add reclass_hosp_rh, reclass_Uf_rh, reclass_age_rh and reclass_own_rh
a)                  Symbolize appropriately
b)                  Remove all other data frames except for basemap data frame which will be used as an inset.
4.                  ArcCatalog/results.gdb, New Toolbox named Weight_Analysis
5.                  Right click Weight_Analysis toolbox and create new model
a)                  From the TOC add the four “reclass” rasters into the model
(1)                Use the auto layout and full extent icons to focus your model
b)                  Drag the Spatial Analyst/Weighted Overlay tool into the model
c)                   Use the connect tool to connect the rasters to the Tool; choose “weighted overlay table from the pop up menu
d)                  Double click the Weighted Overlay tool to open
e)                   Confirm the scale values match the fields in your map
f)                    Choose set equal influence so that each % influence equals 25%
g)                  Run the model and save as weight1_rh in the results.gdb
(1)                Model errored out within ArcDesktop but ran perfectly via ArcCatalog
6.                  Create a second weighted overlay
a)                  Follow the steps above, but this time adjust scale values so that the primary focus becomes proximity to the workplace.
b)                  You will want to restrict a portion of the age and ownership values (lower end of the criteria) so that the weighted analysis shifts to workplace proximity.
K.                  Compile and Present Results
1.                  Make sure to appropriately symbolize both weighted analyses
2.                  Add places and label the ones closest to suggested areas
3.                  Be sure to turn on the cns_tracts, but make them hollow
4.                  Add NFRMC and UWF and symbolize/label appropriately
5.                  Choose three census tracts from each weighted overlay
a)                  Symbolize and label appropriately
b)                  These are the focus of the map and should be easy to interpret
6.                  Make sure to summarize your findings and explain your weighting process so that your clients not only understand the values but also feel confident in your suggestions
a)                  I restricted the lowest 4 values for proximity to NFRMC and UF and weighed each of these at 40%
b)                  I did not restrict values for the ownership or age category, but weighted them at 10%.