Hot answers tagged

7

When holes of the polygons have to be avoided So, this is an extension to my previous answer Calculating the longest distance within polygon in QGIS but with some changes in the Step 3, particularly in the query. SELECT p1.id, setsrid(make_line(p1.geometry, p2.geometry), #put your srid here), max(st_length(make_line(p1.geometry, p2.geometry))) AS ...


6

This is not taking any attributes into account (for example road name stored in each address point), just finds closest road using closestSegmentWithContext. Then you can merge (or spatial join etc.) output lines with your roads. roadlyr = QgsProject.instance().mapLayersByName('TR_ROAD')[0] addrlyr = QgsProject.instance().mapLayersByName('ADDRESS')[0] #List ...


5

For your above example you need to apply one additional step before proceeding with the queries that I provided, for that please check these threads In PostGIS: how to split linestrings into their individual segments? and Splitting lines into basic segments at vertices with PostGIS? Notice: The example below does not include breaking lines into sections at ...


4

Based on your quesion and code I think you're after something like this: import arcpy, os, itertools arcpy.env.workspace = r"C:/test/Test.gdb" # could be trouble if arcpy.env.overwriteOutput is False and the feature class already exists arcpy.CreateFeatureclass_management("C:/test/Test.gdb", "linea", "POLYLINE") # I ...


4

As commented, it seems to be a collection of line and not a polyline. I tried to explain in the image below. The first one has a collection of polylines. You can see that when it is a polyline, the buffer stay connected. And when is another line it has a endpoint/cap. The second sample is when the buffer is checked the dissolve. It looks like your case. The ...


4

When holes of the polygons have to be considered Let's assume there is a polygon layer "polygons" (pink) with its corresponding attribute table accordingly, see image below. Step 1. Proceed with "Delete holes". Step 2. Apply "Polygons to lines" Step 3. Use "Points along geometry". The output of this algorithm save ...


3

This is also an approximation. It finds the longest line between existing polygon vertices within each polygon. So the more vertices you have the better the results should be (but the executing time will be longer). For example add more vertices using Densify by interval if the results are not good enough. But from what I can see you seem to have alot of ...


2

You can connect the points using geometry generator. Let's say you have two points layers, where the fid is matching the potints in each layer you want to connect with a line. For demonstration, I just created two layers with 10 random points on each. In one of the layers, add a symbol layer and use geometry generator for symbol layer type - see screenshot ...


2

There are at least two convenient ways to find nearest neighbours in QGIS (point - line, and other geometry combinations). The NNJoin Plugin (https://plugins.qgis.org/plugins/NNJoin/) Since QGIS 3.8, the Join Attributes by Nearest algorithm (available in the QGIS Processing Toolbox)


1

You can achieve it using the following expression in the Field Calculator array_find( array_sort( array_agg( line_locate_point( aggregate('line','collect',$geometry), line_interpolate_point( $geometry,0.001)))), line_locate_point( aggregate('line','collect',$geometry), line_interpolate_point( $geometry,0....


1

You can for example use an expression like this: aggregate('pointlayername','count','a',intersects($geometry,aggregate('linelayername','collect',$geometry))) Note that this will only work if they perfectly overlap (intersect), not if they are 1 millimeters or even less apart. In that case, you could use a suitable buffer.


Only top voted, non community-wiki answers of a minimum length are eligible