Summary
Determining the direction where a polygon faces in relation to another feature is important for navigation and geographical orientation, such as the direction where a building faces in relation to a road helps identify the building's orientation on a map.
This article highlights the workflow on how to calculate the direction where a polygon faces in relation to another feature in ArcGIS Pro.
Procedure
- Use the Near tool to identify the angle of the nearest feature to the polygon.
- In ArcGIS Pro, on the ribbon, click Analysis > Tools.
- In the Geoprocessing pane, search for and click the Near tool.
- In the Near pane, on the Parameters tab, select the polygon layer for Input Features. This example uses ‘house’.
- Select the second feature for Near Features. This example uses the line feature, ‘roads’.
- Check the Angle check box.
- For Distance Unit, select an appropriate unit of measurement.
- Click Run.
- Open the attribute table of the polygon feature layer. Refer to ArcGIS Pro: Add and open a stand-alone or attribute table from a map or scene for instructions.
- Add a new text field to the attribute table. Refer to ArcGIS Pro: Add Field (Data Management) for more information. In this example, the field is named ‘Proximity’.
- Run the Calculate Field tool on the newly created field.
- Select a feature layer for Input Table. This example uses ‘house’.
- For Field Name (Existing or New), select the new field created in Step 3. In this example, ‘Proximity’ field is selected.
- Select Python for Expression Type.
- In the Expression parameter, insert the following script.
angle (!NEAR_ANGLE!)
- For Code Block, insert the following script and click the Verify button.
def angle (angle):
if 90 > angle > 0 :
return " North East"
if 0 > angle > -90:
return "South East"
if 90 < angle < 180 :
return " North West"
if -90 > angle > -180:
return "South West"
if angle == 0:
return "East"
if angle == 90:
return "North"
if angle == -90:
return "South"
if angle == 180:
return "West"
if angle == -180:
return "West"
- Click Apply > OK.
The direction of the polygon relative to the line feature is populated in the 'Proximity' column.