Questions tagged [python-2.7]

Version 2.7 of the Python programming language

Filter by
Sorted by
Tagged with
3
votes
1answer
109 views

Using tempfiles for intermediate dataset in ArcPy?

I want to create a simple python arcpy script for ArcGIS. Because in my script I have to many raster and shp where I need only to take final result I try to use tempfiles for this unusually datasets....
1
vote
0answers
178 views

QGIS pyqgis custom/standalone script QSQLITE driver not loaded

I'm using PyQGIS/Python 2.7 on a Mac and trying to create a script (for the first time) which will read in a list of csv files and load them as layers. I'll want to define the style of the layers and ...
2
votes
0answers
178 views

Comparing differences between calculated areas of multiple shapefile by using PyQGIS and geopandas python module [closed]

I have calculated area of multiple shapefile by using PyQGIS and geopandas python module but results are not same. Which one is better? logic in QGIS: with edit(eligibleLayer): for gFeat in ...
2
votes
1answer
316 views

Tool validation - setting error message

I am writing a tool within Python Toolbox that has two parameters: param0 = arcpy.Parameter( name="a", displayName="A", datatype="GPFeatureLayer", ...
1
vote
0answers
105 views

Updating raster color ramp and exporting new raster image using PyQGIS?

I have a .tiff raster layer and I want to update raster color ramp with new min/max values using PyQGIS and export to .png image with new color ramp. The update raster color ramp I can do with code ...
1
vote
0answers
225 views

NetworkX read_shp works on Python 2.7 but not on Python 3?

I was trying to implement the same code in Python 2.7 and Python 3.0 opening the same file from the same directory using NetworkX's read_shp function. One, using Python 2.7 IDE and the other is ...
0
votes
0answers
141 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() ...
0
votes
0answers
45 views

Unable to install or use any plugin

My problem is that it's not possible to install any plugin in my QGIS 2.18. When I install it I get this error: Couldn't load plugin 'quick_map_services' ImportError: No module named ...
3
votes
1answer
684 views

Catching arcgisscripting.ExecuteError and error details?

I am with ArcGIS 10.1. In my Python script, I need to catch arcgisscripting.ExecuteError and other general Python errors. When a arcgisscripting.ExecuteError is thrown, I also need to retrieve error ...
2
votes
1answer
424 views

Custom Form in QGIS

So I have created a custom form for my attribute table in QGIS using the drag and drop designer option. I also have an external python init function that I imported. Now Let's say I create a new ...
4
votes
1answer
294 views

Can't Import ArcPy module into Rodeo

I am using Rodeo as my Python IDE for data analysis, and I'm trying to import the ArcPy module in Rodeo. However, when I attempt to import it, I receive the error "No module named 'arcpy.'" I think ...
0
votes
1answer
119 views

GeoNode change uploaded directory path

I am new to GeoNode, I installed geonode stable version from apt-get install geonode on ubunutu 14 and its working properly. Now I want to change uploaded directory to /home/user/uploaded I changed ...
2
votes
1answer
136 views

Updating a QGIS Python script for multiple machines [closed]

I've created a Python script to do some automatic processing within QGIS. The script was stored on the company server and anyone who wanted to use it went to 'add script from file,' did the processing ...
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 ...
0
votes
1answer
190 views

GDAL calculation stop working python.exe any time

i try to use python GDAL raster calculation to take some raster result where i need. i windows user and i work in OSGeo4W Shell. first i try to work using batch file with success. code work with ...
1
vote
0answers
68 views

adding field in multiple shapefiles and adding oid

I am new to Python and programming in general. However, I was trying to find a solution to iterate on multiple (>700) shapefiles in one folder. Each shapefile needs a new field with an ID. I was able ...
2
votes
1answer
195 views

Printing result of custom model in Python using ModelBuilder and ArcPy?

I have a custom model (called TOOLNAME) in a custom toolbox developed in Model Builder on ArcGIS 10.1 Desktop. The model takes two input parameters (SingleFDI_D and dayindex) and outputs a Derived ...
1
vote
1answer
880 views

shapely Accessing Data from Geometry collections

I am new to shapely and python. I recently read Splitting Polygon by Linestring in GeoDjango? and below is the resulting answer. from shapely import wkt from shapely.ops import linemerge, ...
3
votes
1answer
368 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 ...
1
vote
0answers
343 views

python GDAL raster calculation error message

hello I try to follow this post and Friend commend : import os gdal_calc = 'python C:/PROGRA~2/GDAL/gdal_calc.py -A d:/mnt_5x5.tif --outfile=d:/test.tif --calc="A+1"' os.system(gdal_calc) but I ...
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 ...
1
vote
0answers
176 views

Python plugins don't work on QGIS 2.14 for Scientific Linux 7

I'm on Scientific Linux 7 and have been trying to install QGIS. According to the instructions, I need to sudo wget fedora.vitu.ch/EL/qgis.repo -P /etc/yum.repos.d/ sudo rpm --import http://fedora....
3
votes
1answer
614 views

PyQGIS ImportError: DLL load failed:

I'm trying to create a PyQGIS standalone script in windows 10 but I have some errors. First I have read this post and I follow comment of Mr. @caiohamamura but I have semi-success I think, and I don'...
1
vote
1answer
136 views

ArcGIS Server Geoprocessing Service failing on repeat call

Trying to create a geoprocessing service on ArcGIS for Server 10.3 to do some routing on a networkx graph. The service only works on the first call. It fails on subsequent calls. I note this because ...
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....
1
vote
1answer
50 views

Error Opening File?

I have searched the internet for a few hours now and have gotten to the point where I need to ask this. I am currently developing a code that will take a large subdirectory of .xlsx files, read them ...
6
votes
1answer
183 views

ArcPy script runs longer processing time in scheduled task than in ModelBuilder?

I have a Python script that runs ArcPy and a model that is imported with a Toolbox. When directly running the model on ArcMap, it takes 4 plus minutes. It takes about the same time if running in the ...
4
votes
1answer
132 views

pygeoprocessing - raster calculator

I am new in pygeoprocessing and I am trying to do a really simple raster calculation. I would like to calculate element-wise average over several rasters. I first though pygeoprocessing could handle ...
4
votes
1answer
502 views

Changing legend item text with pyQGIS?

Using code I found at Go through items in a composer legend (QGIS 2.6) I can access the the layers in my legend fine. However, I have layers that are styled by category and I can't figure out how to ...
2
votes
1answer
221 views

python postgis query in QGIS problem with encode

I have the latest QGIS 2.18.6 and i try to use some postgis query using python in QGS python console. field characters from mytable is my non-English language and in postgis have encode 'utf-8' and ...
0
votes
1answer
624 views

arcpy DLL load failed in standalone script

I have python 2.7 x64 bit and I have ARCGIS 10.5 x32 bit on windows 10. I try to build standalone arcpy scripts but I take all time : ImportError: DLL load failed: % is not a valid Win32 ...
1
vote
0answers
63 views

pyqgis Python API work together with arcpy Python API in the same standalone script

I create a simple bat file to create standalone scripts using pyqgis. and that bat work nice . I follow this manual now I want to use and arcpy together in the some script but I don't know how to ...
2
votes
0answers
263 views

Using python spectral package? [closed]

I found this tutorial about spectral using python and I will test kmeans classification using Landsat image. I don't understand some things about this tutorial. First thing I can't understand is about ...
1
vote
0answers
174 views

QGIS Creating 4km point grid within polygons

I'm working in QGIS right now to create a grid of points within ~36 irregularly shaped polygons. The spacing on the of the points within in the polygons needs to be 3.8/4km. I attempted using Vector ...
1
vote
1answer
217 views

gdal.VectorTranslate returns empty object [duplicate]

Having the following GeoJSON: {"geometry": {"coordinates": [[[0.0, -89.9999999999], [0.0, -87.5], [120.0, -87.5], [120.0, -89.9999999999], [0.0, -89.9999999999]]], "type": "Polygon"}, "properties": {"...
2
votes
0answers
113 views

Is it possible to use Numba in QGIS? [closed]

I want to use numba package in QGIS. I installed numba in qgis then I want to test a simple code with numba. I used below code from http://numba.pydata.org/ from numba import jit from numpy import ...
2
votes
2answers
477 views

Runtime error using arcpy module

I'm writing an automatization script that auto imports new line features. This has to be done for ~40k line features. The program runs pretty well since i had to optimatize it quite a lot to meet ...
4
votes
1answer
1k views

Saving python Rtree spatial index to file?

I would like to save an Rtree spatial index to file. I tried using pickle.dump, but when I loaded the .p file using pickle.load, the bounds were way off. Here's an example: import rtree, pickle from ...
2
votes
1answer
104 views

Run regexp in PyQGIS script?

Using QGIS version 2.18.11 I have an attribute table with a column of over 500K of records that has many missing spellings, abbreviations and erroneous characters that I need cleaned up on a regular ...
0
votes
1answer
60 views

Applying OTB mean shift smoothing to a folder of rasters using Python 2

I am very new to Python, and am having trouble coming up with a loop script that will allow me to apply a smoothing process to a folder of rasters. This is the script I am using for a single file ...
3
votes
1answer
377 views

Python pyshp reads some field values as None

Reading the records of AL082017_pts.shp in a recent hurricane path file with pyshp results in a lot of None. Here's the first record: sf = shapefile.Reader('AL082017_pts.shp') print sf.record(0) ...
1
vote
1answer
1k views

GDAL/Shapely how to use representative_point()

I am trying to create a single point inside each polygon of a dataset using shapely's representative_point() function. According to the documentation here it is called on a geometry object, so it ...
1
vote
1answer
903 views

Shapely python spatial join - point with line

I have two datasets, one with address points (lat,long) coordinates. And another one with line string geometry (each linestring represents a road). I am trying to find the road name for each address ...
0
votes
0answers
226 views

Using gdalwarp to change raster extent, float value issue (Python 2.7, GDAL)

I am trying to change the extent of a rasterized shapefile to match that of another raster so it can act as a mask for the latter. Other posts suggest using gdalwarp. However, when using gdalwarp to ...
3
votes
2answers
79 views

Adding box to toolbox created with ArcPy (only visuals)?

I was wondering if there is a way I could easily include three parameters into a box (red box in the example) and so when there are a lot of inputs it's easier for a user to spot what data belongs to ...
0
votes
1answer
101 views

Spatial join in Python invalid parameters

I'm getting an error when excecuting a script thats suppose to spatial join two point layers. Code says: Error 000561 Invalid parameters But, I'm pretty certain that they are correct. Can anyone ...
1
vote
1answer
98 views

Empty layers while processing 'extract by location' in Python

I have a folder with subdirectories containing shapefiles. I iterate in those folders to create a dictionary named liste_couches (['name of layer': complete path to shapefile']). The code works fine ...
2
votes
1answer
558 views

QGIS plugin multithreading and loading memory layers

I've been working on a small plugin recently and I wanted to add a progress bar to it, since there are tasks in this plugin that take some time to complete. I looked at this and this, but so far I've ...
4
votes
1answer
743 views

Setting different context menu actions for each layer type with PyQGIS

I want to set different actions(context menu) for vectors,rasters,etc . class MyMenuProvider(QgsLayerTreeViewMenuProvider): def __init__(self, view): QgsLayerTreeViewMenuProvider.__init__(self) ...
0
votes
1answer
256 views

Opening script in Toolset using GPToolDialog()?

I need to open a Python Script using GPToolDialog(), but the script is in a Toolset, not in the Toolbox main path. I tried many ways to solve but do not work, examples: Example 1: pythonaddins....