Questions tagged [python-2.7]

Version 2.7 of the Python programming language

Filter by
Sorted by
Tagged with
2
votes
0answers
300 views

QTableWidget Resize with Dialogue Python QGIS

I am developing python qgis plugin with QTableWidget inside a tabWidget. How can i set my QTableWidget size and QTabwidget with the Dialogue box. So that when someone expand the dialogue box of the ...
0
votes
0answers
589 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 ...
0
votes
1answer
87 views

Calculate the area in sqkm across UTM zones using arcpy cursors

I am trying to update the area field in sqkm of my table using Search and Update cursor from the arcpy library. The area needs to be updated using the different utm zone. I intersected my shp (that I ...
0
votes
0answers
320 views

Importing GDAL in spyder from a local GUI in cygwin

I have installed anaconda on linux (python 2.7). Since gdal is not pre-loaded I load it with conda install gdal, which is fine. When I do: from osgeo import gdal I get the following error though: ...
1
vote
0answers
488 views

PYQGIS standalone app Process finished with exit code -1073740940 (0xC0000374)

I want to create a simple hillshade image using pyqgis standalone app but any time to try it to run my app then I take error : Process finished with exit code -1073740940 (0xC0000374) my system ...
1
vote
1answer
343 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
2answers
3k views

OSgeo4W64 Windows 7 & ImportError: No Module Named Site

I realize this question has been asked a lot, but I was not able to resolve my issue through the answers posted elsewhere... I am new to Python, gdal, OSgeo4W, etc. but have experience with ArcGIS. I'...
3
votes
1answer
804 views

How to import multiple python scripts in one script tool

ESRI gives the option to import a script directly into a tool in your toolbox, eliminating the need for managing both the toolbox and the python script it refers to. I have a script tool that refers ...
1
vote
0answers
385 views

Why does python.exe stop working in pyqgis standalone script?

I want to create a simple standalone pyqgis script but I have some unexpected errors. Here is my .bat file : @echo off SET OSGEO4W_ROOT=C:\OSGeo4W call "%OSGEO4W_ROOT%"\bin\o4w_env.bat call "%...
4
votes
1answer
186 views

Python QGIS plugin could not load on linux build in window

I have created a plugin in QGIS windows version using "Plugin Builder". which on a button click opens another window, that is calling another class in the dialgoue python file, with another .ui file. ...
1
vote
1answer
245 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.
1
vote
1answer
621 views

Why can't I define GDAL_DATA in PyQGIS script?

I created a PyQGIS standalone script in PyCharm my script use rasters layers but any time to try to run it I take this error message: Warning 1: Cannot find pcs.csv Warning 1: Cannot find datum.csv ...
1
vote
1answer
170 views

arcpy.CopyFeatures_management results in empty feature class

I have the function: def copyToNewGDB(workspace,eventdataset): EventDataset_copy = os.path.join(workspace, "eventdatasetCopy") arcpy.CopyFeatures_management(eventdataset, str(workspace) + "/...
2
votes
1answer
736 views

QGIS pythonpath install packages

I use pyqgis to create standalone GIS apps. In my system I have only pythonpath from QGIS C:\OSGeo4W64\bin\python.exe I don't have any other python version. in my installation folder I have a C:\...
0
votes
0answers
226 views

pyqgis error messages using PYCHARM

I use pyqgis in standalone app using python 2.7 in windows 10. I have create some scripts using python idle and work fine without some errors or messages. Now I try to use pyqgis using pycharm ...
7
votes
2answers
3k views

How to define pycharm to understand PYQGIS and GDAL

I use pyqgis in standalone apps and I have defined paths in Windows and Python paths to take python API from outside QGIS. I have created some simple tools using pygis and GDAL in standalone script ...
4
votes
1answer
285 views

PyQGIS composer doesn't change atlas feature zoom

I have found this code in this site and with the some changes I want to create a automate print PyQGIS composer using atlas. The code looks like it should work, I have an error. The code doesn't ...
3
votes
1answer
5k views

how to take cell size from raster using python or GDAL or RASTERIO

How to take cell size per X,Y using simple python or GDAL or RASTERIO? and hot to count how many pixels have my raster with some packages.. I have find some code but is pyqgis and I don't need this ...
5
votes
3answers
2k views

Getting attribute value from vector layer after mouse click in PyQGIS?

I am trying to write a piece of PyQGIS code that runs after a mouse click to collect the Map Coordinate position, and the value of a polygon vector layer within the project under the cursor position. ...
2
votes
1answer
373 views

Re-reload QGIS plugin [closed]

I have created some QGIS plugin using PyQGIS those plugins have different input layer methods, some work to get layer by name from layer panel some plugin have compo_box to define the user where layer ...
1
vote
1answer
147 views

PyQGIS get layers by name errors

I have created a QGIS plugin and I use this code to get my layers by name from layer panel on QGIS. Here the simple code : layer1 = QgsMapLayerRegistry.instance().mapLayersByName("layer1")[0] layer2=...
1
vote
0answers
264 views

JOIN on Oracle table and view with PyQGIS

I have a view v and table st with attributes and SDO_GEOMETRY columns in an oracle database. I want to do an LEFT OUTER JOIN a common value with data filtering on the v. SELECT ST.OBJECTID, V.ID_WS, ...
1
vote
1answer
137 views

OWSLib getmap - how to encode layernames with non-ascii charaters?

Whenever i think I understand encodings, I don't.. How do I correctly send a layername to the getmap function? running python 2.7 from owslib.wms import WebMapService wms_url = "http://ext-geodata....
0
votes
2answers
83 views

Convert ArcGIS SWM to numpy array directly

How do I convert an ArcGIS (10.3) spatial weight matrix (SWM) file to a numpy array directly? swm -->(swm to table)--> table -->(table to numpyarray)--> numpyarray is very slow with 16.000.000 ...
1
vote
1answer
80 views

Trying to update layer location using .replaceDataSource

I'm dealing with several layer files that have out-of-date sources; the actual layers refered to in the .lyr file started in L: and have since been copied to W:/FOR/RSI/DKL/Local_Data . I'm trying to ...
0
votes
1answer
610 views

ENVI files (datafile +hdrfile) not displaying properly in python

I am trying to topographically correct my already atmospherically and radiometrically corrected images. To do so I need to calculate illumination conditions at the time of image acquisition. Terms in ...
1
vote
0answers
134 views

Querying multiple shapefiles using Python and GDAL:OGR

I would like to select everything from one shapefile based on matching ID's in another shapefile. But I am unsure about how to proceed with the syntax using Python. Mainly because .ExecuteSQL('...
4
votes
2answers
3k views

SQL queries in PostGIS database layer using Python and QGIS

I want to create some layers queries in my QGIS plugin using Python. I have find here a question and I try to follow with success (works fine for a shapefile). from osgeo import ogr filepath = 'C:/...
6
votes
1answer
340 views

No “committedFeaturesAdded” signal after dataProvider().addFeatures() - QGiS 2.14.8

I'm working on plugin updating existing shapefile by adding new features to it. And I have a problem with signal that hasn't been emitted by QGIS, when I've added features to layer, using dataProvider(...
0
votes
1answer
284 views

Given a LineString and a Polygon, detect which Polygon nodes are above or below the LineString

I have a Shapely Polygon and a LineString. I want to be able to determine which Polygon points are above the LineString and which are below. Alternatively, it would also be alright if I were to splice ...
2
votes
1answer
100 views

Feature doesn't display on map using PyQGIS?

I want to create a layer using PyQGIS, then draw a point in a specific place on a map and add some data to the attribute table. Everything went fine, the script below works but no point seems to be ...
0
votes
1answer
185 views

UnicodeDecodeError in for loop

I am getting a unicode error while using a combination of an UpdateCursor and csv reader. I'm trying to fix field values that got messed up because ArcGIS didn't read the CSV properly when it imported ...
5
votes
0answers
192 views

PyQGIS composed Atlas generation

I have some layers : layer 1 layer 2 layer 3 and I have create styles for any labels layer using base rule styles and labels and I have create a template .qpt and I use atlas correct. In my ...
4
votes
1answer
2k views

SQL queries in shapefiles using python/gdal return none result

I want try use Python and GDAL to create some SQL queries in my shapefiles. I try something and it looks good, but doesn't work. I get a none result. Here is the code : from osgeo import ogr ogr_ds =...
4
votes
1answer
988 views

Field calculator using pyqgis

I have some fields calculations and I want to create a pyqgis plugin using my expressions but I get Unexpected errors. For example if I do my task using field calculator in QGIS then it works, if i ...
1
vote
0answers
130 views

QGIS modeler and pyqgs standalone programming questions

i have create two model in QGIS modeler one path for raster and one for vector and now i want to create a QGIS plugin from that models but i have some questions. first model : that model work fine ...
5
votes
2answers
451 views

Can't access GRASS GIS modules from within Python 2.7

Using the tutorials posted here, here and here, I am trying to setup a script that will make use of several GRASS GIS raster functions externally. For now I am just trying to get the tutorial script ...
4
votes
2answers
3k views

Interpolating Points using Shapely

Given a distance in metres (x) and two coordinate pairs in lat/lon format (which form a line segment), I am trying to find a point x meters from point 1 on the line segment between the two points. I ...
1
vote
0answers
127 views

Eclipse and PyDev using python from OSGeo4W

I'm trying to setup a PyDev Python Interpreter from OSGeo4W in Eclipse (neon 3 and java 8 on Windows 7 x64). I have installed the latest python 2.7.5 and python 3.6.? from OSGeo4W. I would like to ...
1
vote
0answers
456 views

Python - How to search for a zip file that resides in an iframe on https [closed]

ArcMap - 10.2.2 Python - 2.7.5 Google Chrome First off I am self taught coder and will accept any critique and/or suggestions to any of my posted codes below. This issue has been a joy to work ...
2
votes
1answer
558 views

error sip.setapi(api, 1) in pyQGIS

I have installed QGIS via osgeo4w 32 bit yesterday, to take pyqgis api in standalone script, but I have some problems. I have python 2.7.13 32bit and pyqt4 installed from Gohlke. After, I created a ...
1
vote
0answers
291 views

PyShp ASCII encoding error

I want to filter a set of Point Shapefiles using PyShp. That works fine with one of the file sets (one point shapefile) but throws an error for another set that states: UnicodeDecodeError: 'ascii' ...
3
votes
1answer
217 views

Wrong option for GRASS “v.surf.idw” using PyQGIS

Using Qgis 2.14.12 and PyQGIS, I get an error message when executing the following: processing.runalg('grass7:v.surf.idw', layer, 18, 2.0, 'p', True, "%f, %f, %f ,%f"%(1.635, 1.813, 50.896, 51.0205),...
1
vote
0answers
446 views

Find nearest polygon to point using Python, OGR and Rtree

I have a dataset with points and one with polygons. When the points intersect with one or more polygons they get assigned an attribute value inhereted from the polygon, but not all points intersect ...
1
vote
1answer
344 views

Load raster list in pyQGIS [closed]

I've started learning pyQGIS and the first step was to work on easy things like to add raster and vector in QGIS. So, I found this code in Loading raster layer using PyQGIS? and it works fine and is ...
1
vote
2answers
1k views

TypeError: unsupported operand type(s) for -: 'str' and 'int'

I have 732 temperature rasters (366 min and 366 max temp) that I want to manipulate depending on if the max temperature was greater than a specified and constant crop category temperature. import ...
1
vote
1answer
514 views

How to call function inside another function in qgis python plugin?

I am developing qgis plugin. class HyperspectralClassifier: """QGIS Plugin Implementation.""" def __init__(self, iface): . . self.dlg.pb8.clicked.connect(self.plotspect) def ...
-2
votes
1answer
66 views

Paths and Python question [closed]

I have a problem because I want to store some paths from images by using python 2.7 in Windows 10. Path are like this: var1='C:/my/store/path' and inside the final folder, where in my example is ...
0
votes
1answer
39 views

Obtaining range of values in zones created using Slice tool

I have to reclassify rasters in my workflow into two zones using natural jenks. The Slice tool does the job perfectly, but I would like to print the range of values out in my script to be used as ...
2
votes
1answer
104 views

Replacing NULL values, loop skips records using Python, OGR, Rtree?

I have a point layer with several NULL values and based on a near analysis with another layer, I would like to replace those NULLs. However, with the code I use it only does a couple and then stops. ...