Clip, Merge, Cluster, and Repeat

Slides:



Advertisements
Similar presentations
Creating Map Books ArcMap 10 Data Driven Pages
Advertisements

Why python? Automate processes Batch programming Faster Open source Easy recognition of errors Good for data management What is python? Scripting programming.
Loops – While, Do, For Repetition Statements Introduction to Arrays
Python & ModelBuilder. Overview Python/ModelBuilder Concepts – The Geoprocessor – Checking some environment variables – Providing feedback from your model/script.
Dr. Muhammed Al-Mulhem 1ICS ICS 535 Design and Implementation of Programming Languages Part 1 OpenMP -Example ICS 535 Design and Implementation.
Software Development, Programming, Testing & Implementation.
Python & ModelBuilder. Continuing Education Python and ModelBuilder Overview Python/ModelBuilder Concepts –The Geoprocessor –Checking some environment.
CC0002NI – Computer Programming Computer Programming Er. Saroj Sharan Regmi Week 7.
Preparing Data for Analysis and Analyzing Spatial Data/ Geoprocessing Class 11 GISG 110.
MATLAB® While Loops.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
Daniel Gagnon’s Final Project Number Guessing Game Widget By: Daniel Gagnon.
Open a new Flash File Action Script 2.0. Create a button like you did last lesson and name it Click to Play.
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.
L131 Assignment Operators Topics Increment and Decrement Operators Assignment Operators Debugging Tips rand( ) math library functions Reading Sections.
Prototype 3 Prototype 2 Prototype What is prototyping? Types of prototyping: – Evolutionary – Throw-away Good and Bad points to prototyping.
Scratch Programming Cards
FOP: While Loops.
Trace Tables In today’s lesson we will look at:
Development Environment
Department of Computer Engineering
CS1022 Computer Programming & Principles
Introducing Instructions
BIT116: Scripting Loops.
Improving Georeferencing Workflow with Python
Introduction To Repetition The for loop
Repetition Structures Chapter 9
Control Structures II Chapter 3
Topics Introduction to Repetition Structures
7 - Programming 7P, Q, R - Testing.
Topics Introduction to Repetition Structures
Microsoft Access Illustrated
Engineering Innovation Center
Preliminaries: -- vector, raster, shapefiles, feature classes.
Writing Functions( ) (Part 5)
Geography 375 Introduction to Python May 15, 2015
Learning to Program in Python
Decisions, repetition, Code Snippets, Comments, and Intellisense
JCL Standards #5 Company Name
File Handling Programming Guides.
Lesson 05: Iterations Topic: Introduction to Programming, Zybook Ch 4, P4E Ch 5. Slides on website.
An Introduction to VEX IQ Programming with Modkit
Communicating in Code: Commenting
File I/O in C Lecture 7 Narrator: Lecture 7: File I/O in C.
Loops CIS 40 – Introduction to Programming in Python
Introduction to TouchDevelop
Sorting … and Insertion Sort.
Assignment Operators Topics Increment and Decrement Operators
Do … Loop Until (condition is true)
Assignment Operators Topics Increment and Decrement Operators
3.1 Iteration Loops For … To … Next 18/01/2019.
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Joining an eService Class.
Joining an eService Class.
Vector Geoprocessing.
Data Structures Introduction
Ladder Diagram Design: Huffman Method
Arrays.
The Use of Looping Code in Map Production
Starter Activities GCSE Python.
Virginia Lenvik Geography 375 Spring 2013
Improving workflow at CNDDB
Assignment Operators Topics Increment and Decrement Operators
Automating Student Yield Data Extraction
Clip & Convert to ASCII Program Kelly Knapp Spring 2010
Ideal Parcels Locator Script
Geog 375 Individual Final Programming Project: Automated Thematic Maps
Presentation transcript:

Clip, Merge, Cluster, and Repeat Final project for G IS 375 Charles Morse

Purpose: Clustering is of great importance to my work in archaeology, it is the first clue of a significant region for study and important material association between object types. This script was an attempt to automate a routine analyzing and combining different layers to see which mergings produced more or less clustering while producing summary statements about the given feature classes. In so doing, I could have a python script for re-use on archaeological excavations such that the user to change the initial information and run the script immediately.

Preparation and setup The initial steps were the simple importation and setup to ensure that ‘arcpy.mapping’ was not needed before each mapping function. On the left, you will see that the code prints the day’s date and what this code was written for and when, to compare to the current date. The date code was taken from my professor Nathan Jennings’ assignment for the class this was written for.

I also set up the variables and different workspaces I also set up the variables and different workspaces. My reasoning for each is explained in the in the red text shown above.

Here, variables were given the specific names for the layers they referenced, just as the specific query and base name was given. Though each of these steps are needed for the current code, the construction that keeps this and the last slide’s code portions in mind was crucial as I wrote the script. By presenting all of these variables here, I know exactly what I would need to change to run this code in a new situation. This also shows the setup of the layer count for my clip routine and initiation of the listlayers function for my next loop.

Here, the first stage of preparing the layers begins: setting my processing extent. It employs the makefeaturelayer function when the selected layer name is the base I set up at the beginning. In one script, it makes a new layer with the desired region selected and then dissolves the lines between polygons to form a region to clip my other layers to. Somewhat awkwardly, the results of this portion do not print first as the Base variable is not selected until after a routine where the different variables and their associated layers are named.

Here, as noted above, the layers that are associated with each variable are named so the viewer can confirm that they were set correctly at the beginning of the code. Furthermore, it checks to see if the given mxd has any group layers. If not, it congratulates the viewer. If it does, it instructs to open the mxd in arcmap and ungroup.

This portion begins the clip routine This portion begins the clip routine. While I am clipping, set the output name to a variable that includes a count number. As that count increases, each layer is given the next number in its name. As a result, I have lyr_1-3 set as bases prepped for merging.

After deleting the processing extent to free the loop, each layer is merged to another while assuring that the current layer is the correct one (so layer 2 is not clipped to 3 to make layer 4 where, in succession, layers 1 and 2 should be combined to 4.

Meanwhile, layer 6 is formed through combining the first and last layer from the gdb. This is accomplished by maintaining the values from clipcount (even though clipping is no longer occurring) and by introducing other count variables like for the merge to be sure that LYR_1 and LYR_3 are combined. The result is the expected ideal, layers 1 – 6 are created in rapid succession

Now that the layers are prepared for analysis, we can begin cluster analysis. Unfortunately, I don’t have a way to save something to an incrementing number without exporting. Each fc is analyzed for clustering with the NN tool. Afterwards, each is saved to a new variable based on if it is LYR_1, 2, . . . 6.

This portion of the code is very repetitive, it calls for different summary statements based on whether the merging of tow layers increased or decreased the clustering of points in the first (or second) layer. Again, I could not find a way to loop and call for a variable as part of another variable.

At the conclusion of the code, simplified general statements are given about each layer named by their actual terms (e.g., cemeteries, conifer trees, etc) given for VAR_1, _2, and _3 at the beginning. When each statement was given as the general summary in the step before, the general statement of rising and lowering were assigned to each pt variable. This is followed by a print statements for each pt variable with a large space before each to make it more obvious in the shell.

Indiana + Illinois + Ohio + Kentucky + Michigan To be sure that this routine worked with more regions, I modified the query for different areas and it ran with slightly different results, showing increasing association and dissociation of variables defending on the area investigated. Indiana + Illinois Indiana + Illinois + Ohio + Kentucky + Michigan California + Arizona + Utah + Oregon + Nevada + Idaho