Select to view content in your preferred language

Closest Facility/Delete Identical Tool Help

839
3
Jump to solution
04-10-2012 02:51 PM
EricStipe
Regular Contributor
Hello,

I am having a bit of a time figuring out a work around for a problem I have. Essentially, I ran a Closest Facility operation on a set of about 200 points. Each point is an entrance to a building, and the underlying network is walking paths. I have named each of my facilities and incidents based on building number, and ran the operation so that each building was a facility as well as an incident, producing routes to and from each building.

What I am looking for is for any given path, (1-2, 1-3, etc.), I would like the shortest route (in time). In the Route output, there are routes for each entrance. For example if building 1 has four entrances, there will be four routes from building 1 to building 2. I only want the shortest (time-wise) for each route.

This is where I thought I would be able to use the Delete Identical tool. I advanced sorted the table, first based on the name of the route, then on the travel time. After this sort, the first unique record for each route name (1-2) had the shortest time. However, Delete Identical appears to delete all but the lowest Object_ID. This is a problem because as the routes were created and subsequently exported, they did not go in the order that I want now, so the lowest Object_ID is not always the shortest time for a specific building to building route.


Any suggestions/comments would be much appreciated.


Thanks,

eric
0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor
I believe I have found an, albeit lengthy, workaround. I created a unique ID for each of the paths by concatenating the x midpoint, y midpoint, and z start point of each route (line). I then took the table out of ArcMap and into Excel and reordered the OIDs.


If you're using 10.0, the Sort tool will create a new feature class with new OIDs in the sorted order. I think that may make this task a quick ModelBuilder exercise.

If you want to set up your own custom unique identifier on a sorted table Calculate Field tool can be used to do this too. Note I mean a table sorted with the Sort_management tool, not just interactively sorted:

Expression (PYTHON):
uid(1)


Code Block:
i = None def uid(start):   global i   try:     i = i + 1   except:     i = start   return i

View solution in original post

0 Kudos
3 Replies
EricStipe
Regular Contributor
I believe I have found an, albeit lengthy, workaround. I created a unique ID for each of the paths by concatenating the x midpoint, y midpoint, and z start point of each route (line). I then took the table out of ArcMap and into Excel and reordered the OIDs. I took the table back into ArcMap, and exported it as a file geodatabase table. The OID were in the "correct" order, ascending based on my sorting, and I was able to Delete Identical from there. After this i used the unique ID I created in the route feature class to rejoin, and remove the null records (the ones that weren't the shortest for each building).

I'm still playing around with this to make sure it actually did everything proper, but if someone sees a major flaw in this method, or has an idea for a quicker way, I'm open for suggestions.

Thanks,

eric
0 Kudos
curtvprice
MVP Esteemed Contributor
I believe I have found an, albeit lengthy, workaround. I created a unique ID for each of the paths by concatenating the x midpoint, y midpoint, and z start point of each route (line). I then took the table out of ArcMap and into Excel and reordered the OIDs.


If you're using 10.0, the Sort tool will create a new feature class with new OIDs in the sorted order. I think that may make this task a quick ModelBuilder exercise.

If you want to set up your own custom unique identifier on a sorted table Calculate Field tool can be used to do this too. Note I mean a table sorted with the Sort_management tool, not just interactively sorted:

Expression (PYTHON):
uid(1)


Code Block:
i = None def uid(start):   global i   try:     i = i + 1   except:     i = start   return i
0 Kudos
EricStipe
Regular Contributor
Curtis,

This is exactly what I was looking for, thank you. It is much quicker and leaves much less room for error. I appreciate your response.


eric
0 Kudos