Mean Center/Median Center tool providing points mathematically centered but physically appearing in the wrong location

To create population weights, I'm using the Mean and Median Center tool to find the center of our populations in census tracts. However, I've noticed that some of the points that are popping up are physically appearing in the census tract next to the census tract they should be in, resulting in two points in one tract when there should be just one. However, the attribute table does verify that they are belonging to a different census tract, just not physically displaying them in the different census tract. Has anyone run into this issue? Does anyone know how to fix it?

• I think a picture illustrating your observed result would be very useful.
– PolyGeo
Commented Feb 27, 2015 at 21:22
• Commented Feb 27, 2015 at 22:51
• @mkennedy Since I've yet to do anything with the Esri forums I'm putting this here. There is a tool - Feature to Point will let you specify the point must be inside as opposed to just the centroid. But it requires an Advanced license. Commented Feb 27, 2015 at 23:09

Census tracts assume/present a uniform population density. If you are using Mean/Median Center on each tract, you're essentially calculating the centroid or geographic center of the tract. That centroid may or may not actually fall within the shape, particularly in the case of non-rectangular bounded shapes, such as 'C' (like your example image) and 'L' shapes, or shapes with holes in them.

If you only seek to get a point within each tract and be sure that it falls within the tract, Feature to Point will allow you to do that but it requires an Advanced license. Without an Advanced license, you could add x and y attribute fields, calculate those geometry properties to those fields, then create an xy event layer out of those values to get points (but again these may or may not fall within the boundary). If you are comfortable using python you can use a script to create a 'label point' (or 'inside centroid') using arcpy geometry objects, as follows:

``````# create points list
points = []
# get spatial reference from polygon feature class
sr = arcpy.Describe("shapes").spatialReference
# loop through polygon feature class
with arcpy.da.SearchCursor("shapes","SHAPE@",spatial_reference=sr) as cursor:
for row in cursor:
# add centroids to points list
points.append(arcpy.PointGeometry(row[0].centroid))
# write points to disk
arcpy.CopyFeatures_management(points,r'in_memory\centroids')
``````

Proper use of the Mean/Median Center tools would be to select all or a group of census tracts and use the population value as a weight field. This would then produce a single point at the geographic population center for those selected tracts (not one point per tract). I'm unclear on what you mean by 'create population weights', so I don't fully understand what you are trying to accomplish.

• Just to add that label points ('inside centroids') can be added by creating an arcpy.Polygon().centroid, at any license level: resources.arcgis.com/en/help/main/10.1/index.html#//… Commented Feb 28, 2015 at 1:07
• @phloem Good idea - mkennedy mentioned that property over at the geonet thread linked to in the comments, but I forgot about it. What is the easiest way to implement that? She mentions Calculate Field, but I wasn't aware you could create new geometry from a field calculation. Would you label the layer with the appropriate settings, convert label to graphic and graphic to feature? Or is there perhaps an existing script or toolbox? Feel free to edit my answer if you like. Commented Feb 28, 2015 at 1:16
• I added an example script for creating inside centroids. Feel free to format as you see fit. Commented Feb 28, 2015 at 1:23
• @phloem Thanks. Not quite sure that code formatting is correct. Will the > and . cause an error if copy/pasted? Usually four spaces at the start of a line indicates a code line in a GIS.SE post, and everything after that is rendered as proper indents (spaces). Commented Feb 28, 2015 at 1:49
• That was the format from ArcMap's python window I copy/pasted as I was running out the door. Reformatted now. Commented Feb 28, 2015 at 1:57