
Editing features in a geodatabase
In ArcMap, a layer references the spatial datasets (for example, feature class and raster) that contain features with common geometry and attributes. A layer uses the dataset attributes to represent the features by one or more symbols. By default, a layer symbolizes features from a feature class using the subtype field.
The editing session in ArcGIS for Desktop is based on layers. When you start an edit session, you have to define the Feature Template that describes the type of feature that you intend to create. ArcGIS creates feature templates by default, based on the layer symbology. In the Creating Feature window, you can see the list of feature templates. You can create new types of features with the Organize Feature Templates option. Moreover, you can define a default attribute for one type of feature or for all types of features from a layer. When you create a new feature, the default attribute is automatically inherited. Choosing a default value works for subtypes and domains, too.
After you create a feature, you should edit its attributes using the Attribute window. Most of the attribute fields will automatically get completed according to the default subtype and domains you already defined in the Using subtypes and domains together recipe of Chapter 1, Designing Geodatabase.
Getting ready
In Chapter 1, Designing Geodatabase, you learned how to create the Topo5k.gdb
file geodatabase schema. Now, it's time to add data. There are several ways to add data into a geodatabase:
- Using the Import/Export and Load Data options in ArcCatalog
- Using the Load Objects option in an ArcMap environment
- Creating new features by screen digitizing and by editing existing ones
- Using the Export Data option in an ArcMap environment
In this recipe, you will work with the Editor, Snapping, and Edit Vertices toolbars to create new features and to edit the existing features. The LandUse
and BuildingsR
feature classes already contain features. The features were digitized based on a scanned topographic map at scale 1:5,000
produced in 1995.
As a base layer for updating features, you will use an orthophotography from 2012 corresponding to a map at scale 1:5,000
. The orthophoto map has a resolution of 1 pixel =0.5 meter and is stored as Raster Dataset in the Topo5k.gdb
geodatabase.
Even if you assume that you are already comfortable with the elementary edit process in ArcGIS 10, please remember the main steps:
- Start the edit session.
- Set the snap environment (optional).
- Before starting a sketch, choose a feature template and a construction tool.
- Create the new feature.
- Add or modify attribute values of the feature.
- Save edits.
- Stop the edit session.
How to do it...
You can follow these steps to edit features in a geodatabase:
- Start ArcMap, and open an existing map document
Editing.mxd
from<drive>:\PacktPublishing\Data\EditingData
. Notice that layers from the Table Of Contents section are symbolized based on their subtypes. TheLandUse
layer has defined a transparency. Right-click on theLandUse
layer, and navigate to Properties | Display. You will notice that Transparent has a60
percent value. Let's add a pop-up label with the OBJECTID value in the data view. Check Show MapTips using the display expression, and choose the desired field. Click on OK. - From the Bookmarks menu, select Create a Fish Pond. You will create a new feature in the
LandUse
layer, as shown in the following screenshot: - In the Table Of Contents section, right-click on the
LandUse
layer, and navigate to Edit Features | Start Editing. In the Editor toolbar, navigate to Editor | Editing Windows. In the Create Feature window, you will see the feature templates for all layers that are visible in the Table Of Contents section. - In the Editor toolbar, navigate to Editor | Snapping, and check the Snapping toolbar. In the Snapping toolbar, select only Vertex Snapping. Snapping options assure the coincidence of new feature coordinates with the coordinates of existing features.
- In the Editor toolbar, navigate to Editor | Options | Attributes. Navigate to Display the attributes dialog before storing new features | For the following layers options | LandUse. Click on OK. Every time you create a new
LandUse
feature, the Attribute window will show up after you have finished the sketch. - Select the feature with OBJECTID as
755
from theLandUse
layer. In the Editor toolbar, select the Cut Polygons Tool option to cut the arable polygon. - Select the Trace tool. Right-click on the polygon, and select Trace Options. In the Trace Options dialog, type
5
as the Offset value, select the Trace selected features option, and click on OK. - Use the screenshot from step 2 to follow the edit steps. Start the sketch from point (1) and finish it at point (2). Right-click on point (2) to choose a value for the Length field, type in
84
, and close the window. Move the segment towards point (3), and add the end of the curve to point (4). - Again, go to point (2), and right-click on it to choose a value for the Length field, type in
61
, and close the window. Move the segment to point (5), and add the last vertex to point (6). To finish the sketch, use the F2 shortcut key.Next, you will edit the attribute fields for the new polygon feature, as shown in the following screenshot:
- In the Attributes window that automatically opens, select the new
LandUse
feature you just created. The default value for Category (CAT) and SubCategory (SCAT) isArable
. You defined the default values in the Using subtypes and domains together recipe of Chapter 1, Designing Geodatabase. - Let's change the attribute values. Select the Category field, and click on the small button from the right to open the Choose Symbol Class window. Select the
Hydrography
value, and click on OK. For the SubCategory field, select theFish pond
value from the drop-down list. For LandUseID, type the value of OBJECTID. Click on OK to close the window. - Return to the Attribute window, and expand the nodes for the
Fish Pond
feature to see the relationships. The newLandUse
feature is related to theBuildingsR
layer (BuildingsR-ToBuildingsR
) andOwners
table (Owners-ToOwners
). Select theOwners-ToOwners
relationship to define the owners of the parcel. - Right-click and navigate to Table | Open Attribute Table. In the
Owners
table, select the owner withNameOwners
asOwner1
. At this point, open the attribute tables for theLandUse
andBuildingsR
feature classes and for theLandUseToOwners
relationship. To seeLandUseToOwners
andBuildingsRToOwners
relationship tables and theOwners
nonspatial table, click on the List By Source button in the Table Of Contents section. - Return to the Attribute window, and right-click on the
LandUse
feature relationship:Owners-ToOwners
. Select Add Selected. Now, your parcel has an owner with OBJECTID as1
.You should check the relationship class table named
LandUseToOwners
; it stores the relationship betweenFish Pond
andOwner1
. - In the Table window, select the
LandUseToOwners
table to check the changes. Edit the OwnerProcent attribute field with its value as100
. Select and inspect theOwners
table. To see how many parcels and buildings own theOwner1
table, click on the Related Tables button, and choose the two relationships one by one:LandUseToOwners:ToLandUse
andBuildingsRToOwners:ToBuildingsR
.Next, you will create a new parcel and modify two vertices of a dwelling. In the following screenshot, you have all elements to create a new parcel by splitting the arable polygon:
- Click on Bookmarks, and select Cut a Parcel and modify a Building.
- Select the parcel with OBJECTID as
755
from theLandUse
layer. - First, go to the Snapping toolbox and keep only the Vertex Snapping option selected.
- Second, select the Cut Polygons Tool option. Start the sketch from point (1) and select the Distance-Distance tool. Click on point (1) as a center for the first circle, and press the D key to type
77
for Distance. Click on point (2) as a second center, and press the D key to type139
for Distance. You have obtained a point as an intersection of two circles. Click on the first intersection to obtain the second vertex of the cutting polyline. - Again, select the Distance-Distance tool. Click on point (2) as a center for the first circle, and press the D key to type
128
for Distance. Click on point (3) as a second center, and press the D key to type135
for Distance. Click on the second intersection to obtain the third vertex of the cutting polyline. - Select Straight Segment, and click on point (2). To finish the cutting sketch, press the F2 shortcut key.
- In the Attributes window, select the following values: Category as
Other terrains
, SubCategory asBuilt-up area
, and for LandUseID, type the value of OBJECTID. Click on OK. - The new
LandUse
feature is related with theBuildingsR
layer (BuildingsR-ToBuildingsR
) and theOwners
table (Owners-ToOwners
). Try to manage those relationships by yourself. How to start? Firstly, with Shift pressed, select the building with the Select Features tool. Secondly, selectBuildingsR-ToBuildingsR
, and right-click on it to choose the Add Selected option.Next, you will correct the position of two vertices of the building according to the orthophoto map used as a background:
- Keep the building selected and with the Shift key pressed, unselect the parcel. Click on Edit Vertices, and from the toolbar, choose Modify Sketch Vertices. Select the two vertices by drawing a small box around the vertices. Drag the selected segment, and drop it as shown in the preceding screenshot.
Finally, you will correct a neighboring
LandUse
parcel. You have two options, as shown in the following screenshot: - Use the Reshape Feature Tool option to draw a line as point (1) from the preceding screenshot in order to cut the polygon with OBJECTID as
755
from theLandUse
layer. You have created a gap between the parcels. To modify the parcel from the left-hand side, select the Other Terrains option with the Auto Complete Polygon construction tool from the Create Feature window. Put the first vertex in the gap and the second in the neighboring parcel—see point (2). With the Select Features tool, select both the parcels, and from the Editor toolbar, select Merge. In the Merge dialog, select Build-up area (LandUse), and click on OK. - Use the Cut Polygons Tool option to split the polygon. With the Select Features tool, select the two parcels from point (3). From the Editor toolbar, select Merge. In the Merge dialog, select Build-up area (LandUse), and click on OK.
- In the Editor toolbar, navigate to Editor | Stop Editing, and save your edit. Navigate to File | Save As, and save your map as
MyEditing.mxd
.
You can find the final results at <drive>:\PacktPublishing\Data\EditingData\ MyEditingResults\Editing.mxd
.
How it works...
To select an existing parcel from the LandUse
layer, and in order to edit it, first use the Select Features tool, and after that, select the specific edit tools from the Editor toolbar. If you use an Edit tool to select a feature, there is always a risk that you will create a subtle movement of the selected feature. A small shift will create overlaps and gaps between the coincident features. To protect features from this small shift, navigate to Editor | Options | General | Sticky move tolerance, and set a minimum distance for cursor movement before the selected feature will be moved too.
At step 23, we tested the multiple vertex editing. We have selected two vertices and moved them at once.
In the Creating a relationship class recipe of Chapter 1, Designing Geodatabase, we created relationship rules between the LandUse
, BuildingsR
, and Owners
tables. We have already noticed at step 12 that relationships are active and must be updated every time we add new features. The relationship rules can be validated during the edit session. Select all features from BuildingsR
and LandUse
using the Select Features tool. In the Editor toolbar, navigate to Editor | Validate Features. A message box will appear stating 72 features are invalid. Click on OK to close. All invalid features are selected. In the Attributes window, inspect and try to correct the errors yourself.
There's more...
To add more data to your geodatabase schema, we will test two more options: Load Data using ArcCatalog and Load Objects in the ArcMap environment. Follow these steps to add the data in the geodatabase file using Load data:
- Start ArcMap, and open the existing
Editing.mxd
map document from<drive>:\PacktPublishing\Data\EditingData
. - Open the Catalog window from the Standard toolbar to have access to your data. In the Catalog window, right-click on
WatercourseL
from...\EditingData\Topo5k.gdb
, and navigate to Load | Load Data. Set the following parameters from panels:- The Input data parameter as the
...\Data\TOPO5000.gdb\Hydrography\ WatercourseL
feature class; click on Add - Check I do not want to load all features into a subtype
- Target Field (destination) and Matching Source Field (source):
HYC[int] = HIC[int] Name[string] = Name[string] HType[int] = HAT[int]
- Check Load all of the source data
- The Input data parameter as the
- Click on Next and Finish. In the Table Of Contents section, right-click on
WatercourseL
, and choose Zoom To Layer to see the polyline features.Continue to follow the steps to populate the
Watercourse
feature class with features from the LandUse feature class using Load Objects in ArcMap. - To add the Load Objects tool, click on the drop-down arrow from the right-hand side of the Editor toolbar, and select Customize. Select Commands, and for Show commands containing, type
load objects
. From Commands, click and drag the Load Objects option to the Editor toolbar. Click on Close. To use this tool, you need to start the editing session. - Before starting an edit session, in the Table Of Contents section, right-click on
Watercourse
, and navigate to Edit Features | Organize Feature Templates. You will define a default value for the Name field. All the new features fromWatercourse
that you add in this edit session will have the Name field asRiver Flake
. In the Organize Feature Templates window, selectWatercourse
from the Layers section. With the Ctrl key pressed, select the River and Stream templates. Click on Properties, and for Water Name, typeRiver Flake
. Click on OK and then on Close. - Start the edit session from the Editor toolbar by navigating to Editor | Start Editing.
- In the Table Of Contents section, right-click on
Watercourse
, and select Load Objects. Set the following parameters from panels:- The Input Data parameter as the
...\Data\EditingData\Topo5k.gdb\LandUse\LandUse
feature class; click on Add - The Target field as the
Stream
subtype - Accept the default matching Target Field (destination) and Matching Source (source)
- Check Load only the features that satisfy a query
- Click on Query Builder and build the following expression:
CAT=31
- Accept all the other default parameters
- The Input Data parameter as the
- Click on Finish. In the Table Of Contents section, right-click on
Watercourse
, and choose Zoom To Layer. - Select all vectors using the Select Features tool from the Tools toolbar and open the Attributes window. All nine
Stream
features have the same attribute value for the HYC field asIntermittent
. This is because in the Using subtypes and domains together recipe of Chapter 1, Designing Geodatabase, we have assigned the domain code 2 (Intermittent
) as the default value of the HYC field for theStream
subtype features.
Let's suppose that we mistakenly chose to load all objects in the Stream subtype. To change the subtype value to River
for all the nine features at the same time, select the Watercourse
layer in the Attributes window. Click on the icon from the left Stream
value to open the Choose Symbol Class window. Select the River
value, and click on OK. Read carefully the warning message, and select Yes to automatically assign the corresponding Perennial
default values for HYC. The Name field already has the River Flake
value. Notice that every feature has the same HType and HYC and the Name value. In the Editor toolbar, navigate to Editor | Stop Editing, and save your edit. Navigate to File | Save As, and save your map as Editing.mxd
. You can find the final results in <drive>:\PacktPublishing\Data\EditingData\ MyEditingResults\Topo5k.gdb
.
Recall that you constrained the attribute values by subtypes and domains in Chapter 1, Designing Geodatabase. Every time you load features from other sources, such as existing feature classes or shapefiles, don't forget to validate the attribute values during the edit session. The Validate Features option will identify all the invalid values for the attribute fields for which you have already defined the subtypes and domains. All features that have invalid values will be selected. You should inspect and correct the reported errors with the Attributes window.