Select and extract a subset of features

Video

This tutorial is also available as a video.

Select by attributes

The Select by Attributes tool finds features based on a common field value. You'll use it to find all of the province polygons with an attribute value for South Africa.

  1. Download the SouthAfrica project package.

    A file named SouthAfrica.ppkx is downloaded to your computer. A .ppkx file is an ArcGIS Pro project package and may contain maps, data, and other files that you can open in ArcGIS Pro.

  2. Locate the downloaded file on your computer. Double-click SouthAfrica.ppkx to open it in ArcGIS Pro. If prompted, sign in with your ArcGIS account.
    Note:

    If you don't have access to ArcGIS Pro or an ArcGIS organizational account, see options for software access.

    A map appears, showing administrative boundaries and urban areas for the whole world.

    Map of the world

    Note:

    The data in this map is from Natural Earth.

    You'll create copies of these two map layers that contain data only for South Africa. There are a few ways to accomplish this. If this is a short-term project, you might filter features with a definition query or make a selection layer. However, for this project, you want to create copies of the data that you can edit without affecting the original data, so you will select the data you need and extract it to a new layer.

  3. On the ribbon, click the Map tab. In the Navigate group, click the Explore tool to ensure that it is active.

    The button is highlighted blue when it is active.

    Explore tool

  4. Click any of the yellow areas on the map.

    A pop-up appears. You'll read the pop-up to find if there is a field that would be appropriate for selection. You need a field that lists the country name.

  5. Scroll through the pop-up to view the feature's fields.

    The admin and geounit fields both name the country. You'll use one of these fields to select those polygons that are within South Africa.

    Admin and geounit fields in the pop-up

  6. Close the pop-up.
  7. On the ribbon, on the Map tab, in the Selection group, click Select By Attributes.

    Select By Attributes tool

  8. In the Select By Attributes window, set the following parameters:
    • For Input Rows, choose Admin boundaries.
    • For Selection type, choose New selection.
    • For Expression, use the menus to build the following expression: Where geounit is equal to South Africa.

    Select By Attributes parameters

  9. Click OK.

    The provinces of South Africa are selected on the map.

    South African provinces selected on the map

    You'll extract the selected features to their own layer.

  10. In the Contents pane, right-click the Admin Boundaries layer, point to Data, and click Export Features.

    The Export Features tool will create a layer containing only the selected features.

  11. In the Export Features pane, set the following parameters:
    • For Input Features, ensure that Admin boundaries is selected.
    • For Output Feature Class, type Provinces_SouthAfrica.

    Export Features parameters

    The new feature class will be stored in southafrica.gdb, the default geodatabase associated with this project. To choose another location, click the Browse button next to Output Feature Class.

  12. Click OK.

    A new layer appears in the Contents pane.

  13. In the Contents pane, right-click Admin boundaries and click Remove.

    Remove option in the layer's context menu

  14. Drag the Provinces_SouthAfrica layer below the Urban areas layer.
  15. On the map, zoom to South Africa.

    South Africa provinces layer on the map

Select by location

Next, you'll select and export the urban areas in South Africa. This layer has no attribute to describe which country each area belongs to, so you can't use the Select By Attributes tool. Instead, you'll use the Select By Location tool to select all of the urban areas that intersect with the South Africa provinces polygons.

  1. On the ribbon, on the Map tab, in the Selection group, click Select By Location.

    Select By Location button

  2. In the Select By Location window, for Input Features, choose Urban areas. For Relationship, choose Intersect.

    There are many options for defining a relationship between two layers. You could choose Within, since you want to select all the areas that are within the South Africa province polygons. However, there are several urban areas that cross provincial borders. These areas would not be selected by the Within relationship. They will be selected by the Intersect relationship.

    Note:

    You can read about each relations type at Select By Location graphic examples.

  3. For Selecting Features, choose Provinces_SouthAfrica.
  4. Leave the Search Distance parameter empty. For Selection type, choose New selection.

    Select By Location parameters

  5. Click OK.

    The urban areas within South Africa are selected.

    South Africa urban areas selected on the map

    Zoom and pan around the map to ensure that all of the urban areas within South Africa are selected and none of the ones outside are selected. It can be difficult to choose the correct relationship type in the Select By Location tool. A visual inspection is usually needed, and you may need to try a few relationship types before you find the best one for your situation.

    In this case, one urban area outside of South Africa is selected: Maseru is the capital and largest city of Lesotho. It is selected because its edge coincides with the national border.

    Maseru polygon selected

    Instead of reconfiguring the Select by Location parameters, you'll remove this one feature from your selection set.

  6. Right-click the map and click Select Features.

    Select Features

  7. On the keyboard, press the Ctrl key while clicking the polygon that represents Maseru.

    The urban area is no longer selected. All of the other areas remain selected.

    Maseru polygon not selected

    Tip:

    The Ctrl key allows you to manually remove features from a selection set. The Shift key allows you to add features.

    Below the map view, the Selected Features count tells you that 117 features are selected. You'll make a new layer from these selected urban areas.

    Selected Features count

  8. In the Contents pane, right-click UrbanAreas, point to Data and click Export Features.
  9. Use the Export Features tool to create a new feature class named UrbanAreas_SouthAfrica.

    Export Features parameters

    A new layer appears in the Contents pane and on the map.

  10. In the Contents pane, right-click Urban Areas and click Remove.

    You now have two layers limited to South Africa.

    Final map with exported layers

Add metadata

Next, you'll update the metadata for the two new datasets so you won't forget where they originally came from.

  1. In the Catalog pane, click the Project tab.
  2. Click the arrow next to Databases to expand this folder. Also expand southafrica.gdb.

    Expanded geodatabase in the Catalog pane

  3. Right-click Provinces_SouthAfrica and click Edit Metadata.
  4. In the Item Description view, fill out the following fields:
    • For Tags, type South Africa.
    • For Summary, type or copy and paste Provinces of South Africa, extracted from Natural Earth: https://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-1-states-provinces/.
    • For Credits, type Natural Earth.

    Metadata

  5. On the ribbon, on the Metadata tab, in the Manage Metadata group, click Save.

    Metadata Save button

    It is important to save this information now, before you forget where the data came from. You'll need the metadata later so you can properly attribute the data's sources in your map or report.

  6. Edit the metadata for UrbanAreas_SouthAfrica with the following fields:
    • For Tags, type South Africa.
    • For Summary, type or copy and paste Urban areas of South Africa, extracted from Natural Earth: https://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-urban-area/
    • For Credits, type Natural Earth.
  7. Close both metadata views.
  8. On the Quick Access Toolbar, click Save to save the project.

    Save button

In this tutorial, you selected subsets of two layers using the Select by Attributes, Select by Location, and Export Features tools. You used the Explore tool to query your data and the Select tool to refine your selection set. Finally, you saved metadata for your new datasets to ensure they can be tracked to their original source later. Exporting a subset of a dataset is a common data management skill in GIS.