I need some help because I do not know how to model this issue:

I have two polyline shapefiles. They have an attribute that I need to be compared. These are roads from different sources. So, I have their names and attributes.

My intention is to make this comparison within each GRID cell, so, I created a GRID with the fishnet tool, and then "Intersected" each polyline with the GRID, I have something like this:


BUT, I think that it is important to use the "NAME" attribute, for a better comparison between elements with same name. I should need to distinguish polylines, like this example:

Example 2, more polylines

For example, If it compares the SE attribute with the one that crosses (it has SW), it gives me something wrong.

Maybe, another possibility is taking into account their bearing, or something related with its angle, because it happens to be, in most cases parallels.

Sorry, but I'm a bit lost. I think it is something tricky, but I hope there is a possible methodology for this purpose. Any ideas?

---- Edit ----

I'm thinking about the bearing question. This is my idea:

  1. Select all the GRID cell that intersect with my desired geo (the black one).
  2. Export to a new layer the selected. So I only have grid cells spatially containing my geo and possibly the geo to contrast (red one).
  3. Compute the bearing for each line Black and Red (previously intersected with the GRID cells).
  4. Start a WHILE-clause loop with:

WHILE counter > 0

Count the number of Black features contained into the cell. "var counter"

Select a black feature.

Take value of the QUESTIONED attribute (for example NE);

IF the red geo has a bearing value +-5% from the blacks value THEN

take (in another var) the red questioned attribute (for example NE); IF var1 == var2 THEN write "SAME" into a String field from Red geo. ELSE IF Write "ERROR" into the same string field.



Counter = Counter - 1 Next feature


I have never implemented such a pseudocode, any help for this? maybe is a good starting...

Anyone would adventure in that?

1 Answer 1


You may use the Minimum Bounding Geometry tool/method to get feature orientation, which may then be joined back with the polyline layer(s). After that you could use either Field Calculator or Calculate Field method to write a custom python or vbs function for generating the comparison result, see function examples from the link below.

Using the Calculate Field tool

Calculate Field

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.