The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [python-2.7]

Version 2.7 of the Python programming language

114 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
8
votes
3answers
4k views

Login to USGS Earth Explorer and download Landsat imagery with Python

I want to login to the USGS Earth Explorer website at http://earthexplorer.usgs.gov/ with Python and download imagery from the Landsat Archive collection just by giving it username,password,path/row (...
6
votes
0answers
584 views

Gdal and module import error when creating an .exe application with pyinstaller

I’ve been struggling since three days in a row to create a windows executable application from my python application. I have managed to get results but I’m not at all satisfied with the workarounds I ...
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
0answers
113 views

Performance improvement methods in a shapely environment

I am trying to use the Shapely and Fiona libraries to eliminate polygons from one layer (some triangles) from another layer (which represents the world's oceans). I am looking for suggestions to ...
4
votes
0answers
208 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 ...
4
votes
1answer
162 views

PyQGIS spatial operators(contains,equals,etc.) w.r.t. layer geometries(polygon,point,line,etc.)

I am trying to implement QGIS spatial query functionality in my plugin. I want to eliminate spatial operators which are not suitable for certain geometries. For eg. when I select layer with point ...
4
votes
0answers
627 views

DLL load error calling 64 bit arcpy from subprocess

I have script that imports arcpy, then calls a python subprocess which also imports arcpy: call.py: import arcpy import subprocess cmd = [r'C:\Python27\ArcGISx6410.4\python', 'test.py'] ...
3
votes
0answers
76 views

PyQGIS expression with many inputs

I try to create some advanced expression using a QGIS plugin for education rules. I have a simple Gui : My Gui has 7 line edits for text inputs. I try to using this Expression: layer = ...
3
votes
0answers
364 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-...
3
votes
0answers
361 views

Multiprocessing in python qgis?

When i try to do mutliprocessing in python Qgis it doesn't work from multiprocessing import Process,Lock import multiprocessing def name1(l,i): print i if __name__=='__main__': lock=Lock() ...
3
votes
0answers
630 views

“addItem” in Portal for ArcGIS

I'm trying to upload a .pdf file in the content of my Portal for ArcGIS with a python script. I'm trying with the "additem" REST operation. My code is as follows: import urllib import urllib2 import ...
3
votes
0answers
408 views

Why are my raster mean and standard deviation -1?

I have a set of about 25 rasters whose descriptive statistics I have been examining. The data in the rasters were calculated in Python and the rasters were created using Python-GDAL. In all but one ...
3
votes
0answers
793 views

ArcMap runs custom script once and then it crashes on second run

So I made a script that takes data from an MSSQL database and inserts it into a featureclass. I added the script to a toolbox and am able to run the tool from within ArcMap 10.1. The problem is that ...
2
votes
0answers
60 views

How to capture the event whenever the items inside a listview are checked

I'm developing a plugin in QGIS 2.8.2 using Pyqt 4. Well the idea is using the processing 'qgis:extractbylocation' from the QGIS algorithm provider to capture the studied area # Récupérer tous les ...
2
votes
0answers
42 views

Clipping outside QGIS with PyQGIS?

This is my first script and I having a problem trying to clip a shp file. I'm running on a linux server and this is my code: #! python from datetime import date from qgis.core import * from PyQt4....
2
votes
0answers
94 views

Create a georeferenced raster from a matrix

I am trying to create a WGS84 raster from a matrix like so: from osgeo import gdal import numpy as np test = np.random.random((64, 128)) nx = test.shape[0] ny = test.shape[1] xmin, ymin, xmax, ymax ...
2
votes
0answers
192 views

Dynamic menu actions from sqlite database QGIS using python

I want to have names for menu actions from sqlite database for QGIS Plugin dynamically. try: os.chdir(newPath) con = sqlite3.connect("db.sqlite") cur=con....
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 ...
2
votes
0answers
312 views

'.Simplify' causes 'null geometry' errors (Python, OGR)

Question relates to an earlier one: Can't retrieve geometry (Python, OGR, Rtree) Im trying to simplify a dataset with 180k+ polygons and place the simplified geometries in a separate dataset. ...
2
votes
0answers
283 views

QGIS MMQGIS geocode behind proxy

I have been having trouble with MMQGIS geocoding that I am using behind proxy. Yes I had set the proxy settings from Settings>Options>Network correctly and was able to get connected to the internet ...
2
votes
0answers
522 views

QGIS ubuntu Couldn't load SIP module

I am using Ubuntu 16.04 and installed QGIS 2.18 following the official install details QGIS Installers using link Release with ubuntugis dependencies http://qgis.org/ubuntugis. I have python 2.7.12 on ...
2
votes
0answers
843 views

How to overcome MemoryError from numpy.unique

I am using Numpy in version 1.11.1 and have to deal with an two-dimensional array of my_arr.shape = (25000, 25000) All values are integer, and I need a unique list of the arrays values. When using ...
2
votes
0answers
517 views

SAGA GIS work with python API error

I want to work with python API and SAGA GIS. I am very new with this work. The first step I find one module for example Slope, Aspect, Curvature and I take with right click one python script. python ...
2
votes
0answers
171 views

GRASS GIS: how to run g.run_command(“v.extract”) in Python with sqlite, smooth-spline in GRASS GIS?

I would like to solve several problems by using a python script in GRASS GIS: I already uploaded collected GPS-waypoints and tracks ("v.in.org"), patched several GPS-vector data ("v.patch") and ...
2
votes
0answers
213 views

display of raster in QGIS - cells are not rotated

when viewing rotated rasters in QGIS - the overall raster is rotated (as designed), though each grid cell is not. (the nodata value doesn't appear to pick up as the default in QGIS either - -2.9999e+...
2
votes
0answers
996 views

Unicode Decode Error while geocoding MMqgis

Running Qgis, trying to geocode a CSV file using MMQGIS Qgis gets to the 66th element (there are 119) and returns the error: Traceback (most recent call last): File "C:/Users/BPolinsky.MDC/.qgis2/...
2
votes
0answers
275 views

Error ET Geowizard Clean Polygon() takes no arguments (3 given)

I want to clean polygon feature classes with ET Geowizards (clean polygon) because I cannot find any tool within ArcMap (ArcInfo) that does the same. I have really small gaps within the polygons (but ...
2
votes
0answers
289 views

A list of layer names that you want to be turned off when Layers name are in Right to Left Such as persian

When I ran this code I got "UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal" error I don't know why I tried many way but I ...
2
votes
0answers
313 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 ...
2
votes
1answer
1k views

Using Python script to stack layers from multiple directories and produce multiple outputs in ERDAS?

I am using ERDAS Imagine 2013 and am trying to create a Python script that takes lists created in another script containing the path to each scene's raw data folder and base image ID's (for example ...
1
vote
1answer
33 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) ...
1
vote
0answers
15 views

Earth Engine API (Python) Retrieves script found at a given path as a module not working

Earth Engine API says that require(path) returns an object that represents exported members from the required module. When I try to import ee-palettes with: palettes = require("users/gena/packages:...
1
vote
1answer
49 views

To update Point location every 1 second

I am using update cursor to change the location of a point with FID = 0 every second, but whenever I run the code my ArcGIS freezes and point doesnot move. I am visualizing an output where the point ...
1
vote
0answers
35 views

Snapping line to polygon border using PyQGIS?

I want to snap the line (completely present inside the polygon) to polygon boundary. I tried create 10 m buffer on line start and end point to get polygon and check intersection between line and ...
1
vote
0answers
49 views

QGIS temporary layer to PostGIS table database

I have an empty polygon table in PostgreSQL/PostGIS database with fields (id,field_1). after some processing in QGIS using pyqgis and processing toolbar I create some temporary layer like this case : ...
1
vote
0answers
19 views

Snap pour points not recognizing sample sites as valid points when using ArcPy?

I am trying to go from a CSV of sample sites and a DEM to creating watersheds. I can process the DEM fine to stream networks and can import the points (first to event layer, then convert them to a ...
1
vote
0answers
51 views

gdalcalc.py in Python 2.7 subprocess Popen - not spawning, nor any Exceptions

from subprocess import PIPE, CalledProcessError, Popen import subprocess import osgeo raster = '/home/rphillips/Desktop/tif_dir/merged.tif' raster_dir = os.path.dirname(raster) binary = raster_dir +...
1
vote
0answers
116 views

Numpy import error in OSGeo4W Shell

I and my colleagues are running into a very frustrating Python import error while using the OSGeo4W Shell. Any time we attempt to use gdal_calc in a Python script, we get the following error message: ...
1
vote
0answers
79 views

Using Null Values in Raster To NumPy?

I am trying a convert a raster dataset [a simple 4 x 4] into a numpy array using RasterToNumPyArray. Here is my sample raster dataset: RasterToNumPyArray however, returns zero for Null values: ...
1
vote
2answers
149 views

replaceDataSource() works in ArcMap but not as stand-alone script

I have one script (and one alternative) that I want to use to replace a broken data source. Neither is working outside of the ArcMap Python Window. Has it something to do with the MapDocument object? ...
1
vote
0answers
534 views

ValueError: array is too big

I'm trying to get the value of a pixel from a coordinate. The problem is when I use a large image, so this error appears Traceback (most recent call last): File "D:\algoritmo\teste_read_2.py",...
1
vote
0answers
50 views

Why does my Fiona output look different from my image

I'm trying to export my houghlines as a shapefile, which works. But the output the lines in my shapefile are very different then the generated hough lines that are shown on the image. Example: The ...
1
vote
0answers
261 views

Insert shp into existing Postgis table with python

I'm creating a Qgis python plugin that allows inserting shp into existing Postgis table, i've tried using ogr2ogr and it's workin when I run the command in FWTools Shell but when I try to run it in ...
1
vote
0answers
80 views

How to generalize shape with PyQGIS without much Distortion in the shape?

I was trying to generalize the the inner boundaries of the polygon. Looking for a PyQGIS solution for that any other possible python solution will be fine. I tried convex hull and simplify geometry ...
1
vote
0answers
229 views

PyQGIS composer map add raster layer

I try to follow this example to create a map using PyQGIS in standalone script. But in my case I don't have vector layer but I have raster layer. Here the code : qgs = QgsApplication([], True) ...
1
vote
0answers
18 views

pyqgis composer legend error(no print)

i want to use composer in pyqgis standalone script to create some easy mas using one raster. my output image is correct i have the image but that code cant print show the legend in the map, any ...
1
vote
0answers
673 views

QPixmap: Must construct a QApplication before a QPaintDevice

I am creating a PyQT and QGIS application and im trying to add a combobox to the UI. I have defined the layout of my UI in a separate module to the main module. I know it is an issue with the combobox ...
1
vote
0answers
54 views

Python GDAL calculation differend results

hello i want to create a raster calculation using python GDAL. First i try to use gdal_calc.py that work correct my new raster is correct is the some if i use QGIS raster calculation (some min/max all ...
1
vote
0answers
86 views

pyqgis custom color ramp raster dataset

I want to create a custom raster color ramp using pyqgis in a standalone app. I have found some examples about this task, for example: s=QgsRasterShader() c=QgsColorRampShader() c.setColorRampType(...
1
vote
0answers
321 views

Geodjango PostgreSQL/PostGIS database question

I have a simple django app using sqlite3. My app is simple I have django user authentication system where the user can be upload spatial raster images and can see that images in user personal HTML ...