Select to view content in your preferred language

How to achieve best results from Align Features geoprocessing tool?

3048
16
09-02-2022 03:04 PM
DavidSchuster
Occasional Contributor

Good afternoon!

I'm trying to align a feature class containing traffic jam polylines with our road network in an automated way.  The traffic data provider uses a different road network than ours, hence the need to align them. 

For the most part the Align Features geoprocessing tool works quite well, except that sometimes it gets confused where roads converge at small angles (for example where entrance/exit ramps meet the main roads/service roads) and at complex highway interchanges or roundabouts. 

In troubleshooting this issue, it seems that the spatial index grid size might have some effect on the alignment results.  Somewhat by accident, I noticed that if I take the same input geometries, and align them with the same target geometries (repeating the test using target feature classes with different spatial index grid sizes), one resulted in a correct alignment and the other did not.   I repeated the test in ArcGIS Pro 3.1 and in ArcMap 10.8.2 and I get the same results.

Can anyone help me figure out how to achieve the best results from the Align Features tool?  Would using a larger or smaller grid size help, or is it completely coincidental?

Or is there a better way to achieve what I'm trying to do?

Thank you!

0 Kudos
16 Replies
DanLee
by Esri Regular Contributor
Esri Regular Contributor

Align Features tool is not designed to align two sets of network features but to align adjacent features. It would be helpful if you could show a screenshot of a typical area or share a sample data. I wonder what you need might be spatial adjustment, such as rubbersheeting.

0 Kudos
DavidSchuster
Occasional Contributor

Thanks for the reply Dan!

I've attached a sample project and some images showing the issue.  For simplicity, I eliminated all the roads and traffic jams except for the ones I'm testing the problem with.

The black lines represent a straight section of a service road, and a turnaround section that forks off of the service road.  These are the target geometries I'm trying to align a traffic jam to.  There are two versions of this target roads feature class.  The geometry in both is identical - the only difference between the two feature classes that I can find seems to be the spatial index grid size.  "TargetRoads1" has a grid size of 760ft.  "TargetRoads2" has a grid size of 980ft.  The input lines feature class has a grid size of 2600ft.

The red line represents the traffic jam that we are trying to align to the target roads.  Visually, you can see that the jam should line up with the straight section of the service road.  When aligning against "TargetRoads2", the Align Features tool gets it right (green line).  But when aligning against "TargetRoads1" it gets it wrong (orange line) - the jam aligns briefly to a section of the turnaround, and then jumps back to the straight section of the service road.  (p.s. I used an align distance of 20 ft for all of my tests)

I've tried removing and recreating the spatial indexes on the feature classes using various grid sizes to see if I can improve the results and make them more consistent, but I don't have a good enough understanding of what they mean.  I'm hoping someone might be able to shed some light on it. 

Ignoring that these are road segments, it seems like the Align Features tool should be able to handle a use case like this, shouldn't it?

Thanks for your help!

David

0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor

I tested Align Features; it worked for me without setting spatial index grid size. 

DanLee_0-1662481311378.png

 

0 Kudos
DavidSchuster
Occasional Contributor

Although 3ft search distance works, you'll see the problem again if you try a search distance of 5ft.  And unfortunately in my case I can't make the search distance too small because the traffic jams lines are coming from a completely different provider.  Some of the jams are off by as many as 10 feet, sometimes more.

0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor

I understand.  Would you be willing to share more complete data so I can see the real situations?

By the way, I noticed that your TrafficJamLine_Original has the standard xy resolution which is 1/10 of the xy tolernce, but TargetRoads1 has non-standard xy resolution and xy tolerance. I am not sure if it would make a difference in what you are trying to do, but it may potentially cause invisible problems or bad result in your workflow.

DanLee_0-1662488155042.png

You can try the following:

- Use Create Feature Class to create a new empty feature class using TargetRoads1 as the Template Dataset and TrafficJamLine_Original for the Coordinate System.

- Use Append to add all features from TargetRoads1 to the new feature class.

 

0 Kudos
DavidSchuster
Occasional Contributor

Dan, 

Sorry for the delayed reply.  I tried your suggestion of creating a new feature class and appending but unfortunately that did not work.  However, I did find what I think might be the cause for the different alignment behavior between the two target road feature classes.  Although the geometries of the two target road feature classes was the same, the order of the features within the feature class was not.  I think the Align Features tool is somehow affected by the order that the features appear in the feature class.  When I took the problematic target roads, and exported them into the same order as the working feature class, the align tool behaved as expected.

Unfortunately, I'm not sure there's much I will be able to do about this, except for somehow using the Match Fields parameter on the Align Features tool - I just have to figure out how to create an ID that can be shared between both the input features and the target features.

Thanks again for your help! 

0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor

Hi David,

Thanks for the update.

My suggestion on creating a new fc and appending the original features into the new fc was to get the data in a standard stage, so the XY Resolution and XY Tolerance for your data would be as shown below. I didn't think this would resolve the Align Features problem, but it would ensure data integrity for analysis down the road.

DanLee_0-1663371454452.png

As I mentioned before, the tool is NOT designed for matching/aligning two sets of shifted network like features. I am not sure it would work well even if you have common fields as the Match Fields between them.  If you could share some more data, I can help assess how the problem might be solved.

 

0 Kudos
DavidSchuster
Occasional Contributor

Hi Dan,

Attached is some sample data containing several batches of traffic jams (each representing the traffic jams at a different point in time), as well as the target roads I'm trying to relate them to.

The jams are coming from a provider with a totally different road network, so we expect there will be times when the jams are just too different to be aligned properly, so I'm certainly not expecting anywhere near 100% success rate.  The Align Features tool seems to do a really good job - it just gets confused sometimes (as mentioned in my original post).  I've experimented with different ways of building the model to improve performance and also deal with other issues I've encountered along the way (such as true curves).  I noticed that the Align Features tool does not have a environment setting for "Maintain Curve Segments" similar to the one offered by Pairwise Clip, where the output of aligning to a true curve segment would be a true curve segment.

If you have any information you could share about how Align Features works "under the hood" that might help me to avoid some pitfalls.  Any suggestions you might have for alternative approaches are much appreciated as well.  Some of our key requirements are that it has to be automated as a geoprocessing task and it needs to run quickly (preferably < 30 seconds) since we're working with live traffic and want the results to be usable as soon as possible.

Thanks!

David

0 Kudos
DanLee
by Esri Regular Contributor
Esri Regular Contributor

Hi David,

Thanks for sharing the sample data.  I see the 135 features in TrafficJamLines_All_Backup, but I can not find the target features you want to align to. Could you share the target features please? Thx.

0 Kudos