Video
This tutorial is also available as a video.
Review the data
You have a polygon layer representing urban areas in Chile. You want the attributes to include the city's names, but you would rather not enter all of the names manually. You'll review your data to determine whether name attributes can be joined from another layer.
- Download the Chile project package.
A file named Chile.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.
- Locate the downloaded file on your computer. Double-click Chile.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 urban areas in Chile.
Note:
The data for this map is from Natural Earth.
- On the map, click one of the polygon features.
A pop-up appears, listing the feature's attributes.
The attributes do not include the urban area's name.
- In the Contents pane, check the box next to Populated Places to turn this layer on.
Points and labels appear on the map. Many of the points coincide with the polygons, but some do not. This is expected—the Populated Places layer includes regionally significant small towns and villages in addition to cities.
- On the map, click one of the point features.
The pop-up shows many attributes for the point layer, including a name field.
- Close the pop-up.
Add a spatial join
You'll join the fields from the point layer to the polygon layer.
- In the Contents pane, right-click Urban Areas, point to Joins and Relates, and click Add Spatial Join.
The Add Spatial Join window appears.
- For Target Features, ensure that Urban Areas is selected.
This is the layer that will receive the new fields.
- For Join Features, choose Populated Places.
This is the layer that will provide the new fields.
- For Match Option, choose Intersect.
This option will choose any point feature that touches a polygon feature.
Note:
You can read about each spatial matching option at Select by Location graphic examples.
- Click OK.
Review the join results
Next, you'll review the map to determine whether each city name that corresponds with an urban area was properly joined.
- On the map, click one of the urban area polygons.
The pop-up includes many new attributes, including name.
- Close the pop-up.
Instead of clicking every polygon to see whether it has a name, you'll create a selection to visually distinguish between those that have names and those that don't.
- On the ribbon, click the Map tab. In the Selection group, click Select By Attributes.
- For Input Rows, choose Urban Areas.
- For Expression, build the query Where name is null.
- Click OK.
- On the map, review the selected features.
These features have no name attribute, so they should not overlap with any point features.
There are a few selected polygons that are very close to point features.
You'd like the join to include these features, even though they do not intersect. You'll redo the spatial join with a search radius so it includes points that are not only touching, but also nearby.
- On the map, review the unselected polygon features.
These features have a name attribute, so they should overlap with a point feature. There are a few polygons that overlap with two points instead of one.
- On the map, click one of the polygons with two points.
The name field contains only one of the city names. After you redo the join, you'll manually edit the name field to include both names.
- Close the pop-up.
Redo the spatial join
There were a few problems with your initial join, so you'll try again with some different parameters. This time, instead of the Add Spatial Join tool, you'll use Spatial Join. These two tools are very similar, but the results of Add Spatial Join are temporary and can't be edited, while Spatial Join produces a permanent and editable output layer. You'll use the Spatial Join tool because you need to be able to edit the name field afterward.
- On the ribbon, in the Selection group, click Clear.
The results of the Add Spatial Join tool are temporary and can be easily undone.
- In the Contents pane, right-click Urban Areas, point to Joins and Relates, and click Remove All Joins.
- In the Remove Joins window, click Yes.
All of the joined fields are no longer present in the Urban Areas layer.
Note:
To make the results of the Add Spatial Join tool permanent, right-click the layer, point to Data, and click Export Features.
Next, you'll open the Spatial Join geoprocessing tool.
- Above the ribbon, click Command Search and type spatial join.
- In the search results, click Spatial Join (Analysis Tools).
The Geoprocessing pane appears with the Spatial Join tool parameters. They are almost the same as the Add Spatial Join parameters.
- For Target Features, choose Urban Areas. For Join Features, choose Populated Places.
Unlike Add Spatial Join, the Spatial Join tool creates a new output layer, which requires a new name.
- For Output Feature Class, delete the existing text and type UrbanAreasNamed.
- For Join Operation, choose Join one to one.
The other option, Join one to many, will create duplicate polygon features for urban areas that overlap with more than one point.
- Check Keep All Target Features.
- For Match Option, choose Intersect
- For Search Radius, type 2.5 and choose Kilometers.
The tool will join fields from any point that is within 2.5 kilometers of a polygon. This should be enough distance to catch those points that are near polygons.
- Expand the Fields section.
Before, you joined all fields from the Populated Places layer. However, this layer has many fields, and the only one you need to include in the join is name. You'll use the Field Map to determine which fields come from the Populated Places layer and remove all but the name field.
- Under the Fields list, click Edit.
The Field Properties window appears with information about each field and their sources.
- Under Fields, click Shape_Area.
Under Source, the Urban Areas field is listed as the source of the Shape_Area field.
All of the fields above Shape_Area also come from the Urban Areas layer. You'll keep all of these fields.
- Under Fields, click scalerank_1.
Under Source, the Populated Places layer is listed as this field's source. All of the fields below it also come from the Populated Places layer.
You'll remove all of them except for name.
- Under Fields, point to scalerank_1 and click the Remove button.
- Remove all of the fields below Shape_Area except for the name field. Hold the Shift key to select multiple fields at once.
Note:
To learn more about field maps, try the tutorial Merge multiple layers into one.
- Click OK to close the Field Properties window and clickRun.
When the tool completes, a new layer, named UrbanAreasNamed, appears on the map.
- In the Contents pane, turn off the Urban Areas layer.
- On the map, zoom to one of the urban areas that is near, but not touching a point. Click the polygon and confirm that the pop-up contains a name attribute.
- Close the pop-up.
Edit the new layer
Now that you have created a new layer with a joined name field, you can edit it to include extra city names. You'll use the Select By Attributes tool and the Attributes pane to update the larger urban areas.
- On the ribbon, click the Map tab. In the Selection group, click Select By Attributes.
You'll select all polygons that overlap with more than one point.
- For Input Rows, choose UrbanAreasNamed.
- For Expression, build the query Where Join_Count is greater than 1.
The Join_Count field was created by the Spatial Join tool.
- Click OK.
- On the ribbon, in the Selection group, click Attributes.
The Attributes pane appears. The upper half of the pane lists all of the selected features. The lower half lists the attributes for one of the selected features.
- In the upper half of the Attributes pane, right-click Coquimbo and click Zoom To.
The map zooms to the selected feature. This area covers two cities: Coquimbo and La Serena.
- In the lower half of the Attributes pane, in the name row, click Coquimbo and type Coquimbo, La Serena.
- Check the Auto Apply check box.
- Zoom to each of the selected features and update their name attributes with the following text:
- Santiago, San Bernardo
- Talcahuano, Concepción
- Viña del Mar, Valparaíso
Finally, you will save the edits.
- On the ribbon, click the Edit tab.
- In the Selection group, click Clear. In the Manage Edits group, click Save.
- In the Save Edits window, click Yes.
- On the Quick Access Toolbar, click Save.
In this tutorial, you joined an attribute from one layer to another. The join was determined by a spatial relationship between the two layers, rather than by a common field. You learned how to add and remove joins, the difference between the Add Spatial Join and Spatial Join tools, how to use Select By Attributes to review the results of a join, and how to edit features in the Attributes pane.