Hot answers tagged

6

In the Processing Toolbox use the Extract Specific Vertices tool, for the Vertex indices use 0 for the first vertex and -1 for the last vertex. Which one you need will depend on the direction of the line. EDIT: Apologies, I didn't read your question properly, you said automatically. If it's just for display purposed you could use a geometry generator ...


5

Tested on QGIS 2.18 and QGIS 3.4 I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer... Let's assume there is a polyline layer called "polylines" (blue lines). With the following Query, it is possible to create a point at the end of each line. SELECT st_endpoint(geometry), * FROM "polylines" The output point ...


3

I've changed names of variables to be more eligible/legible for other readers. def getPointFromFeature(self, featureID, layer): expr = QgsExpression("Id = '"+featureID+"'") selection = self.selectionByExpr(layer, expr) geom = selection[0].geometry() # removed asPoint() return geom def getDistances(self, point_geom, river_geom): d = ...


2

I will describe 2 possibilities, the first is more easy and elegant but works only from QGIS 3.10. The second also works for older versions. Possibility 1: Use the geometry generator for labels. It is new since version 3.10 but very powerful. The expression will be convex_hull(collect ($geometry, "id")) this will build a convex hull around buildings with ...


2

Tested on QGIS 2.18 and QGIS 3.4 I can suggest using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer... I have tried to recreate your example. There are two overlapping polygon layers called "layer"(yellow) and "grid_layer"(blue) accordingly, see image below. All features of "grid_layer" squares have 10.000 m² area. With the ...


1

If you want to write all the values of the ycoord field into a .txt file, you can execute the following code in the Python Console of QGIS (change the parameters with your own): layer = iface.activeLayer() # your layer features = layer.getFeatures() # features of your layer with open('C:/Users/v.bre/Downloads/ycoord.txt','w') as my_file: # Change the path ...


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