Hello, I am working on a project where I want to find the one closest facility (fire stations in this case) to each incident. I was able to run/solve this without a problem using ArcMap 10.7's network analyst extension, but I am wondering how I could save the closest facility ID as an attribute to the Incidents' attribute table.
The Routes object created by the network analyst extension has the incident ID and facility ID saved as attributes in its attribute table. I exported the Routes and Incidents, added them to the map, and joined them based on attribute. I then went into symbology for Incidents, went to categories, unique values, and gave each point an unique colour based on the facility ID. I expected points of the same colour to cluster around their closest facility, but they were all distributed randomly.
![Results of closest facility analysis. It seems that incidents were assigned random facilities as their closest facility rather than what was actually closest in the road network.](/legacyfs/online/484255_random.PNG)
Note, black outlines are city districts. I turned off the street network so the incident points will be easier to see. If this matters, there are 10 facilities and 36,185 incidents.
I'm not sure what I'm doing wrong. Anyone have any ideas? The network dataset I'm using seemed to work fine with no issues when I calculated service areas for these facilities. My best guess is that the incidents ID in the Routes file doesn't match the ObjectID of the Incidents file (ie incidentID # 1000 in Routes isn't the same incident as ObjectID # 1000 in Incidents for some reason).
My work around for what I want to do is create non-overlapping service areas for these facilities that are large enough to cover the entire study area, then create a spatial join on the service area polygon with the original fire incidents shapefile. This works, but I'm wondering why solving closest facility seemingly returns random results.