Forgive me if I posted something similar recently but here goes:
I have 2-3 scenarios dealing with a polyline and polygons. Two of them involve crossing boundaries of polygons, and one of them involves not touching a boundary at all.
I have a roads layer and a cities layer (Polygon) layer. ONe key thing to remember is that the Polylines are broken (segmented) at the border of the polygon--they don't nautrally overlap the boundaries of the polygon.
Scenario 1: I need to select all roads in the roads layer that have a common Route ID (COU_JURIS_RTE) and that cross over both boundaries of the Cities layer. There are many variations here but the maint thing is that I need a set where the lines are both outside and inside. I have tried numerous Spatial Queries with various filters but can't seem to do it all in one query. I thought of trying Spatial Aggregation even with two fields--one for Urban and one for Rural--but how would I be using the same Route ID?
Scenario 2: Using the same layers, I need to select roads that either start within a polygon and end outside of it, or start outside and end within it. The main thing is that the road has the same Route ID and has segments that are BOTH urban and rural. An example of the Spatial query would be like this:
COU_JURIS_ROUTE = 'COU_JURIS%' AND UrbanRural FieldName = 'Urban', 'Rural'
You would think it wouldn't be that hard but its been nuts. I have tried as many Spatial Queries as possible but am up against a wall.
Scenario 3: I need to find all Polylines (roads) that are completely within a polygon--not touching the boundary and not beginning and crossing outside of it. I do a Spatial Query and get most of the polylines not touching the boundary BUT there are segments of roads that go beyond the boundary as well--which I don't want. Again, I have tried numerous Spatial Queries but I can't get the proper kind of distinction.
I have attached example of the types of roads that I am trying to find.
You would think this would be simple enough but it hasn't been.
Thank you,
Daniel
|