It may not be the most elegant way. However, you use "Extend line" to extend lines by the distance of the longest edge of the polygon.
The output looks like this and you can clip by Polygon with the "Intersection" tool.
And the output looks like this
Use this expression with geometry generator or the Geometry by expression tool - the expression is adapted to the data you provided (layer name: 'Bounding Box', distance to extend the line: 65):
First an algorithmic description how this solution works. Afterwards the implementation in QGIS, using expressions to create new geometries.
You can create for each vertex of your polygons the closest point on the line representing the street: make a perpendicular line on the streetline going through each vertex and where this connecting line ...
You polygons must have a unique identifier in the attributes, in my case the field named fid. I also presume the line layer has the name line. If you have other names, change it in the following expressions accordingly.
Be aware: the expression overlay_nearest is available since QGIS 3.16, see visual changelog. For older versions, use the refFunctions plugin ...
A completely different solution with yet another resulting polygon shape consists of "stretching" the polygons: just extend the length (longer side) of the rectangle until its intersection with the lines layer. This is more intuitive, but not necessarily easier to realize. You can do it as follows.
Remark: your polygon should have an uniqe ...
It is annoying when it is necessary to do an extraction of line segments and layer is LinesSring type (not Polygon type). It is because it depends of the way as lines were digitized. Your approach was correct but your "Extract by location" method doesn't have a "convexHull" option. In a PyQGIS script you can do that.
First, I downloaded ...
Have a look at the help for the Integrate tool. Integrate allows you to collocate vertices based on distance. Make a backup of your data first since this tool is going to alter the original geometry of your data.
This tool may not give the results you need as it may merge lines that you do not intend to merge. Tools in ArcGIS respect selections - maybe ...
As your polygon layer has invalid geometries, you have to run first this method of Processing tool (Fix geometries). Both layers (I named Polygons as Polygons_fixed) loaded in QGIS look as follow.
Afterward, you need to run Difference Processing tool with following parameters:
After click in Run, resulting layer looks as follow. I used an opacity of 20 % ...
A simpel example cutting the lines not intersecting a polygon using QGIS Virtual Layers.
select p.id, st_intersection(l.geometry, p.geometry) as geometry
from test_line l
inner join test_poly p on st_intersects(l.geometry, p.geometry)
Input a linestring and three polygons.
New virtual layer with linestring intersecting polygons.
If you just want to calculate the distance from each buidling the the outline of the plots, go to the bottom to see how to calculate a new attribute field for that. Here, I first give some more detailed information and also a visualization of the line you're looking for.
Let's supposte you have three layers named: buildings (polygon), plots (polygon) and ...
From the QGIS Toolbox:
choose Extract specific vertices
in the Vertex indices field, specify the first and last vertex index as comma-separated list:
This will create a layer with the start and end vertices only, rather than excluding them from your result set.
A way to approach this problem could be by switching from sp
to sf objects, and then use sfnetworks and tidygraph which
internally use igraph.
First we recreate the lines and points as sf objects.
x <- c(1,5,6,8)
y1 <- c(1,3,4,7)
y2 <- c(5,5,5,2)
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
L = st_sf(
ID = c("a", &...
The problem can be solved in several simple steps - 5 in total as you can see below. The core of the solution conists in using the Join attributes by nearest tool.
Let's say you have a the following line segments with white dots representing start- and end points and the number the id of the line segments. Some segments are connected (end point of 1 = start ...