This tutorial shows you how to find the center of a polygon using the Point to Feature geoprocessing tool. A real-life example shows why it is important to check the implications of using this tool.
If you use point data with information about a surrounding area, you may want to combine these with polygon data of a city, state, or province. Next, you can perform a spatial join to combine both datasets. However, before doing that, you need to be sure the point data is located within the correct corresponding polygons. To do this, Pro offers a tool that creates the geographic center for polygon features. You can also create it yourself by creating additional records in an attribute table. Here, we will use the first option and use an external dataset to show what happens if your points are displayed wrong (and how you can fix this).
STEP 1: Download the data
We’ll map COVID-19 data for New York City. The COVID-19 data is found in a text file with X and Y coordinates, that can be saved as a .csv file and projected on a map with polygon data for the different areas in NYC. These areas are available for download here. Download the zipped shapefile, unzip and open this link in a new browser window. Copy and paste the info in an empty Notepad file and save it as “covid_data.csv”. Next, open up Pro with an empty map template. Create folder connections to both downloaded datasets. First, add the geo_export_e774a0ac-8c6b-40ee-8be5-598140c1377f.shp to the map and rename it as “NYC areas” in the contents pane. Next, add the .csv file to the map by clicking “Map” on the ribbon interface, selecting “Add Data” and next “X Y Point Data”. The “XY Table to Point” tool opens up. Enter the following parameters and click “Run”:
Input Table: covid_data.csv
Output Feature Class: covid_data
X-Field: (accept presets)
Y-Field: (accept presets)
Coordinate system: Current Map [Map] A new point layer is created and added to the map. These points are mostly found in the center of each corresponding polygon, except for one polygon in Upper Manhattan that has two points, whereas a bordering polygon south of it has none:
The most southwards point is not in the center, but just outside of its associated polygon but inside another polygon. As we’ll see below, this is not the result of a human error but of wrongly using a geoprocessing tool to find the center of a polygon. Deselect the point data layer in the Contents pane.
STEP 2: Find the center of the NYC area polygons
You can calculate the center of a polygon with the Feature to Point tool. Locate the tool and run it with the following parameters:
Input Features: NYC Areas
Output Feature Class: NYCareas_FeatureToPoint_outside
Leave the “inside” box unmarked. Click “Run”. A new point layer is added to the map. You can see the tool places a point on the exact location as the “misplaced” point we spotted earlier. Now run the tool again, this time with the “inside” box marked to see the difference:
Input Features: NYC Areas
Output Feature Class: NYCareas_FeatureToPoint_inside
A new point layer is added to the map. Make sure it’s the only selected point layer by de-selecting any other point layer in the Contents pane. Notice that now the formerly empty polygon in Upper Manhattan has a point feature in its geographic center:
From this Upper Manhattan example, it seems the COVID-19 .csv data uses X and Y coordinates that do not correspond with the center of its associated polygon. If you open the Feature to Point tool and read the tooltip, it says that this is a possibility when using the default option (meaning running it with the “inside” box unchecked) when using this tool. This can be problematic when joining data and performing analysis, so be careful when using this tool and make sure point data is located within its associated polygon.