How can I find those lines that connect only different points as shown in the figure? Using Model Builder. The points are in several layers, each one stands for different level visualized with different colors. However, the lines, are only one layer.
Another way to do this if you have many points and lines to process is the following:
1). Make sure the point feature class has a field in the attribute table that differentiates the red and green dots, like Type or Class. Also, make sure it has a Point ID field with unique ID's for each point.
2). Make sure the line feature class has a Line ID field with populated with a unique value for each line.
3). Create points at the start of each line. Then create another point feature class to create the points at the end of each line:
- If one has an Advanced License, use Feature Vertices to Points (Data Management). Point Type (optional) is Start or End
- If one has a lower license level, there is a workaround:
4). Spatial Join the the original points to each of the point outputs from step 3.
5). For the resulting point file with End points, add an EndPointID field. Calculate the Point ID to this field.
6). For the resulting point file with Start points, add an StartPointID field. Calculate the Point ID to this field.
7). Next, use an Attribute Join to add the Start Points to the Lines based on LineID.
8). Do a second Attribute Join to add the End Points to the Lines in step 7.
9). Export the resulting file to create a new feature class with the joined information permanently part of it.
10). Remove all the extraneous fields (there will be several added by all the processing).
11). The end result will be a line feature class that includes in its attribute table the start and end point classifications. To find the ones that are disparate, do a Select By Attributes StartPointClass <> EndPointClass.
Chris Donohue, GISP