I have about 10 polygons, and I have added their centroids to the map. I want to create lines connecting the centroids of each adjacent polygon. If polygon 1 borders polygon 2 and 3, I would like a line going from 1 to 2 and from 1 to 3. Hopefully this makes sense, and someone can help me out. Also, I would like to indicate the distances between the centroids.

  • 1
    Are you asking how to do this in an automative or manual way?
    – artwork21
    Commented Jun 19, 2015 at 19:34
  • if polygons are uniform and evenly distributed then you may have a try github.com/sharifulgeo/ESRI/tree/master/Connect_Points
    – Learner
    Commented Jun 19, 2015 at 19:39
  • 1
    With 10 polygons get the centroids using feature to point (advanced license) and draw the lines manually, snapping to the centroid points. At the very most you can expect to draw 100 lines which should take less than 15 minutes. If you don't have advanced license then create the centroids in QGIS. If you had 100+ polygons to connect it would be worth scripting... Commented Jun 20, 2015 at 0:00
  • 1
    I agree with @MichaelMiles-Stimson. For that few polygons it would be much faster to manually draw the lines than to run through the process of checking for adjacency and then selecting those pairs and drawing the lines. Especially if you don't want double lines (ie 1 to 3 and 3 to 1). Or are you trying to make this part of an automated process so it's easily repeatable, regardless of how many polys you have? Distance will just be the length of the lines. If you just want the distances and don't care about lines, there are Near tools.
    – Chris W
    Commented Jun 27, 2015 at 22:18

1 Answer 1


I met the same problem, my solution is create one copy of the polygon first, add one field with the same ID with the centroid points(should be there, don't need to create). Then use the C# arcobjects to judge if the polygons are touched, like this:

ISpatialFilter pSpatialFilter = new SpatialFilterClass();
pSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelTouches;

Then record the touched polygons ID, which will be connected to the centroid, then create fromlist and tolist to record the points, create a new polyline feature class to connect those lines.

  • If it possible, you can share me with the shapefile, and I will process it for you.
    – Zheng Ren
    Commented Apr 18, 2016 at 9:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.