New answers tagged

0 votes

Connecting two nodes with line to close segment in QGIS

In newer QGIS versions, you can automatically close a line using Geometry by Expression with this expression: close_line ($geometry) Expression (here with Geometry Generator for visalization): red=...
Babel's user avatar
  • 67.2k
0 votes

Moving (snap) lines to nearest features in QGIS

The idea is to snap all the vertices of Layer_A to Layer_B and then create the line_substring() of Layer_B from one to the next of these snapped points. To do so, use the expression below on Layer_A ...
Babel's user avatar
  • 67.2k
1 vote

Uploading transit data to QGIS

I suppose inside of the layer, each route is a separate line (feature). So you can apply categorized layer Styling with $id as source. Like this, you get a separate color for each line. See this ...
Babel's user avatar
  • 67.2k
6 votes

Determining on which side of line points are located using QGIS

You can also use QGIS expressions for this, using this expression to get a 0 or 1 output for each point, depending on which side of the line it is (see below for curved lines). The solution is based ...
Babel's user avatar
  • 67.2k
7 votes

Determining on which side of line points are located using QGIS

In PyQGIS 3 there is a handy method available, namely segmentSide() from the QgsGeometryUtils class. Let's assume there are two layers: a line layer with a single feature, and a point layer with nine ...
Taras's user avatar
  • 31.3k
5 votes
Accepted

Difference of two polyline layers in QGIS

where layer B basically has the same geometry in exactly the same positions The problem is that it is not true. LineString geometries are defined by their vertices. But since this vector data model (...
Gabriel De Luca's user avatar
2 votes
Accepted

Create alternatingly colored line segment in QGIS

Solution: the idea and requirenments You can use geometry generator for this. This solution requires that you have a point layer named points with points on (or near) the line where you want a color ...
Babel's user avatar
  • 67.2k
1 vote
Accepted

Determine area enclosed by multiple segments

Solution for PostgreSQL/PostGIS. Input geodata table named "linetoarea" shown in Figure 1 below. Figure 1 Run Geo-SQL script: WITH noded AS (SELECT ST_Node(ST_Union(geom)) geom FROM ...
Cyril Mikhalchenko's user avatar
1 vote

Want to curve lines that are already connected (not drawing)

Curved lines can be achieved using line type arrow (if you set arrow head/length to 0, you in fact get a pure line style). To work, however, you need a third point that is not on the connecting line ...
Babel's user avatar
  • 67.2k
1 vote
Accepted

Smoothing corners in polyline using PyQGIS

After a research I didn't found a good implementation of what I needed. Bezier curves and QGIS smooth algorithm cannot make the rounding as if its a circle segment. Using these methods you get ...
Alexander Petrushyn's user avatar
3 votes
Accepted

Using label placement via PyQGIS

The QgsVectorLayer class has no method like placement. However, the QgsPalLayerSettings does. I suppose you are trying to apply this LabelPlacement mode. Just add this settings.placement = Qgis....
Taras's user avatar
  • 31.3k
6 votes

Finding number of lines touching intersection point in polyline layer using QGIS

To count the touched split lines for each point, overlay_touches() can be used in combination with array_length(). The expression for creating the "type" integer field then looks like this: ...
winnewoerp's user avatar
  • 1,197
1 vote

Calculating Convex Hull based on attributes in QGIS

You can create a convex hull based on an attribute using QGIS expressions with "Geometry Generator" or "Geometry by Expression" (see here for details about both options). Use this ...
Babel's user avatar
  • 67.2k

Top 50 recent answers are included