I'm trying to get the centroid of each polygon in the attached image, but I want the centroid calculation to be based on the clusters of green dots in each polygon. The purple polygons are from one layer and the green dots are from another layer. How can I do this? How can I calculate the centroid of each polygon based on the clusters of green dots within each polygons?
Next use the "Spatial Join (Analysis)" tool to obtain the ID (Feature ID or any other unique ID) of the polygons for each point.
Open the attribute table to the points with the joined polygons.
Now do a summarize on the field that contains the polygon ID. (see more explanation in the Help topic on "Summarizing data in a table")
In this summarize you will calculate the average of the POINT_X and POINT_Y fields. The output is a table that holds the field you summarize on (ID of the polygons) and the average X and Y per polygon. These are the center point coordinates based on the points per polygon.
First of all thanks for the +1, and for the additional ideas you have on the matter. If I look at the original question, to me it clearly states that the density of the points is asked. The polygons are merely used to define which points should be combined to 1 center. On the other hand, we should ask Palermo what he wishes to achieve with the analysis, to be able to define what analysis suits his needs.
If I look close at the picture and the name of it ("Urban_density.jpg") it sounds to me that the polygons are counties and the points are urbanizations. To get the "center of gravity" it might be more realistic to use a certain characteristic as weight; say population per point. This would result in the center of gravity of population per county.
One more thought on using the outline of the polygon to determining the center; if you use for instance each vertex or equally separated points on the outline, a polygon with a lot of detail on one side (like the one center right in the picture) would pull the center of gravity towards the detailed part of the outline. I don't think this is what we want...
The analysis would become more exciting if taken into raster environment, solving some issues of center of gravity for irregular polygons. Take the green points also to a raster. Options increase many times to includes weights in a raster environment.
Wow this is great. Thanks a lot everyone for your suggestions. I have moved on to other projects and have not looked at this dataset for awhile. I will note everything said here in case I encounter a similar problem in the future. I appreciate all of your replies!
1) Make sure your polygon features have an ID field (so every polygon has a unique ID). Then do a Spatial Join on the points (Target = points, Join Features = polygons) to add that ID value to each point. Now each point "knows" which polygon it is in. 2) Run the Mean Center tool on the points. Use the polygon ID associated with each point as the Case Field.
This will create a centroid for each polygon weighted by the points inside.
I hope I have correctly understood your objectives. Best wishes! Lauren
Lauren M Scott, PhD Esri Geoprocessing and Spatial Statistics