Assign Attribute by Nearest Centroid

On the Shape tab, in the Utility group: Click Assign Attribute by Nearest Centroid to assign attributes to design elements from the closest region element. (Ctrl+Alt+A,N)

Since attribute values can be assigned for text elements and layer triangulations, this option is also available on the Text and Triangulation tabs, in the Utility group.

Do the following:

  1. Select the Source of the data that will be used as input to the function:

    Selection Design elements you have interactively selected in the Design Window.
    Visible Design elements that are visible in the loaded layer. Elements that have been specifically hidden are excluded. This a quick way of selecting all visible elements in a layer without having to explicitly select them.
    Layer One or more layers that you select. Names of layers currently loaded in the Design Window are shown in bold.

     

    For large datasets, for performance reasons you may prefer to select a layer rather than load that layer and select all of the elements in the layer.

    Selecting a non-applicable layer will have no effect. In most cases, an error icon will indicate that the chosen input layer is not valid. Hover over the icon to view a validation hint.

  2. In this example, we want to assign a Bench number to the selected block polygon:

  1. Use the drop-down to select a Region Layer.

  1. Use the drop-down to select the Region Attributes to assign to the design elements that fall inside the specified regions.

  1. For open shapes (polylines), choose a Centroid Calculation Mode:

    Mode Description
    First Point The first point of the design element is within a region.
    Last point The last point of the design element is within a region.
    Midway Point The midway point of the design element is within a region.
    Bounding Box Centroid The centroid of a bounding box around the design element is within a region.

  1. Finally, click Apply to assign attributes by nearest centroid.

  2. In this example, the Bench number of the nearest region block has been assigned to the block polygon:

    Check that the result of the operation is what you expect. If necessary, use CTRL+Z to undo.

    Note: It is recommended that you do not use this tool where you have regions which overlap. If selected elements fall within more than one region, the attributes of the last region encountered are most likely assigned, however this is undefined behaviour and the assignment may be unpredictable.