Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [qgsvectorlayer]

The tag has no usage guidance.

1
vote
0answers
16 views

QgsVectorLayerCache causes QGIS to crash when called within def run(self)

This is in reference to the similar question regarding QgsVectorLayerCache . The original code is taken from here I'm trying to implement this method within the def run(self) method. def run(self):...
0
votes
0answers
108 views

Python Scripting in QGIS to add features and select them?

I'm trying to migrate a python plugin I wrote from QGIS 2.18 to QGIS 3.4. In the plugin, I'm creating new vector features and eventually adding them to an existing vector layer. I'm trying to have the ...
3
votes
3answers
188 views

Following QGIS Python Programming Cookbook to create vector layer in memory? [closed]

I got the QGIS Python Programming Cookbook Second Edition, in hopes of improving my abilities around QGIS as well as making me confident in using Python. Keep in mind that my programming abilities are ...
2
votes
0answers
29 views

QGIS 3 imports DATE type colum in Oracle Database as QDate, losing hh:mm:ss

I am at the moment working on a lift for an QGIS 2 plugin to work with QGIS 3. The plugin specifies a QgsDataSourceUri and uses it in an QgsVectorLayer. In the specific table, laying in an Oracle ...
1
vote
1answer
45 views

PyQgis how could I get the id from a selected feature

using self.iface.mapCanvas().selectionChanged.connect(self.getselectionid) how could I get the id of a manually selected feature on the Qgis map specifically on a vectorlayer? so it can be used to ...
0
votes
1answer
151 views

AttributeError: 'QgsVectorLayer' object has no attribute 'setCacheImage'

When I call the following (using QGIS 3.0.2): self.layerCatalog = QgsCore.QgsVectorLayer( "MultiPolygon?%s" % s_fields, nameLayer, "memory") if self.iface.mapCanvas().isCachingEnabled(): ...
1
vote
0answers
45 views

Get error when QgsVectorLayer is not valid

In QGIS 2.18.16, with a custom plugin, I tried this code to create a new vector layer for WFS: v_layer = QgsVectorLayer(uri.uri(), "my WFS layer", "WFS", False) if not v_layer.isValid(): print ...
1
vote
1answer
84 views

pyqgis 3 QgsVectorLayer.startEditing() doesn't trigger vertex display

In pyqgis 2 standalone application, the following code will trigger the display of vertex as red cross mark, but in pyqgis 3.0.3 standalone application, it doesn't: layer.startEditing() mapCanvas....
4
votes
1answer
493 views

pyQGIS returns invalid layer with QgsVectorLayer in QGIS 3

I have the following problem : I've installed all pyQGIS environment on Windows 7. I work with 64 bits version of Python 3.6 and QGIS 3.0 and PyQt5. My Windows paths are ok. My objective is to create ...
2
votes
1answer
62 views

Create a vector layer in Coordinate Reference System USER:10001

I want to create a vector layer in the this CRS : USER:100001 but i doesn't work. It always tells me, i need to choose the CRS by myself. vl = QgsVectorLayer("Point?crs=user:100001", "...
1
vote
1answer
256 views

Using file path in QgsVectorLayer?

After hours of tries and errors I can't get this right in QGIS 2.99. I want to add a layer with the delimitedtext function in QgsVectorLayer but if I add this code to my plugin, or if I'm running it ...
0
votes
2answers
88 views

Unable to loop/delete with QgsVectorLayer and dataProvider

I have a csv file with the following columns: table geometry field type typeName len precision and my goal is to create a number of shp files programatically with PyQGIS. My script ...
2
votes
2answers
301 views

PyQgis open vector layer attribute table

Is there a Qgs dialog or widget that I can use in a standalone pyqgis application to open the attribute table of a QgsVectorLayer? this seems to be such a simple thing, there has to be an existing ...