Here is an example with:
- Country polygon=
Countries layer with
- Electric cable line =
Lines layer with
Before start, please download and install
(1) First step is extracting nodes of your cable lines.
Processing Toolbox | QGIS geoalgorithms | Vector geometry tools | Extract nodes
(2) It will return
Nodes layer (green points at each node of line). Each point (node) is expressed as a row in the attribute table.
(3) Open the attribute table of this
Nodes layer, and create a new field (let's say
straddle) by expression below:
WHEN count_distinct(geomwithin('Countries', 'country'), group_by:= cable) >= 2
geomwithin() function is provided by
This will distinguish lines which straddle multiple countries.
(4) Final task is to
Join these tables.
Layer Properties | Joins and join Lines and Nodes using
cable (cable name) as join-target field. Now you can filter your cable layer (straddle = 'Yes').
......there must be more sophisticated approaches.