Questions tagged [python-2.7]

Version 2.7 of the Python programming language

Filter by
Sorted by
Tagged with
2
votes
1answer
105 views

Export Feature Class to Geodatabase without SubTypes

I want to export a feature class to a geodatabase using arcpy and strip out any subtypes. But they keep hanging around in the new feature class. How do I get rid of them? This doesn't work: ...
2
votes
1answer
74 views

Adding “cacheControlMaxAge” parameter into sddraft

I would like adding a new parameter into my sddraft, the value of "cacheControlMaxAge". For this, I have the following code that modifies the value of already existing parameters : import xml.dom....
3
votes
1answer
280 views

How to use Arcpy to set Extent to “Union of Inputs”

When I try to append two polygon feature classes, I get a geometry domain error. When using just ArcMap, I know that setting the processing extent to union of inputs fixes the issue. However, how do ...
1
vote
0answers
1k 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
1answer
103 views

GDAL calculation without stop python.exe error?

I want to create a simple raster calculation using python and GDAL and specific gdal_calc.py in osgeo4w shell. BUT any time that before finish my script python stopping I take error : python.exe ...
1
vote
1answer
565 views

Missing Processing Tools in QGIS

The processing tools is missed in QGIS 2.18. I tried Missing Processing Tools in Vector Menu of QGIS? solutions, even install and uninstall several times but every time I get the following error (...
1
vote
1answer
198 views

label orientation after dxf to shp conversion

I'm writing a script with python in QGIS that allows me to convert a dxf file to shp. In the dxf file I have oriented text but after the conversion I lose this information. Is it possible to keep it? ...
-1
votes
1answer
351 views

ArcPy convert raster TIFF to PNG

ArcGIS 10.2 and I use ArcPy and I have create a ArcPy script. I want my final raster from script to create two raster datasets with different extensions, a TIFF extension and a PNG extension. Here is ...
0
votes
1answer
761 views

Encoding issues (UTF-8 to latin1) in the production of shapefiles using QGIS API

We are facing encoding problems with shapefiles trying to convert UTF-8 encoding to latin1/ISO8859-1 using QGIS API. In QGIS desktop over the layer added to the TOC doing "save as" and specifying the ...
1
vote
2answers
4k views

laspy ValueError: buffer size must be a multiple of element size

I am trying to learn LASPY and am running into road blocks off the bat. I first ran into and Error 8 (Not enough storage is available to process this command) using my full sized LAS file (1.7GB). I ...
-1
votes
3answers
41 views

Python code to populate column of district where it intersects

I'm running ArcPy and trying to populate my parcel layer with the district name it falls in. I can manually populate the column by using 'select by location' and then copying the district name from ...
0
votes
0answers
444 views

Django app can't upload multi-band-image

I try to upload a TIFF raster image with 5 bands in Django app and I get error message in form : Upload a valid image. The file you uploaded was either not an image or a corrupted image. I am sure ...
2
votes
1answer
164 views

Using OrfeoToolBox in Python 2.7.9 crashes python

I wanted to create a python script using Orfeo Toolbox for Orthorectification of AWiFS Data. I set the environment variables necessary and the following command runs fine from the command prompt: ...
2
votes
1answer
70 views

ID generator incorporated in fishnet?

I am having difficulties completing a python tool. I am trying to make an ID generator for unique values per grid. This will be a concatenated field of the layer (feature code, XX) + column of the ...
1
vote
2answers
116 views

Column in dbf datatype string, should be float?

This code takes a .csv file, organizes the data and outputs another csv file that is used to create a .dbf file for ArcMap 10.4. The code appends the data as a float into the list 'output' and that ...
4
votes
0answers
237 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 ...
2
votes
1answer
122 views

python install rio-color could not load plugin rio -color

hello I have install python rio plugin to add color ramp in some DEM datasets. I have install using download from GitHub . but if I run rio --help in cmd then : C:\Windows\System32>rio --help ...
1
vote
0answers
111 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
2k views

Python 2 and CSV writerows() encoding [closed]

I need to export data (from layer attributes) to new csv file. I use Python 2.x (Qgis ESSEN 2.14) and native CSV python module. Here is my error : UnicodeEncodeError: 'ascii' codec can't encode ...
1
vote
0answers
314 views

Controlling messages that are pushed to QgsMessageBar() [duplicate]

I've got a QGIS processing script which displays progress in the message bar, using the code in the PyQGIS cookbook. It displays properly at the beginning of processing, but my code calls some other ...
1
vote
1answer
799 views

Unable to create empty memory layer for Line layer using PyQGIS?

# Get the currently selected layer inLayer = iface.activeLayer() # Get its list of fields inFields = inLayer.dataProvider().fields() # Convert its geometry type enum to a string we can pass to # ...
1
vote
1answer
464 views

pyqgis correct activate signal for combo box list

I am a pyqgis user and I am trying to create a QGIS plugin where that plugin have two tabs widgets and two combo box where first combo box have a list from layers and second combo box have list of ...
2
votes
2answers
3k views

Copying multiple .shp files to a file geodatabase

I am trying to copy multiple shape files to a file geodatabase using python. I have been able to copy single .shp files to a geodatabase. Doing this one at a time is tedious and seems easier to do in ...
2
votes
1answer
3k views

raster calculation using rasterio

I have a multi image tif with 7 bands and I try to use rastrio package to create a simple calculation. I follow the docs but that not work for me. any idea ? here the code: with rasterio.open('L7....
1
vote
1answer
333 views

PyQGIS plugin doesn't work layer list combo box

I want to create a simple QGIS plugin with a simple combo box with list from my layers in _ _init_ _ : legendInterface = self.iface.legendInterface() listLayerName = [i.name() for i in ...
0
votes
1answer
314 views

Setting current group as active group in PyQGIS? [closed]

While iterating on groups, I would like to set the current group as “an active group” in order that generated layers will be children of this active group. Is there any pyqgis expression to do this (...
2
votes
0answers
49 views

Why isn't my layer loading via pyqgis despite the file name and path being correct? [closed]

I am writing up a python script on PyQGIS to load a point shapefile. # -*- coding: utf-8 -*- src = "‪‪‪C:/Users/Aaron/Documents/pygis/Points.shp" layer = QgsVectorLayer(src,"Localities", "ogr") if ...
2
votes
1answer
67 views

Strange behavior of QgsScaleComboBox

I am using a QgsScaleComboBox and it's behavior is really strange. I also have 2 buttons in my gui for adding/deleting items. Those are the methods I use for adding/deleting: Adding: def ...
1
vote
0answers
349 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 ...
3
votes
0answers
141 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 = ...
1
vote
0answers
37 views

pyqgis plugin error list has not attributes

hello I create a QGIS plugin using pyqgis and I have two buttons in my plugin window button 1(run perform_search(self) function) and button 2(run select_feature(self) function). to work button 2 ...
1
vote
0answers
484 views

QGIS for Mac: Python dependencies

I am developing a QGIS plugin in QGIS 2.18.15 on macOS 10.13.2 and I am having some troubles with Python libraries dependencies. More specifically, my plugin will require to use an external Python ...
2
votes
1answer
265 views

pyqgis zoom using pyqt list widget

I have created a layer filter Expression to get specific results query from my layer and i add these results in list widget using pyqt. my Expression and my add to list widget work fine(i take ...
0
votes
1answer
482 views

Arcpy Update Cursor-Overwrite values in field based on CSV

I have a CSV file called Modifications. The header has two entries, Rental Object and Rental Object Name. The Rental Object is a string that has matching values in a FGDB feature class where the ...
1
vote
1answer
880 views

Updating Field Based on another Field using UpdateCursor?

I have a feature class in a FGDB called LeasePlans. It contains a field called Property_Ref. I then have a CSV file with a field called SAPNO. For the feature class, I need to check does the value in ...
0
votes
2answers
261 views

arcpy raster calculation wrong result

I want to use arcpy raster calculation to create some script but the output raster to get from this arcpy raster calculation script is different from this to take from model builder in ArcGIS gui,any ...
3
votes
1answer
159 views

Value labels not showing for raster when styled with PyQGIS

I'm developing a script which includes a function to style raster layers (based on Setting 'classificationMode = Continuous' to a raster layer using PyQGIS? and Qgis: style a discrete raster)....
3
votes
1answer
321 views

NumPyArrayToFeatureClass output shapefile does not have field names

How do I retain the values and field names in the resulting shapefile's attribute table after using NumPyArrayToFeatureClass? I'm starting out with a 2d array named npGrid and I'm making it into a ...
4
votes
1answer
3k views

Creating QGIS copy-paste features between two layers using PyQGIS?

i want to create a QGIS action which copies features between two points layers using pyqgis . i have read How to create a QGIS action which copies features between layers? and i try to use this code: ...
0
votes
1answer
294 views

Invalid field name by using GetFieldAsString from ogr.py [closed]

I use a little algorithm to transform values from an openstreetmap-file into a table (.dbf). I use the function: GetFieldAsString("string") from ogr.py and everything is fine, but when the "string" ...
3
votes
1answer
151 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
247 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
204 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
507 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
113 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
274 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
199 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 ...
4
votes
1answer
1k 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
512 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 ...

1 2 3
4
5
14