All Questions
Tagged with data-source pyqgis
9 questions
0
votes
0
answers
19
views
Dynamic WHERE clause in setDataSource in PyQGIS
In PyQGIS, I want to create a layer according to the value of two variables (not hardcode values). This is a piece of my code, but the layer is not valid.
var_a = "Miami" #hardcode
var_b = &...
3
votes
1
answer
78
views
Changing layer provider (datasource) from shapefile to PostgreSQL with PyQGIS
I have a QGIS project with several layers using shapefiles.
I want to change the datasource of each layer using a PostgreSQL table to replace the shapefile source.
I tried this code, but nothing ...
1
vote
1
answer
437
views
QGIS - Change data source location
I am currently working on a model allowing me to extract and save the entities extracted from different sources. So far, with the graphical modeler, i managed to perform the extraction and the save ...
1
vote
1
answer
31
views
QGIS 3.10 last point features created are not recognized by snapping - update source?
I am created a plugin that creates point features and line features from a SpatiaLite database.
The lines must be snapped to a point at least in one end.
Then problem is that the last created point ...
1
vote
0
answers
625
views
PyQGIS -"invalid data source" when trying to open several .shp files
I have a folder with almost 3000 subfolders, each containing several ESRI shapefiles. I tried to write a script to read each of these files, do some basic analysis on them and store new files in those ...
2
votes
1
answer
55
views
Retrieving PostGIS selected table in PyQGIS
I would like to use the layer selected into the explorer's windows.
My aim is to launch script using the name of the PostGIS layer selecter in this windows.
Is it possible to retrieve the table ...
9
votes
3
answers
2k
views
Getting provider name of layer using PyQGIS
In QGIS 3.16.5-Hannover, with PyQGIS I want to get the provider name of a selected layer. I need to know if it's an ESRI Shapefile layer or a PostGIS layer for example.
I don't see how to get this ...
0
votes
3
answers
894
views
PyQGIS script to add multiple delimited text layers from folder to project
I have a folder of ~120 csv files.
I would like to add them all to my QGIS project.
I know this is accomplished with the 'Data Source Manager' and 'Delimited Text' option. However, instead of adding ...
2
votes
1
answer
696
views
Changing txt layer Data Source in QGIS only using Python console?
I want to change the data source of a layer (non geometric, just a table of fields) created from a .txt file. I know how to do it manually but I want to do it with the Python console. I have tried the ...