Calculating the centroid of each polygoin, but weighted by points from another layer

4860
7
12-13-2013 02:09 PM
Palermo_SPenano
New Contributor
Hi All,

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?

Thank you!

Palermo
0 Kudos
7 Replies
XanderBakker
Esri Esteemed Contributor
Hi Palermo,

There are several ways of doing this. For instance by following these manual steps:

  • Make sure the point layer has X and Y as fields added to the attribute table. If you don't have them use the "Add XY Coordinates (Data Management)" tool

  • 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.

  • The make this spatial, use the "Make XY Event Layer (Data Management)" tool.

Kind regards,

Xander
0 Kudos
XanderBakker
Esri Esteemed Contributor
Hi Sol,

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...

Kind regards,

Xander
0 Kudos
XanderBakker
Esri Esteemed Contributor
Hi Sol,

Good point that a center of gravity of population may well be placed on a location where no population exists (+1 for that)... Key question remains; what is the purpose of the analysis?

Kind regards,

Xander
0 Kudos
RamB
by
Occasional Contributor II
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.

regards,
0 Kudos
Palermo_SPenano
New Contributor
Hello!

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!

Palermo
0 Kudos
LaurenScott
Occasional Contributor
Polermo,
Another strategy 🙂

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
0 Kudos
AdrianWelsh
MVP Notable Contributor

 I know this is super old but this reply really helped me!

0 Kudos