Creating and Editing Vector data - Texas A&M...

15
Creating and Editing Features and Tabular Data Prepared by Francisco Olivera, PhD, Srikanth Koka. Department of Civil Engineering Texas A&M University March 2004 Contents 1. Brief Overview 2. Goals of the Exercise 3. Computer and Data Requirements 4. Procedure 1. Creating and Editing Feature data a. Creating point shapefile, adding features and editing b. Creating point shapefile using X and Y coordinates c. Creating a line shapefile, adding features and editing lines d. Creating a polygon shapefile, adding features and editing polygons 2. Creating and Editing Tabular data a. Creating a dbase table and a personal geodatabase table b. Editing tabular data Goals of the Exercise To introduce you to following Creating shapefiles and adding features to them Editing already existing features Creating tables and adding fields and rows to them Editing already existing tabular data Computer and Data Requirements To carry out this exercise, you need to have a computer which runs ArcGIS 8.3. You will be working with the following spatial datasets during this exercise Streams.shp TXCountyInfo.dbf USGSGageStns.dbf Procedure 1. Creating and Editing Feature data

Transcript of Creating and Editing Vector data - Texas A&M...

Page 1: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

Creating and Editing Features and Tabular Data

Prepared by Francisco Olivera, PhD, Srikanth Koka. Department of Civil Engineering

Texas A&M University March 2004

Contents 1. Brief Overview 2. Goals of the Exercise 3. Computer and Data Requirements 4. Procedure

1. Creating and Editing Feature data a. Creating point shapefile, adding features and editing b. Creating point shapefile using X and Y coordinates c. Creating a line shapefile, adding features and editing lines d. Creating a polygon shapefile, adding features and editing polygons

2. Creating and Editing Tabular data a. Creating a dbase table and a personal geodatabase table b. Editing tabular data

Goals of the Exercise To introduce you to following

• Creating shapefiles and adding features to them • Editing already existing features • Creating tables and adding fields and rows to them • Editing already existing tabular data

Computer and Data Requirements To carry out this exercise, you need to have a computer which runs ArcGIS 8.3. You will be working with the following spatial datasets during this exercise Streams.shp TXCountyInfo.dbf USGSGageStns.dbf

Procedure 1. Creating and Editing Feature data

Page 2: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

In this part of the exercise you are going to create shapefiles, add new features (i.e. points, lines and polygons). You will learn how to start editing, how to sketch from the sketch tool, how to snap features, how to change the shapes of the features. Before starting this exercise, create a working folder and name it as ‘EditData’. You will be using this folder to store the results obtained during the execution of this exercise. Creating point shapefile and adding features to it You will now be creating a point shapefile and you are going to add features to it. So open ArcCatalog from Windows Start menu. Browse down to your working folder, right click on it, then click on New/Shapefile. In the wizard that pops up, enter NewPt for Name, make sure that point is chosen for Feature Type, and click OK.

You will add some points in this shapefile. In order to do this, you will have to add the shapefile you have created to an ArcMap document. ArcMap can be opened using Windows Start menu. Once the ArcMap document is opened, add NewPt shapefile, using Add Data tool. To start adding point features to this shapefile, you should start editing. Before starting an edit session, make sure that the Editor toolbar extension is activated. If it is not activated, click on Tools/Customize , and under Toolbars tab, select Editor in the list given in the box named Toolbars . You can observe that the editor toolbar is added to the document. To start editing, click on Editor/Start Editing. You will see that the tools and dropdowns get activated and also see that Create New Feature is selected for Task and NewPt is the Target Layer. You will add features to this shapefile using the Sketch tool. So, click on the Sketch tool and the start clicking on the map display, where ever you want. Once you have finished

Page 3: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

adding features, the next step is to save the edits. To do this, click on Editor/Save Edits. Note that, as you are going to move some points from the places they were created, you will just save what ever you did till now. To stop editing completely, you will have had to click Editor/Stop Editing.

So as to move points from their positions, you will start editing again using Editor/Start Editing and then you have to change the task type from ‘Create New Feature’ to ‘Modify tasks’ for Type . Observe that the Sketch is disabled now. To move a point, click on the point, see that the cursor changes and drag it to where ever you want. Repeat this procedure for a couple of points. Once you have moved points, stop editing by clicking on Editor/Stop Editing. Save Edits if asked to do so.

Creating point shapefile using X and Y coordinates

Page 4: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

When X and Y coordinates of points are given, creation of a dataset containing the corresponding features can be automated using Add XY data tool. Open a ArcMap, document using Windows Start menu. Using Add Data tool, add USGSGageStns.dbf to the map. This dbf file contains latitude and longitude information for all USGS gauging stations. Other information included is station name, station number, website URL for the stations and HUC ID. You can observe this information by opening the table by right clicking on the table and then clicking Open. You will use the latitude and longitude fields to create a new shapefile that will contain corresponding USGS gauging stations as points. To do this, click Tools/Add XY Data. In the wizard that pops up, you will see that USGSGageStns is already selected for Choose table from map or browse from another table, LONDD for X Field and LATDD for Y Field. Click OK, which will create a temporary shapefile named USGSGageStnsEvents, which needs to be made permanent.

In order to make the shapefile permanent, right click on the new layer and then click Data/Export. Using the default options Click on the folder icon located for Output shapefile or feature class, browse to the working folder, enter a name, click Save and click OK to export the temporary shapefile. A message pops up asking you if the new shapefile needs to be added to the view or not. Click Yes.

Page 5: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

Creating line shapefile and adding features CREATING LINE SHAPEFILE You will now be creating a line shapefile and you are going to add features to it. Using ArcCatalog, browse down to your working folder, right click on it, and then click on New/Shapefile. In the wizard that pops up, enter NewLine for Name, make sure that Polyline is chosen for Feature Type, and click OK. DRAWING LINES You will now add lines to this shapefile. In order to do this, you will have to add the shapefile you have created to an ArcMap document. Open a new ArcMap document using Windows Start menu. Once the ArcMap document is opened, add NewLine shapefile as a layer, using Add Data tool. To start drawing lines in this layer, you should start editing. Before starting an edit session, make sure that the Editor toolbar extension is activated. If it is not activated, click on Tools/Customize, and under Toolbars tab, select Editor in the list given in the box named Toolbars. You can observe that the editor toolbar is added to the document. To start editing, click on Editor/Start Editing. You will see that the tools and dropdowns get activated and also see that Create New Feature is selected for Task. Features can be drawn in this layer using the Sketch tool. So, click on the Sketch tool and the draw a line as shown in the figure below, on the map display. Once you have finished, the next step is to save the edits. To do this, click on Editor/Save Edits. Note that, as you are going to do some editing to this layer, you will save the edits rather than stopping editing. Remember that the line layer has only one line feature up to this point.

Page 6: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

SPLITTING LINES The next step would be to split the lone feature in your layer into two features. [You can split the feature manually (do not perform this now, but test it later as you are going to do this automatically) by first selecting the feature using Edit tool, then clicking on Split tool located on the Editor Toolbar and finally clicking on the line where ever you want to split it]. The automatic way of splitting is by specifying the split distance as a length or as a percentage. To do this, first select the feature using Edit tool, and then click Editor/Split. A form opens up, in which, choose Percentage of the line length as the option for Split, enter 50 in the text box. Let forward be selected for Orientation and click OK. Finally to save the edits, click on Editor/Save Edits. Once this is done, the feature you have selected would be split into two new features. You would not be able to see the features split clearly on the map, but you can see that in the attribute table the number rows have increased to two. Open the attribute table and select the two rows separately and observe the corresponding features being selected on the map. Do not stop editing yet, because you are going to do more editing operations. If you have stopped editing, start editing by clicking on Editor/Start Editing.

Page 7: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

MERGING LINES The next step would be to merge the lines you have split, into one feature. You can merge features using merge tool. To do this, first select the features to be merged using Edit tool by pressing shift, and then click on Editor/Merge. You can now stop editing by clicking on Editor/Stop Editing. Once this is done, the two features you have selected would be merged into one feature. You would not be able to see the features merged clearly on the map, but you can see that the number of rows in attribute table will be decreased to one from two. Open the attribute table and select the lone row and observe the corresponding feature being selected on the map.

Page 8: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

Another similar tool is the Union tool, which merges the features, instead of replacing them, creates a new feature. The newly created feature will coincide with the features that were involved in union. Though you may skip union for this exercise, you can do it by selecting the features first, then clicking on Editor/Union. SNAPPING LINES Snapping is used to move a feature to a precise location in relation to another feature. In this part of the exercise, you are going to move a line such that its end (To-node) coincides with start of another line (i.e. From-node). For this exercise, you are going to use the stream network of Bull creek watershed, located near Austin, Texas. In a stream network, all lines are connected. In this shapefile, it has been observed that a line (bearing attribute value of FID=17) is disconnected from the network, which you will connect to its downstream line. Open a new ArcMap document using Windows Start menu. To the data frame in this document, add the Streams.shp as a layer using Add Data tool. To see each line with a different color, change the layer’s symbology to Unique values. To do this, right click on the streams layer, in the drop down menu, click on Properties. The Properties wizard opens up. In this wizard, change to Symbology tab, in the Show list box, click Categories/Unique values, click on Add All Values button and finally click OK to change the symbology.

Page 9: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

Now open the attribute table of this layer by right clicking on the layer and then clicking Open Attribute Table in the drop down menu. Move down in the table, until you see the row containing value of 17 in the FID field. Select this feature to see where it is located and zoom into junction where this line meets the next line, which is downstream to it using Zoom In tool. If you zoom in enough you will see that this line is not connected to the network. In order to correct this error, you can just move the line towards the downstream line, but they may not coincide exactly at the junction. To move the line perfectly, you have to use snapping. So, start editing by clicking on Editor/Start Editing. Next you will set snapping environment. To do this, click Editor/Snapping for the Snapping form to show up. In this form, insert a check mark for End (see the first image below).Close the Snapping Environment. Now using the Edit tool, double click on the line so that the vertices are visible (see the second image below). Observe that the vertex in red color is the To-node of the line. Now drag this to-node towards the junction (see the third image below).

Page 10: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating
Page 11: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

Once you have done this, you can and save and stop editing, by clicking on Editor/Stop Editing. You can zoom closer to see that they have been perfectly connected. Creating polygon shapefile and adding features CREATING POLYGON SHAPEFILE You will now be creating a polygon shapefile and you are going to add features to it. Using ArcCatalog, browse down to your working folder, right click on it, and then click on New/Shapefile. In the wizard that pops up, enter NewPGon for Name, make sure that Polygon is chosen for Feature Type, and click OK. DRAWING POLYGONS You will now draw polygon in this shapefile. In order to do this, you will have to add the shapefile you have created to an ArcMap document. Open a new ArcMap document using Windows Start menu. Once the ArcMap document is opened, add NewPGon shapefile as a layer, using Add Data tool. To start drawing lines in this layer, you should start editing. Before starting an edit session, make sure that the Editor toolbar extension is activated. If it is not activated, click on Tools/Customize, and under Toolbars tab, select Editor from the list given in the box named Toolbars. You can now observe that the editor toolbar is added to the document. To start editing, click on Editor/Start Editing. You will see that the tools and dropdowns get activated and also see that Create New Feature is automatically selected for Task. Features can be drawn in this layer using the Sketch tool. So, click on the Sketch tool and the draw 3 to 4 polygons of any shape in the map display. Once you have finished, the

Page 12: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

next step is to save the edits. To do this, click on Editor/Save Edits. Note that, as you are going to do some editing to this layer, you will save the edits, rather than stopping editing.

CUT POLYGONS The next step would be to cut a polygon into two. To do this, first select the feature you want to cut using Edit tool. Next, change the Task on the editor toolbar to Cut polygons features. Click on the Sketch tool, and then draw a line across the polygon as shown in the figure below. To save these edits, click on Editor/Stop Editing. You can now see that the polygon feature is cut into 2 polygons. In the next part of the exercise you will merge back these two features into one feature again

Page 13: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

MERGING POLYGONS You can merge the polygon features using merge tool. Before going into merging polygons make sure that no features are selected, if some of them are, then clear selection by clicking on Selection/Clear selected features. Then select the two features that resulted due to cut polygon operation previously, using Edit tool by pressing shift, and then click on Editor/Merge. You can now stop editing by clicking on Editor/Stop Editing. Once this is done, the two features you have selected would be merged into one feature. Another similar tool is the Union tool, which merges the features and then instead of replacing them, creates a new feature. The newly created feature will coincide with the features that were involved in union. Though you may skip union for this exercise, you can do it by selecting the features first, then clicking on Editor/Union. 2. Creating and Editing Tabular data a. Creating a dbase table and a personal geodatabase table In this part of the exercise you are going to create a dbase table and add a field and add a row to it. To create a table, right click on the folder, then click New/dBase table. Change the name of the table from the default to ‘NewTab’. You will observe that the table has two fields, one by the name OID and the other by the name Field1. You will now add a new field to this table. To do this, in the lower part of the table, click Options/Add Field. In the wizard that pops up, enter ‘NewFld’ as Name, Long Integer as Type: and then click OK to finally finish adding a field. To add rows to this table you will have to start editing, which is going to be the next part of the exercise.

Page 14: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating

b. Editing tabular data In this part of the exercise you are going to correct a field values, add a field and use map calculator to populate it. Now add the table named TXCountyInfo.dbf to the table using Add Data tool. If the table name is not visible in the table of contents, change the view from Display to Source. Once the table is made visible, right click on it and click Open to open the table. In this table you will see these fields: OID, NAME, POPULATION, AREA_SQ_MI. These fields are self explanatory by the names. In the table, there is a row in which the value ‘ARMSTRONG’ is wrongly spelt as ‘AMSTRONG’ for NAME field. You are now going change the corresponding row value. First of all arrange the entries of the NAME field in ascending order by right clicking on the NAME field and then clicking on Sort Ascending in the drop down. Scroll down the table until you find AMSTRONG in one of the rows for NAME fields and start editing by clicking Editor/Start Editing.. Now click on the AMSTRONG, delete and type ARMSTRONG. Once you have done this stop editing by clicking on Editor/Stop Editing. In the message box, click yes for Do you want to save changes.

You will now add a new field to this table and populate with population density using the population and area values given in the other fields. To add a new field, at the bottom of the table, click on Options/Add Field. In the wizard that opens up, enter POP_DENS for Name, select Float for Type and click OK. To populate this field with population density values, right click on this new field name, and then click on Calculate values. In the message box that pops up, click Yes. Now the Field Calculator wizard opens up. In the wizard, click in the text box so that the cursor lies inside it, click on POPULATION in the Field text box, click ‘/’ sign, click on AREA_SQ_MI in the Field text box ,Use all other default options and then finally click OK to populate the population density field.

Page 15: Creating and Editing Vector data - Texas A&M Universityceprofs.tamu.edu/folivera/GIS-CE/ArcGISMaterials... · c. Creating a line shapefile, adding features and editing lines d. Creating