I've been trying to find lines that are on top of another line feature of the same class, but different lengths. I can currently identify any features of the same feature class that are duplicates of one another based upon geometry and/or attributes with the matcher and duplicate filter, but can't seem to figure out how to identify the shorter line segments that are within a line. Sometimes they have shared vertices and sometimes they will not.
Hi @madwarren, the SpatialRelator might help you. Send all the line features to both the Requestor and the Supplier port, and set:
- Tests to Perform: Within
- Attributes that Must Differ: OID
You can then check the number of related suppliers for each output line to determine if the line was within another line.
Note that there could be a case where the SpatialRelator cannot detect the spatial relationship if the shorter line has vertices that are not shared by the longer line, because of unavoidable computational error. In such a case, consider transforming the Supplier lines to slenderlong polygons using the Bufferer with a slight buffer amount.
Optionally use the SpatialFIlter, or as suggested buffering.
If there are not always shared vertices I've never found spatial relators/spatial filters alone to be very reliable for lines. I've always ended up having to buffer or similar (but that can sometimes bring its own issues). Spatial comparisons with a tolerance is high on my wishlist for this reason
Hi @madwarren, the SpatialRelator might help you. Send all the line features to both the Requestor and the Supplier port, and set:
- Tests to Perform: Within
- Attributes that Must Differ: OID
You can then check the number of related suppliers for each output line to determine if the line was within another line.
Note that there could be a case where the SpatialRelator cannot detect the spatial relationship if the shorter line has vertices that are not shared by the longer line, because of unavoidable computational error. In such a case, consider transforming the Supplier lines to slenderlong polygons using the Bufferer with a slight buffer amount.
If there are not always shared vertices I've never found spatial relators/spatial filters alone to be very reliable for lines. I've always ended up having to buffer or similar (but that can sometimes bring its own issues). Spatial comparisons with a tolerance is high on my wishlist for this reason
You can try this:
Use the LineonLineOverlayer and a Tester to test all line segments with _overlap = 2
Then route these as Candidate in the SpatialFilter (filter EQUALS) to compare to the originals lines.
All line segments that have _overlaps=2 and are EQUAL to an original completely fall within another line.
Thanks everybody for their suggestions and help with this matter. I went with a buffering technique. I ended up using a matcher to filter out geometry matches and if found send a single feature through. I then did a small buffer on those lines and send them into the spatial relator as the requestor. I set it up to "requestor contains supplier", attributes differ "OBJECT ID", and created a list with the Object ID's. Tested the output on _related_candidates >= 1.
Then I can identify the segments that are within a line from the list attached to the features.