How Polygon Neighbors and Pairwise Polygon Neighbors works

This topic describes how the Polygon Neighbors and Pairwise Polygon Neighbors tools find neighbors and populate the output table.

Find neighboring relationships and calculate statistics

The neighboring relationships are defined as follows:

  • Overlapping neighbors—Polygons that have all or part of their areas overlapping.
  • Edge neighbors—Polygons that have common or touching boundaries.
  • Node neighbors—Polygons that touch at a point (for the Polygon Neighbors tool, either the boundary touches or crosses; for the Pairwise Polygon Neighbors tool, the boundary touches).

For the Polygon Neighbors tool, the neighboring polygons are found using the same rules for polygons as the Intersect tool.

For the Pairwise Polygon Neighbors tool, the neighboring polygons are found using the same rules for polygons as the Pairwise Intersect tool.

Both tools follow a hierarchical path to determine the type of neighbor and the statistics to record in the output table. The neighboring relationships, in hierarchical order from high to low, are overlapping, coincident edge, and node neighbors. Once a higher-order neighbor is found, the tool calculates and stores the relationship information, and the analysis of lower-order relationships is skipped. The tools use the following workflow:

  1. Select a polygon to use as the source feature.
  2. Find all the polygons that intersect the source polygon (find the neighbors).
  3. For the first neighbor found, analyze the following for the source polygon:
    • When the neighbor polygon is an overlapping neighbor and the Include area overlaps parameter is checked the following are done:
      1. Add the AREA field to the output table.
      2. Calculate the area of the overlap.
      3. Record the calculated area for use in the output table AREA field.
      4. Record 0 for use in the output table LENGTH field.
      5. Record 0 for use in the output table NODE_COUNT field.

        Overlapping neighbor analysis is complete.

      6. Analyze the next neighbor polygon.
    • When the neighbor polygon is an edge neighbor, the following are done:
      1. Calculate the length of the coincident boundary.
      2. Record the calculated length for use in the output table LENGTH field.
      3. Record 0 for use in the output table NODE_COUNT field.

        Edge neighbor analysis is complete.

      4. Analyze the next neighbor polygon.
    • When the neighbor polygon is a node neighbor, the following are done:
      1. Find the number of times the neighbor polygon crosses and touches (the Pairwise Polygon Neighbors tool only uses touches) the source polygon at a point.
      2. Record this count value for use in the output table NODE_COUNT field.
      3. Record 0 for use in the output table LENGTH field.

        The node neighbor analysis is complete.

      4. Analyze the next neighbor polygon.

Once the neighboring relationships have been found, the tool uses the Report By Fields parameter value to determine how to report the neighbor relationships and statistics in the output table. The Report By Fields parameter value is used to identify unique polygons or polygon groups and report their neighboring information by the unique polygons or polygon groups. Polygons of the same group have the same set of field values.

Report By Fields examples

The subsections below describe examples using the Report By Fields parameter:

Use a field with unique values for every individual polygon

To find the neighbors of each individual polygon in the input, specify an input field that has a unique value for every polygon. In this example, the input table of the nine polygons has a myCode field, which has a unique value for each polygon.

Input data

The table below shows the result of using the myCode field as the Report By Fields parameter value. The prefixes in the source and neighbor field names are src_myCode and nbr_myCode.

Output table

Use a field with values defining unique polygon groups

To identify unique polygon groups and report the neighboring information by the groups, specify a field that has unique values of the classification. The neighboring information is summarized based on how the unique groups are related. In this example, the unique polygon groups are identified using the myClass field as the Report By Fields parameter value.

Input data

The following is the result of using the myClass field as the Report By Fields parameter value:

  • For group A to other polygons of group A, the total length of coincident edges is 1200, which comes from the six coincident edges among the polygons in group A.
    Note:

    The output table will only contain a unique record for each unique combination of source and neighbor polygon values specified using the Report By Fields parameter. Since group A is used as the source and the neighbor as one side of the relationship, and the reversed relationship is also group A as the source and the neighbor, the total of both sides of the neighbor relationship are in one record.

  • Between group A and group B, there are only two edges that are coincident for a total length of 200. This is also the case between group B and group A.
  • Between group A and group C, there are three coincident edges for a total length of 300. This is also the case between group C and group A.
  • For group B to other polygons of group B, unlike group A, no neighboring relationship was found, so there is nothing reported in the output.

Output table

Use multiple fields with combined values defining unique polygon groups

In this example, the values in the myZone field represent one classification of the polygons, and the values in the myClass field represent a second classification.

Input data

When two fields, myZone and myClass, are specified as the Report By Fields parameter value, the combined values of the two fields will result in the following unique polygon groups:

  • Z1-A group
  • Z1-C group
  • Z2-A group
  • Z2-B group
  • Z2-C group

The output table below shows the neighboring information for these groups. The first eight rows represent the unique groups of Z1 values combined with the values in the myClass field being the source groups and their neighboring groups in Z1 and Z2.:

  • The Z1-A source group has six coincident edges within the group (similar to group A in the previous example), and the total length of coincident edges is 600.
  • The Z1-A source group is an edge neighbor with the Z1-C neighbor group, and the total length of coincident edges is 200.
  • The Z1-A source group is an edge neighbor with the Z2-A neighbor group, and the total length of coincident edges is 300.
  • The Z1-A source group is not an edge neighbor with the Z1-B neighbor group, but the Z1-B neighbor group boundary touches the Z1-A source group at a node and is a node neighbor. Consequently, the value for the LENGTH field is 0, and the value for the NODE_COUNT field is 1.

Output table

Input data with and without overlapping polygons

The examples below show details of how the neighboring relationships are analyzed in hierarchical order from high to low when running the input data with and without area overlap. The examples use a single field for the Report By Fields parameter value containing unique values for each polygon. In each example, differences between the Polygon Neighbors and Pairwise Polygon Neighbors tools are noted.

Input data containing no overlapping polygons

The input data used in the following two cases contain nonoverlapping polygons.

Include area overlap parameter is unchecked

The four input polygons shown below do not overlap. When the tool is run with the Include area overlap parameter unchecked, the tool will only check for edge and node neighbors, in that order. Using polygon 1 as the source polygon as an example, three neighbor polygons are found, and the following information is reported in the output table below:

  • Polygon 2 has a coincident edge with polygon 1, so it is an edge neighbor. The length of the coincident edge, 100, is written in the LENGTH field. The node neighbor analysis is skipped, and the NODE_COUNT field has a value of 0. This is the case for polygon 4 as well.
  • Polygon 5 does not have a coincident edge with polygon 1, and the LENGTH field has a value of 0. However, polygon 5 touches polygon 1 at one point, so it is a node neighbor of polygon 1 and has the value of 1 for the NODE_COUNT field.

Input data with output table

Include area overlap parameter is checked

When the Include area overlap parameter is checked, the output table will contain the AREA field. All of the AREA field values will be 0 since none of the polygons overlap. The analysis of edge and node neighbors continues, and the LENGTH and NODE_COUNT field values are the same as the example in the comparable Report By Fields parameter example.

Input data contains overlapping polygons

The input data used in the following two examples contains overlapping polygons.

Include area overlap parameter is unchecked

Among the following four polygons, overlapping, edge, or node neighbors occur only once between any two polygons. When the Include area overlap parameter is unchecked, the tool only checks for edge and node neighbors (in that order), and the output does not contain the AREA field. Using polygon 1 as the source polygon as an example, three neighbor polygons are found, and the following information is reported in the output table below:

  • Polygons 2 and 5 both have a coincident edge with polygon 1, and the length of the edge, 20, is written in the LENGTH field. The node neighbor analysis is skipped even though polygon 2 crosses polygon 1 at a point. The NODE_COUNT field has a value of 0.
  • Polygon 4 has a coincident edge with polygon 1, and the length of the coincident edge, 100, is written in the LENGTH field.

Input data and output table

The Include area overlap parameter is checked

Using polygon 1 as the source polygon for an example, three neighbor polygons are found, and the following information is reported in the output table below when the Include area overlap parameter is checked:

  • Polygon 2 overlaps polygon 1, and the area of overlap, 1600, is written in the AREA field. The analysis of edge and node neighbors is skipped even though polygon 2 has a coincident edge with polygon 1 and crosses it at a point. The LENGTH and NODE_COUNT fields have a value of 0.
  • Polygon 4 has a coincident edge with polygon 1, and the coincident length of the edge, 100, is written in the LENGTH field.
  • Polygon 5 has a coincident edge with polygon 1, and the length of the coincident edge, 20, is written in the LENGTH field. The node neighbor analysis is skipped even though it crosses polygon 1 at a point (the Pairwise Polygon Neighbors tool only uses touches so this cross situation is not considered). The NODE_COUNT field has a value of 0.

Input data and output table

Input data contains polygons that intersect another polygon more than once

In the input data used in the examples described below, overlapping, edge, or node neighbors occur more than once between two polygons. The values in the output fields—AREA, LENGTH, and NODE_COUNT—are the summations of all occurrences in each neighbor type.

Include area overlap parameter is unchecked

The two polygons below overlap in two places and have two coincident edges. When the Include area overlap parameter is unchecked, the tool does not analyze the overlap between the two features. It finds the two coincident edges and writes the summation of the two lengths of the coincident edges, 40, to the LENGTH field. The analysis of node neighbors is skipped, so a value of 0 is entered in the NODE_COUNT field. This is the case for polygon 1 being the source polygon and polygon 2 being the neighbor, and vice versa.

Include area overlap parameter is checked

For the same two polygons below, when the Include area overlap parameter is checked, the tool finds two area overlaps and writes the summation of the two areas, 800, in the AREA field. The analysis for edge and node neighbors is skipped, and a value of 0 is entered in the LENGTH and NODE_COUNT fields. This is the case for polygon 1 being the source polygon and polygon 2 being the neighbor, and vice versa.

Input data and output tables

Include area overlap parameter is unchecked and no coincident edges exist between the input polygons

For both tools in this scenario, no coincident edges are found, and 0 is written to the LENGTH field. The tools continue with the analysis of node neighbors, the Polygon Neighbors tool finds that the boundaries cross twice, while the Pairwise Polygon Neighbors tool does not consider cross relationships and returns an empty output. Since the Polygon Neighbors tool considers cross relationships, it writes the value 2 in the NODE_COUNT field. This is the case for polygon 1 being the source polygon and polygon 2 being the neighbor, and vice versa, as shown in the output table below:

Input data and output table

Special cases

The input data used in the next two special cases may seem the same but cover the area differently as explained below.

Polygon covering the hole of another polygon

In this case, polygon 2 has a hole that is covered by polygon 1. The two polygons do not overlap, so the analysis for overlapping neighbors is unnecessary. When polygon 1 is the source polygon and polygon 2 has a coincident edge of 200 with polygon 1, this value is written to the LENGTH field. The NODE_COUNT field value is 0. Similarly, when polygon 2 is the source polygon, polygon 1 has a coincident edge of 200 with polygon 2, which results in the same values in the LENGTH field for each record.

Input data and output table

Polygon completely overlapping another polygon

In this case, polygons 1 and 2 overlap each other. You need to check the Include area overlap parameter for this neighboring relationship to be found in the analysis. For both polygon 1, being the source, and polygon 2, being the neighbor, and vice versa, the overlapping area of 2500 is reported in the output table below.

Input data and output table