Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ArcGIS for Desktop Cookbook

You're reading from   ArcGIS for Desktop Cookbook Over 60 hands-on recipes to help you become a more productive ArcGIS for Desktop user

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781783559503
Length 372 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Daniela C Docan Daniela C Docan
Author Profile Icon Daniela C Docan
Daniela C Docan
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Designing Geodatabase FREE CHAPTER 2. Editing Data 3. Working with CRS 4. Geoprocessing 5. Working with Symbology 6. Building Better Maps 7. Exporting Your Maps 8. Working with Geocoding and Linear Referencing 9. Working with Spatial Analyst 10. Working with 3D Analyst 11. Working with Data Interoperability Index

Creating a feature class

Features are representations of the real-word objects in a geodatabase. Features are grouped in classes based on their common components: shape (geometry) and attributes. Features from a feature class share the same spatial reference. A feature class stores simple features (for example, point, multipoint, line, and polygon) or non-simple features (for example, dimension and annotation). When a feature class is created, the user can add two optional geometry properties for features: z value (3D data) and m value (used for linear referencing). The feature class table contains some default attribute fields, which are managed by ArcGIS: OBJECTID and SHAPE. The OBJECTID field has the Object ID type property and stores the unique identifier for each feature. The SHAPE field refers to the Geometry type property and stores the x and y coordinates of the features and optionally z and m values if the feature class has the z and/or m properties enabled. The feature class that stores line or polygon features has two supplementary fields: SHAPE_Length (length of the feature line) and SHAPE_Area (area of the feature polygon).

Note

For more details about the feature class and field data types, please refer to Geodata/Data types/Feature Class and Geodata/Geodatabases/Defining the properties of data in a geodatabase/Geodatabase table properties/ArcGIS field data types from ArcGIS help (10.2) online.

Usually, feature classes are stored inside a feature dataset and automatically inherit the spatial reference of the feature dataset. A feature class that is stored at the root level of a geodatabase is a standalone feature class and has its own spatial reference.

Getting ready

You will continue to work at the geodatabase structure by creating four feature classes: Buildings (polygon features), Watercourse (polygon features), WatercourseL (polyline features), and LandUse (polygon features).

How to do it...

Follow these steps to create feature classes using the ArcCatalog context menu:

  1. Start ArcCatalog. In Catalog Tree, go to <drive>:\PacktPublishing\Data\MyGeodatabase\Topo5k.gdb.
  2. Right-click on the Buildings feature dataset, and choose New | Feature Class. For Name, type Buildings and for Alias, type Buildings. For Type, choose Polygon Feature. Leave the Geometry Properties options unchecked. Click on Next. Select Default for the Configuration Keyword section. Click on Next. There are two default attribute fields: OBJECTID and SHAPE. You will create five new attribute fields: BD (Alias=Destination), BM (Alias=Material), Stories (Alias=Number of stories), BS (Alias=State of buildings) and LandUseID. For Field Name, in the first empty cell below SHAPE, type BD, and for Data Type, select Long Integer from the drop-down list. In the Field Properties section, for the Alias, type Destination and for Allow NULL values, select Yes. Leave empty the Default Value property. You will add the default value later on in this chapter. You should see something similar to the following screenshot:
    How to do it...
  3. Repeat step 2 for BM (Default Value: 0), Stories, and LandUseID.
  4. For the BS attribute field, choose Text from the drop-down list. Notice that the Field Properties options have changed according to the data type. For Alias, type State of buildings, and for the Length property, type 4. Click on OK to close the Feature Class Properties dialog. To inspect the results, return to the Feature Class Properties dialog. Right-click on the Buildings feature class, and navigate to Properties | Fields. Notice the two geometry attribute fields: SHAPE_Length and SHAPE_Area.
  5. Right-click on the Hydrography feature dataset, and navigate to New | Feature Class. For Name, type Watercourse, and for Alias, type Watercourse. For Type, choose Polygon Feature. Leave the Geometry Properties options unchecked. Click on Next. Select Default for the Configuration Keyword section. Click on Next, and add the following attribute fields:

    Name

    Data type

    Alias

    Allow NULL values

    Default Value

    HType

    Long Integer

    Water category

    Yes

    <none>

    HYC

    Long Integer

    Hydrologic category

    Yes

    <none>

  6. Click on OK to close the Feature Class Properties dialog.
  7. Right-click on the Hydrography feature dataset, and choose New | Feature Class. For Name, type WatercourseL and for Alias, type WatercourseL. For Type, choose Line Feature. Leave the Geometry Properties options unchecked. Click on Next. Select Default for the Configuration Keyword section. Click on Next. You will add field definitions by selecting the Import button. Navigate to Topo5k.gdb | Hydrography, and select the Watercourse polygon feature class. Click on Add. You now have two attribute fields: HType (Water category), HYC (Hydrologic category), along with Name. Click on OK.
  8. Right-click on LandUse, and choose New | Feature Class. For Name, type LandUse and for Type, choose Polygon Feature. Click on Next twice, and add the following attribute fields:

    Name

    Data type

    Alias

    Allow NULL values

    Default Value

    CAT

    Long Integer

    Category

    Yes

    <none>

    SCAT

    Text with Length 5

    SubCategory

    Yes

    <none>

  9. Click on OK to close the Feature Class Properties dialog. Return to the Feature Class Properties dialog for every feature class to inspect the results.

How it works...

For every feature class, you defined different attribute fields. Because the WatercourseL feature class has the same attribute fields as Watercourse, you imported the field definitions from Watercourse at step 7. For all attribute fields, you have selected Yes for Allow NULL values. When you add a new feature in ArcMap, the attribute field will have a NULL value or an empty value that will be ignored by the functions in ArcMap. To enforce data integrity, you can specify that a field cannot contain empty or null values by setting Allow NULL values to No. This condition can be validated in the ArcMap edit session using the Validate Features option from Editor in Editor toolbar. You have another option to enforce field values by setting the Default Value property. A default value is automatically assigned to an attribute field when a new feature is being created in the ArcMap edit session.

There's more...

Regarding spatial reference of the feature class, if you want to move WatercourseL in the LandUse feature dataset, you simply select the feature class and drag and drop it into the LandUse feature dataset. You will succeed because both feature datasets have the same spatial reference. If you drag and drop the WatercourseL feature class into the root of the geodatabase, you will have a standalone feature class.

See also

  • In the following Creating subtypes recipe, you will learn how to group features in a feature class based on a subtype field
You have been reading a chapter from
ArcGIS for Desktop Cookbook
Published in: Jan 2015
Publisher:
ISBN-13: 9781783559503
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime