Hot answers tagged

5

I've found an answer! I need to use Numpy frombuffer and gdal_array.GDALTypeCodeToNumericTypeCode to make my for loop look like this: #Loading the bands into the matrix for b in range(band_count): block = input.dataProvider().block(b+1, input.extent(), cols, rows).data() data = np.frombuffer(block, dtype=gdal_array....


5

To visualize them as curved lines, change the Symbol layer type to Arrow, then select Curved arrows option. Head length/thickness should be zero as you would not need arrow-heads.


4

When creating line objects the Advanced Digitizing window shows you distance (d), angle (a), x coordinate and y coordinate. To use it, switch on both the Advanced Digitizing panel and toolbar and click the icon for 'Enable advanced digitizing tools' when you are editing


3

This is a known bug: https://github.com/qgis/QGIS/issues/29223. It's Mac-specific, and may be related to a similar issue with the Identify results window. It doesn't look like anyone is working on a fix at the moment. See the issue tracker page on github for more details and up-to-date information. github user emonshaugen suggested this workaround: ...


3

Open Layer properties - Attributes form - switch from Autogenerate to Drag and drop designer (worked for me).


3

I use this code to ~randomly place a grid of sample plots for forest inventory: import numpy as np from itertools import product polylayer = iface.activeLayer() #Highlight polygon layer in layer tree npoints = 8 #Change pointlayer = QgsVectorLayer('Point?crs=epsg:3006', 'point' , 'memory') #Change epsg prov = pointlayer.dataProvider() for poly in ...


3

I implemented Cyril's comment. This is the input test polygon: Polygon to Lines Split lines by maximum length using $length / 7 in the expression builder. (8 vertices) Extract specific vertices (0 stands for start point) Voronoi Polygons with 100% buffer to make sure that parts of the polygon do not lie outside the generated Voronoi (in theory they may ...


3

Not sure if there is a simple way of doing this through the interface but we could accomplish this with a bit of Python. The code below stores the value and colour of the raster's symbology properties and rounds the value to 2 decimal places (you can change the value if you want) which it stores as the new label. Then it reapplies the updated properties So ...


3

..I got it! I use this expression for a composer item label with 'insert expression': aggregate(layer:='Corridors_86ef2ea9_d1a1_4d9f_9735_7b7b2fb54cb2', aggregate:='concatenate', expression:="Name", filter:=within($geometry, map_get( item_variables('Main Map'), 'map_extent')), concatenator:=', ') Works like a charm:)


3

That's quite easy: use pixel, points or mm as units for the width of the line (road, river) - thus a unit that refers to your rendered image/screen and not to the real world. Like this, you have the "Google-maps-effect" you refer to: your line is rendered always in the same width on your screen, whatever scale you zoom to. However, if you want to have "real-...


3

You can achieve this by joining the shapefile with the CSV file based on the common fields between them (KEY field and KEY_ID). To do this, add both shapefile and CSV files as layers to the table of Contents using Add vector files, then right-click the shapefile -> Properties -> Join -> Add join (green plus at bottom left) -> Select the CSV ...


2

Here you have a simple script that iterates over points and apply r.water.outlet to each one. You just need to add this code as a new script. It will ask for three things: Points layer. Flowdir layer (produced from dem file). Output file. The resulting rasters will contain the id of the point at the end of the filename. ##Rockfall=group ##...


2

I think using the "Meters at scale" unit type in the size section of the label properties should let you achieve what you're after. This setting automaticaly adjust the label size as you zoom in and out. You'll have to first set the "meters at scale" unit then play with the size value till your label are the same length of your line (if you need to set ...


2

Try toggle Editing, add a new column. Now you can right click on the new column to get to organize columns menu. Once you've got your columns back, delete the new added column.


2

The final problem were different CRS. The points were in 4326 and my Project layer in 25832. I changed everything to the same CRS and it worked. Thanks for the help.


2

For any kind of analysis, make sure to reproject it which saves the spatial data in the new CRS. For vectors, you can use the Reproject layer tool; for rasters, you can use the Warp (reproject) tool. Both of these are available from the Processing Toolbox. – Joseph


2

Other than with expressions, you can use the line-width-assistant - it's probably easier because you don't need expressions (but you can, if you want, see below). Select the assistent, select the source ( field that contains the values/width-information in your attribute table), than update values (that automatically selects min./max. values - otherwise ...


2

EPSG : 3857 is a projected CRS with meters as unit so the coordinate (-11315, 6710551) are right for London area. On the other hand your CSV seem to use degree as unit so it's not in 3857, you could try to use WGS84 (EPSG : 4326) if you dont know witch CRS it use


2

That is the correct and expected behaviour, if you select several layers at the same time and add them to QGIS it will make one request for all of the selected layers and add them as a single QGIS layer. If you need to have the ability to turn individual layers on and off in QGIS then you must add the layers one at a time, this will make QGIS make several ...


2

If you are trying to move the label and line by a fixed distance (a 50m-case below); Then the Geometry Generator expression for the Label would be: project($geometry, 50, radians(45)) And the associated leader Line would be: make_line($geometry, project($geometry, 50, radians(45))) Perhaps you want more control over the offset distance, then prepare a ...


2

By creating a new field "Fromto" (or any name) in your route table and in your resulting layer. This new field will contain both 'From' and 'To' (example: From: "Paris", to:"Moscow" --> Fromto: 'ParisMoscow'). You will then be able to add a Vector Join in your resulting layer and connect it to route table on their attributes "Fromto". the resulting layer ...


2

As stated on an example at thunderforest.com use https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=<insert-your-apikey-here>. You can add XYZ-Tiles to QGIS via Browser -> XYZ-Tiles -> New Connection


2

If you want to use QuickMapServices 1) go to Web -> QuickMapServices -> Settings 2) add/edit/remove -> create service from existing (3.a) or create new service (3.b) 3.a) If you chose create service from existing choose the one you want to edit. 3.b) If you create a new service choose TMS as Type 4) in TMS tab edit the url and insert your api key


1

According to this site, the value of -3.40282e38 is 0xff7fffee, which is a 'quiet' NaN ("Not a number") value according to this page . NaN is a sensible way to represent NODATA. Certain ranges of binary values for floats are used to represent NaN, infinity, minus infinity and so on. This nodata value suggests the original is single precision floating ...


1

If you need change the name of output, you can do it with this: alg_params = { 'INPUT': parameters['shapeinput'], 'TARGET_CRS': QgsCoordinateReferenceSystem('EPSG:4326'), 'OUTPUT': 'memory:Name_layer' } or if you want to save, only do this: path = '/home/shade/Desktop/name_layer.shp' #or something like that alg_params = { ...


1

Try using the following which uses the pageCollection() method to manage the page settings: layout = QgsPrintLayout(QgsProject.instance()) layout.setName("TEST") layout.initializeDefaults() pc = layout.pageCollection() pc.pages()[0].setPageSize('A0', QgsLayoutItemPage.Orientation.Landscape) manager.addLayout(layout)


1

The "error" was that the min max value was just "estimate" and not actual, and as the max value of original raster was just above 0.1 (0.010298) the setting of symbology of the layer (it was estimated) was defined in way that it was not showing the last cathegory (the 4th one) thats why I was missing all the time the last cathegory.


1

Found a workaround: I installed QGIS 3.4 LTR and pyinstaller in a miniconda environment on Windows 10. (Add conda-forge channel to install QGIS) I had to add the platforms/ directory in the data section of pyinstaller .spec file (qt platform directory found in the conda environment Library/ folder) for Qt to work.


1

You can get the project title with title = QgsProject.instance().title() See the documentation


1

Not at the moment but a feature request has been sent about creating a "Favourites" section where users could manually add their frequently-used tools: https://github.com/qgis/QGIS/issues/29220


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