New answers tagged

0 votes

Changing layer name in QGIS by replacing only a part of it using Python

You just do 'string'.replace('st', 'ST') insdead of setting the actual layer name. Use layer.setName to set it propperly.
  • 5,750
0 votes

Different layers and basemaps on both sides with OpenLayers layer swipe

The best solution for my problem was to use layer groups. I created a group layer in GeoServer where I combine the base map and my other data layers. I then added the layer as a WMS to my map. If ...
0 votes

Exporting project with all files, properties and dependencies using QGIS

I tried Project Packager by Tarot Osuji - Although it doesn't have a rating yet it seems to have more than 2,000 downloads. So, I risked trying it. It seems to be working ...
0 votes

ArcPy command to get the number of features in map layer

The reason your code didn't work is that you provided the layer source (lyr.dataSource), not the layer (lyr). Functions which accept layers will honor a source, by converting it to a layer, with ...
  • 19.1k
1 vote

ArcPy command to get the number of features in map layer

arcpy.GetCount_management(lyr) It will honour definition queries and return a count of features in the layer. If there are any selected features, it will return a count of the selected features only. ...
  • 54.3k
1 vote

Layer just for annotations

In QGIS >= 3.22 there is the possibility to create an annotation layer. You need to activate Annotations Toolbar in View\Toolbars. You will see something like this: Use the first button for ...
  • 1,978
0 votes

Searching for single Layer in Layers Panel of QGIS?

For QGIS 3.> for layer in QgsProject.instance().mapLayers().values(): if 'Municipal_Boundaries_of_NJ' in iface.setActiveLayer(layer) iface.legendInterface()....
  • 1,537
2 votes

Importing multiple txt files using PyQGIS

You are missing skipLines=2. The most easy way to find out how the uri should look like is to load one example manually and than look into the Information section of the loaded layer. There you will ...
  • 1,290
0 votes

Remove reference to raster layer object PyQGIS

Try to move the QgsRasterLayer to the Core Thread. if r.isValid(): r.moveToThread(QCoreApplication.instance().thread()) rlayers.append(r) count = count + 1 I had issues with ...
  • 11
0 votes

Could not create destination layer

I face the same warning during the georeferencing process "Could not create destination layer". Then, I unchecked the 'Set target resolution'. Tried to run it again and the georeferencing ...
1 vote

Layer group actions (e.g. transparency control)

This is now possible starting with QGIS 3.24, via "Render Layers as a Group" in the layer styling panel. Changelog for QGIS 3.24 - Feature: Rendering layers as groups
0 votes

Changing color of symbol in UniqueValuesSymbology object using ArcPy?

Current answer for ArcMAP 10.8 (may be some previous versions too) is "yes, it's possible". You can use a Layer method .updateLayerFromJSON Core part of solution is to create JSON ...
3 votes

Calculate how many points are located within certain land cover classes - QGIS

You need to use JOIN ATTRIBUTES BY LOCATION feature in QGIS. Processing toolbox -> Vector General -> Join Attributes by location Select your point layer for features and the land cover layer ...
0 votes

Import Google API layer into QGIS

Looking at the web requests, the streetlight data comes from a POST call to with a request containing a bounding box JSON ...
  • 54.2k

Top 50 recent answers are included