Exercise 8B: Writing Data to a Feature Class with an Insert Cursor

Similar documents
CE 549 Lab 1 - Linking Streamflow Data to a Gauging Station

8 Querying and Selecting Data

WORKING WITH.TBL FILES LIO SNIF PACKAGED DATA

Getting Started with ArcGIS Background and Introduction

In this lab, you will create two maps. One map will show two different projections of the same data.

Creating and Editing a New Shapefile

Final Project: Integrating ArcGIS Server with Google Maps Creating a Southern California Wildfire Mapping Application

Spatial Data Standards for Facilities, Infrastructure, and Environment (SDSFIE)

In this exercise, you ll create a netcdf raster layer using the variable tmin. You will change the display by selecting a different time step.

GIS LAB 1. Basic GIS Operations with ArcGIS. Calculating Stream Lengths and Watershed Areas.

Name: Date: June 27th, 2011 GIS Boot Camps For Educators Lecture_3

Geocoding Reference USA data in ArcMap 9.3

Ex. 4: Locational Editing of The BARC

University of North Dakota PeopleSoft Finance Tip Sheets. Utilizing the Query Download Feature

Mapping Tabular Data Display XY points from csv

Exercise 4: Import Tabular GPS Data and Digitizing

Step. Step 2. Step 3. Step 4 12/14/2016. Step 1: Run a Custom Query in DIMA

FME Extension for ArcGIS

Exercise One: Estimating The Home Range Of An Individual Animal Using A Minimum Convex Polygon (MCP)

COSC 490 Computational Topology

GIS Exercise 10 March 30, 2018 The USGS NCGMP09v11 tools

Viewing the Data 3 Turning Layers On / Off 4 Navigation Toolbar 5 Layout Toolbar 7 Identify Tool 8 Find Tool 10 Measure Tool 12 Go To XY Tool 14

An Introduction to Geographic Information Systems (GIS) using ArcGIS 9.2

SNS Locator Quick Start Tutorial

ArcGIS Online Lab Editable Feature Services as an outreach and user engagement tool

Geospatial Day II Introduction to ArcGIS Editor for Open Street Map

Create a personal geodatabase

Exercise 5: Import Tabular GPS Data and Digitizing

if row1.parcelid == row2.parcelid: print row.shape.area

Using Python in ArcGIS Steven Beothy May 28, 2013

Building tools with Python

George Mason University Department of Civil, Environmental and Infrastructure Engineering. Dr. Celso Ferreira

Basics of Using LiDAR Data

Exercise 1: An Overview of ArcMap and ArcCatalog

SCTE EVENT BADGE WITH QR CODE TEMPLATE

Exercise 1: Getting to know ArcGIS

hereby recognizes that Timotej Verbovsek has successfully completed the web course 3D Analysis of Surfaces and Features Using ArcGIS 10

Introducing the ArcPy Data Access module. Dave Wynne Jason Pardy

Tutorial 1 Exploring ArcGIS

1. Start ArcMap by going to the Start menu > All Programs > ArcGIS > ArcMap.

-In windows explorer navigate to your Exercise_4 folder and right-click the DEC_10_SF1_P1.csv file and choose Open With > Notepad.

Key Terms. Attribute join Target table Join table Spatial join

Working with Plan Production ObjectsChapter1:

GIS LAB 8. Raster Data Applications Watershed Delineation

Geocoding Reference USA data in ArcMap 10.1

PYTHON. Scripting for ArcGIS. writeoutput = Inputfc = ar. .ext.{) OUtpUt fc =.. Paul A. Zandbergen. axcpy random. .arcpy, Describe (' is.

Introduction to ArcGIS Desktop

Georeferencing Imagery in ArcGIS 10.3.x

Geographical Information Systems Institute. Center for Geographic Analysis, Harvard University. LAB EXERCISE 1: Basic Mapping in ArcMap

In order to follow this set of directions you will need the following

What is SQL? Toolkit for this guide. Learning SQL Using phpmyadmin

LAB EXERCISE #1 (25pts)

Using IDLE for

Answer the following general questions: 1. What happens when you right click on an icon on your desktop? When you left double click on an icon?

Steps and Strokes. Please go to the Census Bureau home page:

Data Assembly, Part II. GIS Cyberinfrastructure Module Day 4

GIS Basics for Urban Studies

Field Validation Exercise

ArcGIS 9. ArcGIS Survey Analyst Tutorial

To start Kidspiration on a Macintosh: Open the Kidspiration 3 folder and double-click the Kidspiration icon.

Downloading shapefiles and using essential ArcMap tools

Tutorial 1: Finding and Displaying Spatial Data Using ArcGIS

Lab 3: Digitizing in ArcMap

Python: Working with Feature Data. Ghislain Prince David Wynne

Basic Backward Trajectory to GIS Instructions

Personal Directory PC Utility Reference Guide

GIS BASICS. GIS Foundations 2. Kevin Kuhn & Jennifer Smith WV GIS Technical Center (

ArcGIS Server: publishing geospatial data to the web using the EEA infrastructure

How to calculate population and jobs within ½ mile radius of site

Geodatabases. Dr. Zhang SPRING 2016 GISC /03/2016

Semester 2, 2018: Lab 1

Using Python in ArcGIS Oli Helm May 2, 2013

PhotoSpread. Quick User s Manual. Stanford University

Introduction to GIS 2011

The Use of Python to Add Power and Flexibility to Data Management

Personal Directory PC Utility Reference Guide

Chapter 3 The project

Setting Up Your Working Environment

Table of Contents. 1. Prepare Data for Input. CVEN 2012 Intro Geomatics Final Project Help Using ArcGIS

Milkweed and Monarch Occurrence Excel Workbook Tool: User Guide

CRC Website and Online Book Materials Page 1 of 16

Simulates the partial equilibrium impact of a tariff reduction for a single market. Allows for analysis of trade reforms in the presence of imperfect

The Crypt Keeper Cemetery Software v.8.0. Table of Contents

Basic Tasks in ArcGIS 10.3.x

Lab 7c: Rainfall patterns and drainage density

Create CSV for Asset Import

Chapter 7. A Quick Tour of ArcGIS Pro

This will display various panes in a window.

Advanced PDF features

Geography 281 Mapmaking with GIS Project One: Exploring the ArcMap Environment

Table of Contents. Krista White GIS Support Specialist x 3926 Office HS 104 T, Th 8:00AM-12:00PM, 1:00PM-4:00PM F 8:00-11:30AM

Creating a T-Spline using a Reference Image

The New American FactFinder N E W F U N C T I O N A L I T Y B U T S O M E Q U I R K S

Feature Analysis. In this lab you will create a map of all spruce sawtimber or pole stands with an area greater than 5 hectares that are

ArcGIS. for Desktop. Tips and Shortcuts 10.1

An Introduction to MATLAB

Geocoding vs. Add XY Data using Reference USA data in ArcMap

Procedures for Farm & Field Setup within AgroDoc.NET

Connecture Platform Manager

Exercise 3: Creating a Geodatabase

Transcription:

Exercise 8B: Writing Data to a Feature Class with an Insert Cursor Insert cursors are used to insert new rows into a feature class or table. When inserting rows into a feature class you will need to know how to add the geometric representation of a feature into the feature class. This can be accomplished using an Insert cursor along with two miscellaneous objects: Array and Point. In this exercise we will add point features in the form of wildfire incidents to an empty point feature class. In addition, you will use Python file manipulation techniques to read the coordinate data from a flat file. Step 1: Explore the data file to be imported We will be importing North American wildland fire incident data from a single day in October, 2007. This data is contained in a comma delimited text file containing one line for each fire incident on that particular day. Each fire incident has a latitude, longitude coordinate pair separated by commas along with a confidence value. This data was derived by automated methods that use remote sensing data to derive the presence or absence of a wildfire. Confidence values can range from 0-100. Higher numbers represent a greater confidence that this is indeed a wildfire. Open the file at c:\geospatialtraining\gisprogramming101\exercises\data\wildfire Data\NorthAmericaWildfire_2007275.txt and examine the contents. You will notice that this is a simple comma delimited text file containing longitude and latitude values for each fire along with a confidence value. We will use Python to read the contents of this file line by line and insert new point features into the FireIncidents feature class located in the c:\geospatialtraining\gisprogramming101\exercises\data\wildfire Data\WildlandFires.mdb personal geodatabase. Close the file Step 2: Explore the feature class where the data will be written Open ArcCatalog Navigate to c:\geospatialtraining\gisprogramming101\exercises\data\wildfire Data. You should see a personal geodatabase called WildlandFires. Open this geodatabase and you will see a point feature class called FireIncidents. Right now this is an empty feature class. We will add features by reading the text file you examined in Step 1 and inserting points. Right click FireIncidents and select Properties. Click the Fields tab. The latitude/longitude values found in the file we examined in step 1 will be imported into the SHAPE field and the confidence values will be written to the CONFIDENCEVALUE field.

Step 3: Create the Python Script and create a connection to Geoprocessor Open PythonWin and create a new script. Insert comments including your name, date, and the purpose of this script. Save the script to c:\geospatialtraining\gisprogramming101\exercises\exercise8\insertwildfires. py. Import the arcgisscripting module and create an instance of arcgisscripting Create a try/except code block as follows Set the Workspace environment variable Step 4: Use Python to open the comma delimited wildfire file Open the file Read the list of fires into a list structure. Note: The variable name lstfires starts with an L not a numeric one (1) Step 5: Create the InsertCursor

Create the InsertCursor Step 6: Create a counter variable that will be used to print out the progress of the script Step 7: Loop through the file line by line and populate new rows in the feature class with the information Just below the line where you defined the counter variable, start the for loop which will be used to loop through each wildfire record in the file. You will need to make sure that everything inside the for loop is indented. Some additional explanation may be needed here. The lstfires variable contains a list of all the wildfires that were contained in the comma delimited text file. Our for loop will loop through each of these records one by one, inserting each individual record into the fire variable. Create the Point object that will hold the x,y coordinate of the fire

Using the commas in each line, split out the values into separate values. The split method can be used to create a list of values based on some type of delimiter (commas in this case). Once the list has been created you can pull out values from the list using the bracket notation you see here. Assign the x and y properties of the Point object to the longitude and latitude values you ve pulled from the file. pnt.x = longitude pnt.y = latitude Create a new row (feature) in the InsertCursor using the NewRow( ) method

Assign the Point object geometry to the shape file and also set the confidence value field to the value pulled from the file

Insert the new row to the feature class Print out the progress and update the counter

Release the lock on the feature class Step 7: Save the script and check for any syntax errors. Run the script. Step 8: Examine the feature class Open ArcCatalog or ArcMap and navigate to the FireIncidents feature class in the WildlandFires personal geodatabase stored in c:\geospatialtraining\gisprogramming101\exercises\data\wildfire Data folder. You should see approximately 410 fire incident points. Open the attribute table for the feature class and make sure that the confidencevalue field is populated. See below for figures of how your display should look.