You can try the following
array_foreach(@input_overlay_intersect, @element ^ "pop_dens"),
I've tested a standalone version before answering (so ...
You can use QGIS expressions with the function overlay_intersects( ), available since QGIS 3.16. Set the field type to string as the output will be formatted as text:
Screenshot: on the blue polygon1, create a new attribute, refering to the intersecting orange polygon2 ...
Meanwhile (since QGIS 3.16 with the new overlay_crosses function) you can use QGIS expressions to automatically calculate what you want. The expression to use on the lines layer and referring to the polygon layer (replace polygon with the name of your polygon layer) looks like this - see below for an explanation. You can use this expression with field ...
What you seem to mean is how often does each line cross the boundary (outline) of each polygon. When a line crosses a polygon, the number of intersection points is infinite as the intersection has the form of a line and this consists of an infinite number of points.
To count the number of crossing points with the boundary, first convert your polygons to ...
Open the source point shapefile's Layer Properties. In the lower-left corner click the Style dropdown (image below) and select Save Style.
Then from the intersected layer, Load Style, and select the saved style from above.
If you have one line layer for the contour and one straight line called 'distance', split the contour layer with the 'distance' line. Then you have a new 'contour_split' layer with three segments: one between the intersecting points and each before and after the points.
Then create line intersection points that create a layer called 'points'. Now the segment ...
It seems what you want is length calculation of connected line. My answer would be to use network anlysis toolbox. Now it is really strong in QGIS and it will do both : calculate the length + create a line feature.
Get all your geometry part in one layer.
For segment that are crossing each other connect vertices to make the layer "routable" (use ...