New answers tagged

1

I found the solution: With this expression it takes the project path and adds the desired subfolder to it: file_path(@project_path) + '\Pictures\' Unfortunately this does not work for QField


1

To build on @kartoza-geek's answer, you can use all kinds of variables and values to determine the image filepath. Use their answer if you are relying on another layer to get the filename. If your image filename is based on the project filename, you can use the project filename as a variable and extract the image name from it using regexp. So in your ...


1

In QGIS 3.4 (and probably before that), you can use the ‘Vertex’ tool (which is next to ‘Add line’ on the toolbar, by default). Choose it, then hover the mouse over the ending or starting point of a line, and you'll see a plus symbol next to it—this allows you to continue the line. Similarly, it allows you to add a new point between other two by hovering the ...


2

You can add the following scripts as Processing script to Processing Toolbox. Then they can be used in a graphical model. The scripts don't include another Processing tool. Therefore, you can use them in different QGIS 3.x versions without concern. I've tested it in 3.4, 3.8, 3.10, 3.11, 3.12. (Please, also read the comments under processAlgorithm method) ...


2

Simply add the layer and the CSV (Excel) file to the project (drag'n'drop), then right click on the vector layer: Properties / Joins / Add new join (+ icon), and there you have to refer to the common attribute field. If you want to 'save' the connection, then you can create a new a field in the Field calculator and in the Expression panel just refer to the ...


1

I ended up creating a wkt field in the shapefile using the geom_to_wkt( $geometry ) command, and joined this column to the CSV with attribute data. I then re-imported the CSV using the well-known-text field to generate geometry attributes, and was able to pretty easily export this CSV to a geoJSON.


0

Looking at existing answer from Using Time Manager with joined layers?, it redirects you to a Github issue related to your question. In this issue, the solution is about using virtual layers (as stated at https://github.com/anitagraser/TimeManager/issues/148#issuecomment-463218771) The link to a tutorial to use virtual layers (from the issue) you need to ...


-1

You can use pyqgis to automate such things. Look at https://kartoza.com/en/blog/how-to-create-a-qgis-pdf-report-with-a-few-lines-of-python/ which was done using QGIS 2 series. You can easily adapt this to the Pyqgis 3 syntax. For a gentle introduction to Pyqgis read https://anitagraser.com/pyqgis-101-introduction-to-qgis-python-programming-for-non-...


2

You are trying to add an image to the map but the map item (picture) has no relationship with the layer items. So what you need to do is the following. Add an image to the map. In data defined settings select Edit Enter the following formulae aggregate(layer:='New_scratch_layer_34fb05c7_8585_4ab4_ac73_d29eb398f3c2',aggregate:='concatenate', expression:="...


1

You can use the Processing Tool > Layer tools > Extract layer extent that will create a polygon that covers the complete extension of your DEM (Extent in the image). Then, using the Processing Tool > Vector overlay > Intersection, you can create a new layer that contains only the points that are inside your raster (Intersection in the image). This is an ...


0

Another approach that was suggested to me on Reddit was to use a spatial join with this shapefile: https://hub.arcgis.com/datasets/esri::world-utm-grid/data


1

One solution is to change the snapping status for the fishnet layer. Both ArcGIS and QGIS support the enabling/disabling of snapping for individual layers. For ArcGIS, if you select "list by snapping" under the contents pane you can tick snapping on/off for each layer. For QGIS, select Edit Advanced Configuration tool under the snapping toolbar to ...


4

Open your symbology menu and click on your cluster symbol: Now click on 'Font Marker' and scroll down to 'Character(s)': Edit the data defined override and insert this expression, if your points perfectly overlap (if they dont see below): aggregate( @layer_name,'sum',"value",filter:=intersects($geometry,geometry(@parent))) Change "value" to the name of ...


3

You can achieve this task using arrays. 1) Create an array with the search themes AND the placeholders 2) for each value of the array, find if the name column contains it or not, using ilike 3) as the output of step 2 is an array of true/false values, check if this output contains at least 1 true result array_contains( array_foreach( ...


0

If you refer to the Qt documentation (QLineEdit - Qt) the QLineEdit widget has no toPlainText() function. This is a method that can be used with the QTextEdit widget (QTextEdit - Qt).


0

I faced the same problem, I used this code but it isn't work. My code is: select l1.id as id1, l2.id as id2, st_intersection(l1.geometry, l2.geometry) as geometry from line l1, line l2 where (st_overlaps(l1.geometry, l2.geometry) or st_contains(l1.geometry, l2.geometry) or st_within(l1.geometry, l2.geometry) ) and l1.id < l2....


0

Depending of your requirements, you may want to use a QgsLayoutItemLabel or a QgsLayoutItemHtml. To illustrate, we use QgsLayoutItemLabel. For QgsLayoutItemHtml, you may look at this existing question and its answers from qgis.core import QgsLayoutItemLabel, QgsLayoutPoint, QgsLayoutSize from qgis.PyQt.QtCore import Qt project = QgsProject.instance() ...


2

Snapping to sketch' geometry is now available in development version and soon in 3.14, thanks to this PR. Here's how to do it: Create a permanent vector layer. Toggle editing. Add polygon feature Snapping toolbar > Self-Snapping


0

Joining fields from two different tables is possible when one field is common in both. They act as Join and Target fields. So, whenever you are joining fields from two attribute tables, make sure that: The data type of the "Join field" and "Target field" is same. Both the join and target field has same dimension. The data in both the join and target fields ...


3

Consider adding the CSV to your project then going to the KML layer> layer properties>joins, to join column X from the CSV to the KML (based on a shared unique ID). Then go to the KML's styling options, and next to the relevant symbol's colour setting, look for the data defined button > Field. X should be available as an option so select that and the ...


0

Although in the layout, I suggested changing legend block position or reduce the map canvas to avoid overlay, a recipe to make some changes to your fonts in the legend project = QgsProject.instance() manager = project.layoutManager() layout = manager.layoutByName('demo') # I start from an existing QgsLayoutItemLegend named "legend1" # here. You may create ...


1

David it took some time, but I managed to get the correct data for you using the TIN Interpolation Tool. However, there is a catch. During my research I came across this article from September 2019 on Github where somebody had the same problem having e+ values using QGIS 3.8.3. https://github.com/qgis/QGIS/issues/31970 In this article the statement was ...


1

Here's a method using R: library(raster) library(sf) # Load rasters, make sure they are same resolution r1 = raster("aridity.tif") r2 = raster("landcover.tif") r2_resamp = resample(r2, r1) # Get raster extents and find intersection r1_ext = st_as_sf(st_as_sfc(st_bbox(r1))) r2_ext = st_as_sf(st_as_sfc(st_bbox(r2_resamp))) r1_r2_intersect = st_intersection(...


0

This can be done by data-defining the image paths, and is documented in the Creating a Report section in the QGIS User Manual: https://docs.qgis.org/3.10/en/docs/user_manual/print_composer/create_reports.html#including-pictures-in-a-report


2

If field X has the value you would like to use for your "heatmap", you can do the following: Open the layer properties and go to the "Symbology" tab Select Graduated in the pull-down menu at the top Set the Value to X Choose the desired number of classes in Classes and press the Classify button. Click on the Apply or OK button to see the result.


0

You could use the SAGA raster calculator with the formula: ifelse(a>0, 0/0, a) Use the default "Output Data Type" (4 byte floating point number)


0

Download based on extent go here: https://export.hotosm.org/en/v3/exports. Because perhaps, you don't need all data that sometimes can take large space.


0

You could add another unrotated map on top of your rotated map, that follows a theme which shows no layers, and create the grid with the given scale in this dummy map.


0

Getis-Ord G measures high/low clustering - so are there any high/low values that are close together. Moran's I checks to see if there is spatial dependence between values. So basically it measures if there is linear correlation between values and its neighbours. What is the purpose of checking for spatial correlation? What are you trying to identify? You ...


0

Having a vector layer with a polygon, you can use it to visually mask other layers. Open the layer styling panel (F7) Click the symbol render option. Select the inverted polygons option. Then choose the make color. In this case I choose white and no stroke.


3

For fun, I've tested a method with pure QGIS Expressions. Disclaimer: I didn't test it on very large datasets. For start, you can see the solution as a point 'geometry generator' (you can use 'geometry by expression' from toolbox to make it actual geometry) symbol layer in the stops point layer. Here the code: closest_point( aggregate( layer:='...


6

The easiest way to solve your issue is to use an expression that creates the shortest line between the two points. Here an example of the expression used in the Geometry generator that works perfectly using the algorithm Processing Tools>Vector geometry > Geometry by expression on the Graphical Modeler. Using the following expression shortest_line( $...


0

I'm uncertain if I understand what is going on entirely but maybe this helps. You can set a projection if you know it to be the correct one through Python: import gdal import osr fn = '/path/to/my/infile.tif' #define a projection spatref = osr.SpatialReference() spatref.ImportFromEPSG(4326) crs_wkt = spatref.ExportToWkt() # open in edit mode, omit the 1 ...


0

I have found the solution to my problem, I went back to the original layer and draw a new polygon between the three with snapping and then merged to these three together.


5

On the one hand, QgsMapCanvas is a class. You can always create new canvas objects from it (as you did already in your second attempt). On the other hand, iface.mapCanvas() is an instance, an object of the class QgsMapCanvas. iface.mapCanvas() is initialized when you load QGIS app with GUI (Python should be enabled to use it), and refers to the main canvas ...


0

Thanks for everyone who read this question and decided it was probably a corrupt file; most likely to be the case. I found a work around, which takes longer, with additional processes. The layer was thematically split into the 4 levels of data, saving each as a new layer and then each layer known to be faulty passed through the 'fix geometry' process found ...


0

Did you tried to change tile resolution to 1 or 2 px? If your computer does not allow to view this scene, try to decrease terrain file size while keeping original resolution of it.


0

I dont know why your SVG is not displayed as it should in QGIS but below is an SVG similar to yours that work well in QGIS <svg height="100" viewBox="0 0 100 100" width="100" xmlns="http://www.w3.org/2000/svg"> <path d="m50 92.550484v-85.1009644" fill="none" stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" ...


0

The "Height" property in Layer Properties > 3D View is used to place the bottom of the 3d object. You should be able to specify an attribute which indicates the starting height for each feature. If you do not have this then you can calculate it from the terrain layer you are using.


0

I had the same problem. The inconvenient is that QGIS seems that is not able to understand correctly the projection information stored on the .jp2 image files. I recommend you to follow these steps: (This worked on QGIS 3.10 A Coruña) Open an empty QGIS project file. Create a new projection by going to "preferences" -> "personalize projection". Go to ...


0

You can make a column invisible by editing its widgets in Layer Properties > Attributes Form More info: https://docs.qgis.org/testing/en/docs/user_manual/working_with_vector/vector_properties.html#edit-widgets


0

I try to use the first link and it works like this: https://wxs.ign.fr/choisirgeoportail/geoportail/wfs The second link is necessary to add ? between wmts and SERVICE https://wxs.ign.fr/choisirgeoportail/geoportail/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities Finally the last link does not have a wms service, but I found a few on the ...


1

After you try and open QGIS and get the error, you need to open MacOS "System Preferences" and select "Security and privacy". You should now see an option there to run the program below the "Allow apps download from:" section.


0

I did not find it. There is a "cleared" signal in QgsProject but fires after the project is closed. QgsMapLayer has a "willBeDeleted" signal but also fires after system prompts the save dialog.


0

You need a trigger for your layers and use the notify notification in QGIS. https://kartoza.com/en/blog/using-pgnotify-to-automatically-refresh-layers-in-qgis/


0

This post has been relevant but nowadays there is a native function for this intent included in the expression calculator. Now, you can simply run to_dms(5.1234, 'x', 2). A capture of the current doc can be seen below


1

I made some changes to the code to get the coordinates in DMS, if necessary. Only adjustments to the EPSG information are needed. Latitude (CASE WHEN $y < 0 THEN '-' ELSE '' END) || floor (abs(Y( transform( $geometry, 'EPSG:31983', 'EPSG:4326')) )) || '°' || floor(((abs(Y( transform( $geometry, 'EPSG:31983', 'EPSG:4326')) )) - floor (abs(Y( transform( $...


0

Does the problem persist with a more recent version of QGIS and the QGIS Resource Sharing plugin? Version 0.15.1 of the plugin was released May 28 '20.


0

The QGIS Resource Sharing plugin (http://qgis-contribution.github.io/QGIS-ResourceSharing) was made for this purpose (sharing resources, among them processing scripts, processing models, symbols, layer styles, SVGs, R scripts, expressions, ...). You can place your Collection on github or elsewhere on the Web and share it, as long as you follow the required ...


0

In general, a CSV file consists of points. Your example file contains X, Y and Z co-ordinates, and the X and Y co-ordinates look to be in metres [probably]. The key attribute you need to import a csv file into a GIS [I use QGIS] is that there must be an 'X' and a 'Y' column. These could be Universal Transverse Mercator co-ordinates or Ordnance Survey Grid co-...


Top 50 recent answers are included