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
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [qgsvectorlayer]

The tag has no usage guidance.

0
votes
0answers
9 views

QgsVectorLayer, configuring ogr uri for a shapefile (to set field datatypes)

I'd like to load a .shp and set the data type of one of the fields. I thought something like this would work: uri = 'C:/myfile.shp?field=myfield:integer' vlay = QgsVectorLayer(uri ,'some_name','ogr')...
1
vote
0answers
68 views

QGIS: Zoom to selected feature via plugin doesn't works in first attempt

I recently migrated from QGIS 2.18 to QGIS 3.6. In the plugin, I load a vector layer and then select and zoom to a particular feature. This worked fine in v2.18 but now on 3.6, what happens is the ...
1
vote
1answer
37 views

Overlay raster above uploaded shpfile but behind background?

I have a .shp file of the world oceans (hydropolys.shp) and create a map with it in QGIS, so the background of the image is the land. Does anyone have any suggestions on how I can overlay my raster ...
1
vote
0answers
22 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):...
1
vote
1answer
149 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
279 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
39 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
75 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
198 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
72 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
109 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
715 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
68 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
293 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
99 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
333 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 ...