# Transform - Centroids

Three related transform operators create centroids for objects using different methods. Centroids are points placed at the "center" of an object. They are used for many reasons but perhaps the most important is to simplify and abstract geographic data in the form of areas or lines into the much simpler form of points. At times we will want the data in a simpler form for export to other programs or to use analytic methods that work with points but which do not work with areas or lines.

 Centroids Create a point at the center of the minimum circle that encloses each object. (areas or lines) Centroids (Box) Create a point at the center of the minimum enclosing rectangle for each object. (areas or lines) Centroids (Inner) Create a point at the "center" of an area and adjust the position of the point so that it always falls within the area. (areas only) Centroids (Weight) Create a point at the approximate center of balance of each object. (areas only)  Centroid operators do nothing for points, since a point is always its own centroid. Two of the three operators can work with lines as well as with areas. When a centroid object is created it inherits the data fields of the object from which ti was created. The illustrations above show centroids created for areas with the Centroids operator.

The Common Centroid transform operator is like Centroids, but creates one centroid using the center of the minimum enclosing circle for all objects in the scope.

Examples

In the examples that follow we will use the province of Zacatecas in Mexico as a sample area. The Centroids (Weight) operator creates a point at the approximate center of balance of the area. It uses a fast algorithm that will usually, but not always, place the centroid point within the area. Very strange area shapes such as horseshoe shapes will cause the centroid point to be placed outside the area. The Centroids operator draws a minimum enclosing circle about each area and creates the centroid at the center of the circle. The illustration above shows the circle centroid in red. Note that the position of the circle centroid is different from the centroid computed for the approximate center of balance. The Centroids (Box) operator draws a bounding box about each area and creates the centroid at the center of the bounding box. The illustration shows a bounding box superimposed above an enclosing circle with the box centroid shown as a small square dot.

Centroids (Inner)

We will often encounter areas where the centroid computed using the Centroids, Centroids (Box) or by the Centroids (Weight) transforms will be placed outside an area. Consider a map of the Southeastern United States. If we create centroids (green dots) using the Centroids transform we see that the centroid for Florida falls outside of the state. If we were too zoom far into the drawing we would see that the centroid created for Louisiana also falls outside that state. We can use the Centroids (Inner) transform to create centroids (yellow squares) that are guaranteed to fall within their areas.

Centroids and Lines

Because an enclosing circle or a bounding box can be found for lines as well as for areas we can create centroids for lines using the box and circle centroid operators. This illustration shows four lines with their centroids, computed using Centroids. If we draw enclosing circles about each line (shown in red selection color) we can see how the locations of the centroids were determined. Centroids are most frequently created for areas. However, they are also a useful means of "converting" line objects into point data. For example, the above illustration shows lines in a hydrography layer where what appear to be continuous lines are in fact many lines that abut one another. Using the Centroids operator we can create centroids for each individual line.

As an example of why we would want to do so, suppose for each line segment we have the length of the line. We would like to know the total length of waterways per square kilometer in various regions of the map. We can approximate this by creating a grid where each box is one kilometer square and then creating centroids for each line segment. It is then an easy matter to add up the total "length" values for each centroid point that happens to be in each square kilometer grid box. In the example above the green points were created with Centroids using the lines and the blue point was created with Common Centroid.

Tech Tip

Many transforms automatically run a Normalize Topology transform before running to eliminate common errors that may affect correct operation. The Centroid Circle, Centroid Box and Common Centroid transform operators do not normalize target objects before running.