New answers tagged

1

You can't display your project CRS coordinates in DSM as they are in metres. You need to change the CRS of the grid to EPSG:4326 to have a grid in degrees that will allow you to use DSM. You will then need to adjust the spacing of the grid lines as when dealing with metres you probably had then set to 1000's of metres apart while with degrees you probably ...


2

Something like the code below should work (I simplified, cleaned up a bit and added small features) : class MyQgsWidget(QWidget): def __init__(self, lyr_name: str, parent=None): super(MyQgsWidget, self).__init__(parent) self.vertical_layout = QVBoxLayout() self.setLayout(self.vertical_layout) self.list_widget = ...


4

Creating a circle using QGIS 3.18 (Windows 10 Pro) with 3 points. Documentation [https://docs.qgis.org/testing/en/docs/user_manual/working_with_vector/editing_geometry_attributes.html?highlight=circle#draw-circles]2


3

Its probably the version of the DWG - QGIS doesn't like newer versions of CAD files. Your best bet is to try and save it as an older DWG/DXF file.


1

The available QGIS Custom Widgets in Qt Designer are defined in QGIS libqgis_customwidgets. It is easy to find out the library in use. Go to Qt Designer → Help → About Plugins. You will see the QGIS library in use. If you see different widgets in your Qt Designer, maybe you are using a different libqgis_customwidgets library. You could be using some ...


0

It might be an issue with the size of the raster layer. Try generating raster overviews to compress the size of the raster and reduce its resolution to speed up the rendering process. You can do this on QGIS by going to Vector > Miscellaneous > Build Overviews (Pyramids). This makes the layer show only the necessary data on the particular zoomed out ...


1

Three things that might cause such a slowdown: Accessing slow-ish layers over the internet, even if they're not on top/visible. One thing to try is to turn on the Debugging/Development tools panel (right click on the top toolbar to choose what panels are on/off). Then click on the red dot to log network activity. That way you can see what network requests ...


5

There is not a specific action for "draw linestring" but rather one to add feature, regardless of the geometry: iface.actionAddFeature().trigger()


0

You can easily achieve this using expressions - for the function overlay_within is available since QGIS 3.16. You can achieve it in one step, however for clarity I explain it in two steps. If you want to do it in one step, simply replace "polygon_id" in the expression of step 2 with the whole expression from step 1: Create a new field "...


0

When I looked into this, I was surprised to see that there was no single tool that accomplished this task. However, using 3.18, this can be solved with two tools: Assume that the point layer has a field "type", as described in the original post. Additionally, assume that the polygon layer has a field named "poly_code", where each ...


1

You may try the following to be sure you delete features after processing run really ended from qgis.core import * from qgis.gui import * from qgis.utils import * import processing iface.actionSelect().trigger() shapefileA= iface.activeLayer() shapefileA.selectedFeatures() shapefileB= QgsProject.instance().mapLayersByName('shapefileB')[0] # ...


5

Could be wrong but you should reinstall QGIS 3.18 with the new installer. QGIS standalone installers on Windows are all based on OSGEO4W. At the moment, 2 OSGEO4W installers and only the new one allows for point cloud support. See announcement at https://lists.osgeo.org/pipermail/qgis-user/2021-February/048137.html You may try the new standalone installer ...


1

So the reason is because there's a difference between gdal:rastercalculator and qgis:rastercalculator in terms of the keyword arguments for the input. The documentation you referred to is for the QGIS version of this tool (https://docs.qgis.org/3.16/en/docs/user_manual/processing_algs/qgis/rasteranalysis.html#qgisrastercalculator), whilst in your code you're ...


2

Although the question is quite old, there is still no direct solution for the Qt timing problems that occur in QGIS when adding content via scripts or rendering HTML/Javascript during Atlas generation. But we can work around the problem with a small Python Expression function: from qgis.PyQt.QtCore import QTimer,QEventLoop @qgsfunction(args=1, group='Custom',...


0

The problem was mixing different SRCs for the rasters involved in the operation.


4

Yes and no. It takes a bit of doing/navigating, but under 3.18 at least, you can access the ArcGIS Server REST endpoint to add the data to your local project with ease. In other cases, you could accomplish it by loading the *.lyr files using SLYR by North Road/Nyall Dawson. Getting the REST endpoint URL is possible by opening your linked item in the web ...


3

As I understand it, the only way to update geometry on the go (using this reshapeGeometry method at least) is to access the layer's data provider: layer = iface.activeLayer() provider = layer.dataProvider() line = QgsLineString([QgsPoint(1, 1), QgsPoint(2, 2)]) feats_to_update=[] for feat in layer.selectedFeatures(): geom = feat.geometry() geom....


1

This is an approach to this problem using that strategy of the 'inner central horizontal edge'. In resume: Create buffers of the polygons. Intersection of buffers to get overlaping zones. Extract intersection coords to create the new medium edge. Clip buffers with lines and assign the parcel ID. Here are the layers to try out. Here is the code: library(sf) ...


3

A very fast way to remove all the annotations from your project is to use a PyQGIS script in the QGIS python console. the script is manager = QgsProject.instance().annotationManager() for i in manager.annotations(): manager.removeAnnotation(i) This will remove all the annotations in a single action.


0

I had the same "not responding" problem. As recommended, I closed the browser tab and now it seems to work.


3

You need to update to QGIS 3.16. There you may choose anchor-points for the callout lines at both the feature and the label.


6

If I understood correctly, the following script would work for you. First, select the layer and use the script in QGIS Python Editor. # get layer layer = iface.activeLayer() # convert features to list features = list(layer.getFeatures()) # sort features to be sure it is sorted by id. it is crucial features.sort(key=lambda f: f["id"]) dpr = layer....


0

I'm not sure. But it works right now. I have 2 separate installations of Python (3.6 & 3.8) in a separate folder. C:\Python\python36 & C:\Python\python38 Those folders and the script folders are listed in the system variables (2) & (3). I noticed that the C\OSGeoW64\bin (1) folder was listed at the bottom. I now moved this path up. After a reboot ...


0

Modify the columns using the field calculator by simply putting your desired value in single paranthesis, eg. '35V145'. Now every field in column A reads "35V145".


0

Walking Time plugin compatible with QGIS 3 exists in Github, but not exist in QGIS Plugins Repository: https://github.com/SrNetoChan/WalkingTime Download ZIP and extract to QGIS plugins folder.


0

You could use Flat ended buffers along with Difference to remove the unwanted areas of line, leaving the areas desired. Buffer Green line (adjust buffer distance as required) End cap style: Flat Join Style: Miter Difference Input: Blue line Overlay Layer: Buffer output


0

The python icon should be enabled automatically when a python script is saved in the location set in the processing options. I found that the only way I could repeat your issue was by removing all scripts from the location I set, leaving it empty. This removed the python icon from the processing toolbox. To test if I could re-enable the python icon I then ...


1

It is because of Max. Zoom Level number. If you click edit option on XYZ tiles(which yours is ESRI-Standard), you will see this parameter. Just increase it to 18. If it isn't enough quality, you can set it to 19. But 20 or more than 20 can cause to "Image data not available" problem.


1

There is a problem with whitespaces. New versions of QGIS want spaces before every plus sign except the first one.


0

You can split the lines at points using the methods discussed here QGIS - splitting lines at points with SAGA OR QGIS - Splitting lines at points using grass Then create a field using the formula $length to calculate the length of the lines (make sure your coordinate system is projected in metres or the value you want your measurement in). This will add a ...


1

I was having the same problem and managed to figure it out using the general_log.csv and observed how MySQL Importer QGIS Plugin wasn't having the same issue. The following query is needed for you to get QGIS working with your table: CREATE TABLE `target_schema`.`geometry_columns` ( `F_TABLE_CATALOG` varchar(256) DEFAULT NULL, `F_TABLE_SCHEMA` varchar(...


7

The file bivariate_legend.py has a missing import. Open file /Users/judithheher/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/BivariateLegend/bivariate_legend.py in any editor. Add from qgis.core import Qgis to the import section. Restart QGIS and retry. The plugin will run seamlessly.


1

Sorry, it might seem simple: but can you confirm that the plugin is check marked in the plugins manager? I just tested, if it is isn't marked (even if installed initially) the Georeferencer does not show in the settings/Raster tab.


4

This is a workaround using Reclassify by layer tool (so it is not a direct answer to your query). (1) Prepare a classification table by a spreadsheet software ( I used MS-Excel). (2) Drag and Drop the Excel file to the QGIS then it will appear on the TOC (Layers Panel). ] (3) Start Reclassify by layer tool and select Min, Max and Output fields from the ...


6

There is no problem in your code or no bug with QGIS. createRenderer method is deprecated since v3.10. Therefore, there may be incompatibility between the method and later versions of QGIS. I recommend you use the constructor.


4

Instead of using Photoshop, you can fix the problem directly on QGIS. Hillshade rendering (or any other raster rendering) happens individual layer by layer, as each layer know nothing about their neighbours. You can bundle the all 9 rasters in a single layer by creating a virtual raster. You have a tool to create the virtual raster in the processing toolbox. ...


0

I think I have figured out that these problems both stem from how QGIS3 handles KML layers. Ian Turton helpfully pointed out that the error is with feature 41, it's not error 41. I discovered the layer I was editing was a KML rather than a shapefile, which I hadn't previously realized. I tried adding another KML and doing the same thing, and had the same ...


1

Here is the final code that resolved the problem: # -*- coding: utf-8 -*- """ *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU ...


2

This works for me: doc = QDomDocument() qgsl = QgsProject.instance() mTC = qgsl.mapThemeCollection() # and *not* mapThemesCollection() mTs = mTC.mapThemes() mTC.writeXml(doc) # note the variable name change


3

If I understand correctly: You loaded the DEMs into QGIS, you were happy with the styling You weren't happy with the artefacts, so you did some polishing in Photoshop When loading the polished-up rasters, the styling in QGIS is different from what it was originally. If that's the case, you should be able to apply the styling of your "old" layers ...


3

QGIS uses PyQt for ui, and it doesn't come with a preinstalled Tkinter python package. I would recommend you either include the relevant package code with your plugin (if the license allows for that), or use PyQt to build your interface. I would recommend learning PyQt and using the included Qt Designer as instructed here in the pyqgis developer cookbook.


2

The CRS drop down in the Save Layer dialog just gives you a selection of recently used CRS's. After you have opened the Coordinate Reference System Selector with the Select CRS button ('globe icon') shown below... ...you will have access to all the predefined Coordinate Reference Systems via a tree view which you can expand and browse: To quickly find a ...


0

Running postinstall.bat fixed the problem on QGIS 3.16. Close QGIS and make sure it's not running on your PC. Navigate to the following folder: C:\Program Files\QGIS 3.16 Rename postinstall.bat.done to postinstall.bat Right click on postinstall.bat and "Run as Administrator". Run QGIS and you should see the icon.


2

You can make use of the saveNamedStyle function: layer = iface.activeLayer() bckup_fileName = bckupFolder + layer.name() + ".qml" layer.saveNamedStyle(bckup_fileName)


2

There are 2 things that I think aren't correct. First "if False:" part and second "return..". Meaning of "if False:" is that "don't run the code below this statement". So "the buffer processing algorithm" will never be executed. You should change it to "if True:" or just delete if statement. Second ...


0

I meanwhile found a solution for my problem, terribly I have trouble getting access to my initial post and ended up having another account. Therefore no editing possible to make Trams happy. Read status and XY-coordinates from GPS-widget with Python (QGIS 3) expalains how to get access to the data provided by a GNSS device. To get them automaticaly written ...


2

This should do it: layer = iface.activeLayer() # layer to work with populationfield = 'population' # name of existing population field rankfield = 'rank' # name of new rank field request = QgsFeatureRequest() # setup the orderby request: ascending=True -> smallest city will have rank 1, ascending=False -> biggest city will have rank 1 orderby = ...


1

I must have made an error while familiarizing myself with QGIS. I removed the layer then re-added it and I'm able to Query it's features now.


4

The file 'world.qgs' is not a vector data source- it's a project file. If you already have QGIS open the easiest way to open a project file is to simply drag and drop it onto the canvas or layers panel either from a folder in your file system, or from the browser panel within QGIS. See the gifs below for examples: At QGIS start from a file folder: From an ...


4

Here is a full example using changeAttributeValues(): layer = iface.activeLayer() # the layer to work with surfacefield = 'surface' # fieldname of your lookup field catfield = 'CAT' # fieldname of your new field with edit(layer): # start edit mode of the layer layer.dataProvider().addAttributes([QgsField(catfield , QVariant.String)]) # add the new field ...


Top 50 recent answers are included