Geography 375 Introduction to Python May 15, 2015

Slides:



Advertisements
Similar presentations
JQuery MessageBoard. Lets use jQuery and AJAX in combination with a database to update and retrieve information without refreshing the page. Here we will.
Advertisements

Analysis in 9.2: Overlay. Analysis Usually starts with selection… Why? Because –Many steps in analysis are simply selection by Attribute OR Location –Most.
Why python? Automate processes Batch programming Faster Open source Easy recognition of errors Good for data management What is python? Scripting programming.
GIS UPDATE? ARE YOU TAKING NOTES? How will you remember what you did if you do not take notes. Lab 9 this week: Music Festival 3: Vector Analysis.
Geodatabase basic. The geodatabase The geodatabase is a collection of geographic datasets of various types used in ArcGIS and managed in either a file.
GIS Topics and Applications
Geog 458: Map Sources and Errors January 20, 2006 Data Storage and Editing.
©2005 Austin Troy Lecture 9: Introduction to GIS 1.Vector Geoprocessing Lecture by Austin Troy, University of Vermont.
@ 2007 Austin Troy. Geoprocessing Introduction to GIS Geoprocessing is the processing of geographic information. – Creating new polygon features through.
@ 2007 Austin Troy. Geoprocessing Introduction to GIS Geoprocessing is the processing of geographic information. Perform spatial analysis and modeling.
Rebecca Boger Earth and Environmental Sciences Brooklyn College.
Introduction to VBA. This is not Introduction to Excel We’re going to assume you have a basic level of familiarity with Excel If you don’t, or you need.
This series of slides illustrates the use of census block data refined to include only areas of likely settlement (ecumene). Dick Lycan Portland State.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Editing in ArcMap:
Working with cursors in Python GISDE Python Workshop Qiao Li.
NR 422: Topology Jim Graham Fall 2010 See: odatabase-topology.pdf.
CFT Offline Monitoring Michael Friedman. Contents Procedure  About the executable  Notes on how to run Results  What output there is and how to access.
Spatial Analysis (Vector I) Reading Assignment: Bolstad Chapter 9 (pp )
GIS2: Geo-processing and Metadata Treg Christopher.
Introduction to ArcPy. Topics What is ArcPy? Accessing geoprocessing tools using ArcPy Writing scripts using ArcPy.
HOMEWORK REVIEW This is an if else statement layout if (condition) { code to be executed if condition is true; } else { code to be executed if condition.
School of Geography FACULTY OF ENVIRONMENT Introduction to ArcToolbox and Geoprocessing.
How do we represent the world in a GIS database?
San Luis Obispo County Planning and Building Department Jeff Legato Mapping and Graphics Specialist
Copyright © 2006 by Maribeth H. Price 8-1 Chapter 8 Geoprocessing.
Lecture Materials by Austin Troy except where noted© 2008 Part 3. Regions Topology and advanced vector queries Using GIS-- Fundamentals of GIS.
Map overlays & Geoprocessing Learn about spatial analysis functions overlays, clipping & buffering Use overlays to analyze multiple spatial criteria Understand.
Query and Reasoning. Types of Queries Most GIS queries will select spatial features Query by Attribute (Select by Attribute) –Structured Query Language.
©2007 Austin Troy Lecture 7: Introduction to GIS 1.Queries and table operations for a single layer in Arc GIS 2.Intro to queries in Access Lecture by Austin.
Topology Relationships between features: Supposed to prevent:
Juanita Cano City of Sacramento Spring 2014 Geography 375.
Introduction to Geographic Information Systems Fall 2013 (INF 385T-28620) Dr. David Arctur Research Fellow, Adjunct Faculty University of Texas at Austin.
Esri UC 2014 | Technical Workshop | Editing in ArcMap: An Introduction Lisa Stanners, Phil Sanchez.
Introduction to GIS All materials by Austin Troy © 2003, except where noted Lecture 8: Site Selection and Suitability Analysis and Criterion- based mapping.
CENTENNIAL COLLEGE SCHOOL OF ENGINEERING & APPLIED SCIENCE VS 361 Introduction to GIS SPATIAL OPERATIONS COURSE NOTES 1.
Chapter 10- Map Overlays and Geoprocessing Copyright © 2015 by Maribeth H. Price 10-1.
-gSSURGO- Using the Soil Data Management Toolbox Steve Peaslee USDA-NRCS National Soil Survey Center Lincoln, Nebraska March.
Pima County’s Building Inspector Routing Apps What is the vehicle routing problem (VRP)? Organizations service orders with a fleet of vehicles. Need.
Technical Workshops | Esri International User Conference San Diego, California Branching and Iteration in ModelBuilder Shitij Mehta July 24, :15.
Outline of Script Import Modules Setup Workspace Environment and Assign Data Path Variables Summary of Script Title and Author Info.
Introduction to GIS Programming Final Project Submitted by Todd Lenkin Geography 375 Spring of 2011 American River College.
Redistricting Information Session
Chapter 13 Editing and Topology.
AP CSP: Cleaning Data & Creating Summary Tables
Tech Support Tips and Tricks: ArcGIS for Desktop
Vector Analysis Ming-Chun Lee.
Generalisation process and generalisation tools in Maanmittauslaitos
Improving Georeferencing Workflow with Python
Geography 385 Introduction to ArcGIS Web Application Design
Computer Vision Lecture 13: Image Segmentation III
Simple Sorting Algorithms
GEOG 375 Final Project Robert Abbotts Spring 2013.
Final Project: Read from a csv file and write to a database table
Error Handling Summary of the next few pages: Error Handling Cursors.
Spatial Data Processing
Introduction to Execution Plans
Coding Concepts (Basics)
GIS Lecture: Geoprocessing
Introduction to Execution Plans
Spreadsheets, Modelling & Databases
Vector Geoprocessing.
Introduction to Execution Plans
The Use of Looping Code in Map Production
Virginia Lenvik Geography 375 Spring 2013
Clip, Merge, Cluster, and Repeat
Introduction to Execution Plans
Geog 375 Individual Final Programming Project: Automated Thematic Maps
Esri Roads and Highways An Introduction
Presentation transcript:

Geography 375 Introduction to Python May 15, 2015 Merging a Million Tiny Polygons By Candy Williams Geography 375 Introduction to Python May 15, 2015

Merging a Million Tiny Polygons Maps have been developed that show 19 different types of land use for counties in California. These maps are periodically updated using NAIP data to check for changes in land use. The first step is setting up geodatabases and datasets and photo checking the county to produce a changes layer. The second step is unioning the changes layer with the county land use layer. However, in some counties this also includes layers for Williamson Act properties, zoning, and others. The third step is unioning the updated county land use layer with a USDA soil survey layer. This process can cause a large amount of sub-acre polygons or slivers (polygons less than 1 acre that are caused by unioning the new land use layer with the soil layer.) In some cases there have been as many as 1,900 sub-acre polygons.

These polygons usually look like this.

When at work this is what we do now. Run a Query for sub acre polys: “Shape_area”<4046.856422> . Then zoom to each sub acre poly and merge according to “Merging sub-acre polygons” sheet (L and G go to each other first, then G, U, S, P; P and S go to each other first; S and U go to each other first; P, S, U go to G before X).

Right now all of these sub-acre polygons have to be manually merged to an adjacent polygon by following a 3 page criteria sheet. (e.g. if Class L is adjacent to Class G, it becomes G followed by Class U, S, or P and so on). This is also where mistakes are most likely to occur. For my project I would like to try to write a script that would merge these polygons automatically. The rules for merging these sub-acre polygons is very complicated. In the script that I am going to try I will just be concentrating on keeping it simple and only merge the L’s to the G’s and selecting the sub-acre polygons to a get the value (Let’s say “L” in this case). Then select all polygons touching it and merge it to the G. Non Rural Land Counties (39 counties) Note: never merge sub-acre polygons into D or W Polygons less than 1 acre (in order) Grazing Land (G) G to G, LP, L, U, S, P, X   Local Potential (LP) LP to LP, L, G, S, P, U, X Farmland of Local Importance (L) L to L, LP, G, U, S, P, X Unique Farmland (U) U to U, S, P, L, G, LP, X Farmland of Statewide Importance (S) S to S, P, U, L, LP, G, X 6. Prime Farmland (P) P to P, S, U, L, LP, G, X 7. Other Land (X) X to X, G, LP, L, U, S, P

This is the script that I plan to try. # Name #Date #Update 1) Import modules 2) Set the workspace 3) define common variables 4) Try: Use a search cursor to search for all sub acre polygons in the layer Put it in a for loop…… For each sub acre polygon (row) in sub acre polygon list (cursor):     Selected polygons = select layer by location (row, all polygons touching the boundary)     if sub acre polygon = L :         if selected polygons = G:             merge 5) Except: Error code here 6) list help 

The first thing I did was go to ESRI website on merging polygons: http://resources.arcgis.com/en/help/main/10.2/index.html#//000800000047000000. This is what I got from the ESRI

Then I decided to try it on my own using map data from my work.

This script also had problems This script also had problems. I think there were too many variables and too much data to analyze. This is also about the time that my computer and all of my data were stolen. A good time to start over (whether I wanted to or not……) I started looking into using simpler data. If I could make it work on a basic example, then I would have a basis for expanding the tool into my mapping projects. Instead of three pages of criteria (on slides above), I decided to use A, B, C, D and 1, 2, 3, 4.

This is a shot of what the new mxd looked like The goal is to merge the small A and C triangles into the correct neighbor

After consulting the ESRI GeoNet chat room and running Nearest Neighbor, Sort, Update Cursor, Dissolve, and Append the mxd looks like this.

SUCCESS!!!!!!!!!!!!!!!! The script worked However, the process required turning the polygons into feature layers (3 were created). This process would probably take days to run through the geodatabases that I work on (10 layers and 1,900 polygons for a simple county) and the output tables would be huge. This is a start and may be developed by the department in the future.