As @Vince explained, the intersection of a line and a polygon is only a point if the line only touches the exterior. If the line crosses into and out of the polygon, the intersection is a line.
What you want is the intersection of the lines with the polygon boundaries. Here are two different ways to achieve this.
- Convert the polygons to lines, using the
Polygons to linestool. Take the intersection of the two line layers.
- Take the intersection of the lines and polygons (which gives you a layer of lines). Use the
geometry by expressiontool to extract the startpoints and endpoints of those lines. Run
geometry by expressiontwice, once with this expression:
start_point($geometry), and once with this one:
you can use st_intersection between the line and the group of polygons, then your result will be this set of points you need.
You can achieve what you want using a virtual layer.
Let's note that this approach assumes you have simple polygons only.
The idea is to compute the intersection between the line layer and the exterior ring of the polygons. Since both are lines you will typically end-up with a point at the intersection
Layer / Add layer / Add-Edit virtual layer and enter the following expression
select st_intersection(l.geometry, st_exteriorring(a.geometry)) from myLineLayer l, myPolygonLayer a