# Center and Centroids

Three related operations in the Center template in the Transform pane, called circle, inner (area), and weight (area),  create points at the "center" of objects using similar but different methods:

• circle - the center of a minimum enclosing circle.

• inner (area) - for areas only, a merge into the center point of a minimum enclosing circle as adjusted to fall within the original area
• weight (area) - for areas only, a merge into the center of gravity point of the subject areas, as if they were cut out of cardboard.

Such points are often called centroids in GIS work.   The word centroid in this context simply means a point placed at the "center" of an object.   Centroids are used for many reasons but perhaps the most important is to convert geographic data in the form of areas or lines into the 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. A point is always its own centroid, so the Center template in all three forms simply copies points. The Center template can work with lines as well as with areas. When a centroid point is created it inherits the data fields of the object from which it was created. The illustrations above show centroids created for areas with the Centers template.

## weight (area) The weight (area) operation creates a point at the approximate center of balance of the area, that is, the balance point if the area were cut out of stiff cardboard.   The centroid point created by the weight (area) operation is shown above in yellow.  The weight (area) operation uses a fast algorithm that will usually, but not always, place the centroid point within the area. Unusual area shapes such as horseshoe shapes will cause the centroid point to be placed outside the area.

## circle The circle operation computes a minimum enclosing circle about each area and creates the centroid at the center of the circle. The illustration above shows the centroid point created by the circle operation in red.  The position of the circle centroid is different from the centroid computed by the weight (area) operation.   The circle operation may also place the centroid outside the area.

## inner (area)

We will often encounter areas where the centroid point computed using circle or weight (area) will be placed outside the area.   Consider, for example,  a map of the Southeastern United States. If we create centroids, shown as green dots, using the circle template 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, just across the border within Mississippi. We can use the inner (area) operation to create centroids, shown as yellow squares above, that are guaranteed to fall within their areas.

## Centroids and Lines

Because an enclosing circle can be computed for lines as well as for areas we can create centroids for lines using the circle template. This illustration shows four lines with their centroids, computed using circle. If we draw enclosing circles about each line, shown in red selection color, we can see how the locations of the centroids were determined.

Centers 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 circle template we can create centroids for each individual line.

Why would we want to do that?  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.

Transform Pane

Transform Reference

Transform - Geometry: Center

Example: Join Districts to Building Footprints - Given a map of a city with a drawing layer containing the footprints of buildings as polygonal areas, and a second drawing layer containing districts in the city as polygonal areas, we use the Join dialog to add a new attribute field to each building giving the district in which it is located.   We consider first the simple case where district boundaries always fall between buildings, so buildings are always only in one district.  Next, we deal with the case where buildings can straddle district boundaries, so parts of the same building can be in different districts.  In that case we use the Transform pane to quickly build centroids for building footprints, and then we use the centroids to guide the spatial join.
{"ft_lang_label":"__label__en","ft_lang_prob":0.9328376,"math_prob":0.9474714,"size":4597,"snap":"2022-40-2023-06","text_gpt3_token_len":901,"char_repetition_ratio":0.1587198,"word_repetition_ratio":0.007662835,"special_character_ratio":0.19164672,"punctuation_ratio":0.07981221,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.972679,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22],"im_url_duplicate_count":[null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-01-27T18:34:06Z\",\"WARC-Record-ID\":\"<urn:uuid:00057e2d-2608-43c7-841b-00973f1a5332>\",\"Content-Length\":\"14346\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:fb35693a-ef2b-48a4-ad4a-98b5f185eb59>\",\"WARC-Concurrent-To\":\"<urn:uuid:4e5bf8ec-ebfa-4483-b252-3b1532fd2651>\",\"WARC-IP-Address\":\"92.205.60.223\",\"WARC-Target-URI\":\"https://manifold.net/doc/mfd9/center_and_centroids.htm\",\"WARC-Payload-Digest\":\"sha1:CM43JJAFAKH7HFDX6OREPH7ULZIT6TPV\",\"WARC-Block-Digest\":\"sha1:6JFSWINOK44NHJQYRW2C56H5A5X4WV6Q\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-06/CC-MAIN-2023-06_segments_1674764495001.99_warc_CC-MAIN-20230127164242-20230127194242-00606.warc.gz\"}"}