All Questions
Tagged with qgis-2 python-2.7
28 questions
1
vote
0
answers
217
views
Listing items using QGIS combo box from PostgreSQL
I am building a plugin for QGIS which will have a combo box listing data from PostGreSQL.
I have already connected PostGreSQL.
Now I would want to make this a plugin and add the list of jobs to the ...
1
vote
0
answers
29
views
Getting (0,0) instead of the intersecting co-ordinates value
This code works below fine when line(The Circle I mean) intersects more than two new lines but fails when both the intersection falls in the middle of the same line
polygon_path = iface.activeLayer()
...
1
vote
0
answers
116
views
Renaming pre-existing table Field name using PyQGIS
I am using PyQGIS with QGIS 2.84.
This is the code I have used:
layer = iface.activeLayer()
parking_layer_field_names = [str(i.name()) for i in point_layer3.pendingFields()]
layer.startEditing()
...
1
vote
1
answer
95
views
Turn string data (of GPS coordinates) into a GPS tracker = frozen map. QGIS2.14/Py2.7/Win7/LAN
I am currently involved in a student project which is to turn string GPS coordinates into a GPS tracker. This is my current work: First, the UDP data is shared through a LAN (No internet available) ...
2
votes
1
answer
656
views
Getting coordinates on click and pass it to dialog using PyQGIS?
I am creating a plugin in which i need to get coordinates by clicking on QGIS canvas so i tried the solution mentionned at Getting coordinates by clicking on QGIS Canvas with PyQGIS? but it didn't ...
4
votes
1
answer
1k
views
Filter vector layer by searching through complete attribute table - limitations and improvements
In a case were I have a shapefile with a lot of attributes (predominantly text), also I don't have any information about the structure and I don't have any idea in which attribute I have to search/...
1
vote
1
answer
102
views
Loading shapefiles in standalone PyQGIS application without GUI
One of the related questions mentions an issue with import order, but I don't think that applies here because this is a command-line script: I'm not using Qt, only QGIS libraries.
I'm trying to run ...
4
votes
2
answers
3k
views
PIP no longer works with QGIS 2.18.x Python (TLS version no longer supported)
We've run into a problem installing Python packages (using pip) for use with QGIS 2.18.x (error messages copied below)
Our diagnosis is that:
Pypi now requires TLSv1.2 support (http using TLSv1.0 ...
5
votes
0
answers
299
views
Get signal on delete group on QGIS 2.18.16
I tried :
QgsProject.instance().layerTreeRoot().willRemoveChildren.connect(self.onWillRemoveChildren)
It works if I delete a group within in the root node. But if I delete a layer within a group ...
0
votes
0
answers
245
views
Zooming to particular feature among selected features by feature id in PyQGIS?
Using QGIS 2.6 and PyQGIS, I want to zoom to features one by one on click among selected features list and change the colour on zoom without unselecting the other features.
canvas=iface.mapCanvas()
...
4
votes
1
answer
641
views
QGIS 2.18 : Choosing path of file for Python init function
I'm using a custom feature form for QGIS 2.18 (custom .ui file + custom Form.py file containing the Python init function used by the form). I would like to be able to put the .ui file and the Form.py ...
0
votes
0
answers
697
views
QGIS 2.18 python error
I very new to all the python-QGIS issue. I try to run this one line code in order to know if the PYTHON 2.7 recognize the modules of QGIS:
import qgis.core
and got this error:
Traceback (most ...
1
vote
1
answer
621
views
Removing the existing context menus from legendlayeractions QGIS 2.6.1 using python
a = QAction( u"My Action", iface1.legendInterface() )
iface1.legendInterface().addLegendLayerAction( a, u"My Plugin Menu", u"id1", QgsMapLayer.VectorLayer, True ) #adds action
iface1.legendInterface(...
1
vote
1
answer
450
views
Hiding QGIS toolbars through python code?
for eg.
iface.rasterToolBar().setVisible(False)
this works from python console of QGIS 2.6.1 but does not work from plugin code.
3
votes
0
answers
476
views
minidump written to C: in QGIS PLUGIN
I have created a simple QGIS script using QGIS 2.18.3 and windows 10 and it works fine without errors.But I want to move that script to another PC where I have QGIS 2.6 and windows 7.
I first copy-...
0
votes
2
answers
235
views
Python code execution error in QGIS WIEN
I have tried to make several different actions in QGIS but keep getting similar error messages when I try to select the output filename. The error message reads as follows:
An error has occurred ...
-1
votes
1
answer
748
views
How to capture the event whenever the items inside the listview is enabled or disabled and get the number of enabled checkboxes inside the listview [closed]
I have a function "openBrowse" which will allow the user to select SQL files from a local path and display the file names as with dynamic checkboxes created based on the number of files selected ...
1
vote
0
answers
264
views
How can i set layer polygon in center in QGIS using python?
I am trying to set a fixed zoom level whenever I layer is shifting on different polygon. I have coordinates for all the polygons , I need each polygon to be on center with certain zoom level so that ...
1
vote
0
answers
452
views
Label layout on python in QGIS
Now the only issue is that in image I am not getting the labels, I have on polygon. Please help in that too Please see above attached screenshots here I need labels –
I have updated QGIS it's version ...
2
votes
0
answers
3k
views
Finding and deleting duplicate records in attribute table in QGIS [duplicate]
I have around 1 Lakh+ (100,000+) point features in my shapefile, which has some duplicate records in it. I had found the duplicate records present in the attribute table and print those in python ...
1
vote
0
answers
122
views
Buffer Csv gets repeated when more than one feature is selected in mapcanvas in PYQGIS
I have a function which will allow the user to select a feature or more features in map canvas and performs buffer for the selected feature(s) and writes the output to a csv file. I dont have any ...
1
vote
1
answer
145
views
if condition is false but output is true . what is the exact expression of greater than to bands value ('mjune@1'> 99.6:)
from qgis.core import *
from qgis.gui import *
from qgis.analysis import QgsRasterCalculator, QgsRasterCalculatorEntry
from math import *
from PyQt4.QtCore import QFileInfo
import os
from osgeo ...
0
votes
1
answer
278
views
QGIS 2.6 Crashed for my own plugin
I had developed a plugin that counts the number of features for a layer in QGIS 2.6. I am using Windows 7 os. It works fine when i loaded a layer. But when I remove that added layer and then if I ...
1
vote
1
answer
8k
views
Attribute Error: 'NoneType' object has no attribute 'name'
I am developing a plugin that counts the number of features for a layer in QGIS 2.6. The plugin works fine when there is a layer but when there is no layer, it throws an error. For reference, a part ...
2
votes
1
answer
4k
views
Use PyQGIS to import CSV and draw points using different color
A CSV file contains columns latitude, longitude and color.
uri = "file:///C:/data/balls.csv?type=csv&xField=longitude&yField=latitude&spatialIndex=no&subsetIndex=no&watchFile=no"
...
9
votes
2
answers
10k
views
Zooming to layer extent in PyQGIS? [closed]
Regarding my plugin pyqgis 2.2, i can load a vector layer succesfully. But when i try to zoom to the layer extent it does not work.
How to do in order to zoom to the layer extent?
I have just ...
4
votes
0
answers
569
views
Get signal on edited feature?
Regarding my pyqgis plugin 2.2 , I've implemented signal on a vector layer event successfully. For instance, whenever i create a new feature, i can read a new basic message appeared via QGIS logging ...
4
votes
1
answer
2k
views
Programmatically selecting features by polygon
Expanding upon this post how could you use QGIS to programmatically draw a selection polygon and select features within the polygon? I have been using QgsMapToolEmitPoint(self.canvas), to find and ...