I have two polygon layers, and a roads layer that I've made into a network dataset. My goal is to find the closest polygon in one layer to each polygon in the other layer, but instead of just calculating the distance to find the closest I need to use the roads ND to see which of the polygons from the first layer is closest to the polygon from the second layer.

What tool can I use to do this?

I've assumed I can do it with something in the Network Analyst toolset, but I can't figure out what.
From the picture, I want to find the closest green polygon to both of the red polygons using the yellow roads.

I'm still relatively new to this, in my first course on the subject.

enter image description here

Edit: I received this solution on GeoNet, the Esri forum:

  • Convert the vertices of your polygon features to points (Feature Vertices To Points-Data Management toolbox).
  • Do this twice: once for the green polygons and once for the red polygons
  • Calculate an OD cost matrix with the Network Analyst (OD cost matrix analysis layer-ArcGIS Pro).
  • Load the vertices from the red polygons as origins and the vertices from the green polygons as destinations (or vice-versa).
  • Use the OD cost matrix to find out the shortest path between any vertex of a green polygon and any vertex of a red polygon.
  • Use these vertices geographic positions to determine to which green or red polygon the vertices belong.

1 Answer 1


I think an issue you may run into is that polygons can not be used as Facilities when using Network Analyst. I came across this post which is similar to the issue you are having.


From what I read, it seems like an alternative process would be to use the "Feature Vertices To Points" tool to create a series of individual points to replace your polygons. From there you can use the points as Facilities in order to run the "New Closest Facility" tool through Network Analyst. This would give you more accurate results than just using a centroid point of each polygon.

  • Thank you for the help. That got me part of the way toward solving the problem. However, I got the error "The network dataset must have at least one time-based and one distance-based cost attribute." when I tried to use my network dataset. It doesn't have a time attribute, and I can't find a way to include one, so I may have reached a dead end at least with the data I'm using. Commented Dec 3, 2019 at 5:57
  • Do you or your organization have a subscription to ArcGIS Online? The built in network analysis tools utilize ESRI streetmap data, which could be used to run your analysis with.
    – Spencer
    Commented Dec 3, 2019 at 19:58
  • I'm not sure where the "The network dataset must have at least one time-based and one distance-based cost attribute." is coming from b/c I just created a ND with only a distance attribute, so maybe something to do with your settings. But assuming you need one, just add a new field to represent the time and calculate it (polyline length / speed ... taking into account units). Then in the ND use that field for the time based cost attribute. Maybe check desktop.arcgis.com/en/arcmap/latest/extensions/network-analyst/…
    – dark fader
    Commented Dec 13, 2019 at 22:25

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.