Python is an open source interpreted programming language used in many GIS programs.

learn more… | top users | synonyms

1
vote
0answers
28 views

Run a exe file from QGIS

I am trying to run an exe file from the python console in QGIS. my_aplication.exe is a script made in Python3.4 and 'compiled' to windows exe file import os ...
1
vote
0answers
53 views

QGIS 2.8 Python Plugin Unittest Segmentation Fault 11

UPDATE: This issue may be isolated to my MacBook. The seg fault did not occur in testing on Windows. I have put together a sample unit test for a QGIS python plugin. It is causing a Segmentation ...
3
votes
4answers
506 views

Is there anything faster than cursor in ArcGIS Desktop to calculate records?

What is the most efficient (fastest) way to calculate records in a layer in ArcGIS? Is there anything faster than the Cursor in ArcGIS?
2
votes
1answer
50 views

python crashes with returned gdal band object from a function

I wrote these two functions in a module when I want to read the band in NetCDF or HDF files and return the band outside the function. Each HDF and NetCDF has many subdatasets. Each subdataset in a ...
0
votes
1answer
187 views

SnapToCurrentLayer in QGis2.8 with python programming

I have a polygon vector layer and I want to snap the vertex. def canvasMoveEvent(self,event):   x = event.pos().x()   y = event.pos().y()   startingPoint = QPoint(x,y) ...
0
votes
2answers
54 views

Batch Extract by Mask, but customize individual output names

I want to extract by mask (the same mask everytime) on about 500 raster's, but I want to just append the name of every input raster. So if a raster is titled Landsat_010182 I just want to add _clip ...
1
vote
0answers
44 views

Using python to batch process lasclip - LAStools/QGIS

I am trying to use the python console to batch quite a few processes from lastools. I'm having trouble with the arguments to lasclip. clipped_las = processing.runalg('lidartools:lasclip', True, ...
-2
votes
1answer
47 views

Very Large Coordinates when Reading Shapefile using Python

When using Python anad fiona package to read a shapefile of Boston, I am getting very large values in the tens of thousands. Why is this? # Import Boston shapefile shapefilename = 'ZIPCODES_NT_POLY' ...
0
votes
1answer
31 views

ArcGIS desktop won't import arcpy

I have arcgis 10.3 and I am trying to run a task using python but the python window within arcmap won't import arcpy. This never happened to me with 10.2.2. The error returned is: Runtime error ...
6
votes
2answers
1k views

Rendering and Labeling Shapefile with PyQGIS

I've been running into a few problems working with the QGIS API for python. I've gotten more comfortable working in the python console in QGIS but I run into problems when I try to run the code ...
1
vote
1answer
143 views

Python Stand Alone ArcGIS toolbox output feature class becomes input feature class within same tool?

Developing a script in toolbox. I have a table that I use to make X Y layer (input 1) I am saving that created layer as a point feature class. (output 1) I then want to run kriging on that newly ...
0
votes
1answer
34 views

Getting GeoJSON formatted properly for Leaflet?

I am trying to get data put on a leaflet map that I have set up. I am following this tutorial: https://www.youtube.com/watch?v=fDfkjx-VhLI I have all of the html, css and js scripts up and running, ...
0
votes
1answer
352 views

Spatial ETL Tools won't run “AttributeError: 'module' object has no attribute, etc.”

I have a python script that runs 5 Spatial ETL tools that I wish to run as a scheduled task. Each of the tools will run successfully from ArcCatalog and also from the ArcCatalog Command line. If I ...
0
votes
0answers
24 views

Python crashes when I try to import GDAL after re-installing it

A while back I went through the installation process for GDAL by installing the core components and then the Python/GDAL bindings. Everything was fine when I would type in from osgeo import gdal. ...
0
votes
1answer
161 views

How to add mdb geodatabase layer (feature class) to QGIS project using python?

I want to add a feature class of a personal geodatabase mdb to my qgs project by code (a plugin I am working on). I am using a command similar to that used for adding shapefiles, but this is not ...
3
votes
1answer
259 views

How to clip a Oracle query layer directly in a Python script?

I have a query layer directly running from ORACLE database in a MXD. I want to clip this layer with a layer being created in another MXD in a Python based tool. My question is to do this clip ...
0
votes
1answer
564 views

How to install python-mapscript in a virtualenv?

I am on a django project where I want to use the python implementation of the mapserver mapscript library. I was able to install mapserver and python-mapscript from source. However, due to the ...
1
vote
0answers
15 views

QgsPalLayerSettings is not defined

So I'm writing some script for QGIS 1.8 and I'm unable to resolve this error. from qgis.core import * pallyr = QgsPalLayerSettings() The second line gives me error that QgsPalLayerSettings is not ...
0
votes
2answers
70 views

Problems using da.UpdateCursor in python Add_in to Edit Feature Class

I am currently attempting to create a Python Add_in tool which will perform a set of geoprocessing operations resulting in new values for a specific !shape.area!acres calculation on a new layer and ...
0
votes
2answers
60 views

Request for feedback on python script to increase efficiency with cursors

I’m new to python and would love some suggestions on improving the efficiency of my script. Background: My script is intended to create a report of the dominant and limiting soil types for ...
1
vote
1answer
31 views

ST_MakeValid is not working?

I have a polyline spatialite database, tried to perform repair geometry in QGIS using python with the following code: from pyspatialite import dbapi2 as db conn = db.connect(r'D:\db.sqlite') cur = ...
0
votes
1answer
29 views

Problem with arcpy.ValidateFieldName and unicode characters?

I am having problems with the arcpy.ValidateFieldName function in combination with unicode characters. I want to add a field to a shape field. The field name is not allowed to be bigger than 10 bytes ...
4
votes
1answer
275 views

How do I link OGR with spatialite?

Problem & Evidence: I'm trying to create a spatialite file with the code snippet below. However the outDataSource object gets assigned NoneType and all subsequent (unshown) code fails. I'm ...
1
vote
2answers
47 views

How to prompt for layer selection from python console in QGIS?

During script development it's useful to use the QGIS python console to test the same script on different layers. Currently I've been hardcoding layer strings and just swapping out but it isn't ...
1
vote
1answer
70 views

ERROR 000358: Invalid expression “Parcelles_class.OBJECTID” = 1 OR “output_table1.src_OBJECTID” = 1 Failed to execute (Select)

I'm executing this code. I don't know if i'm missing something, I'm using Arcpy, Python, Arcgis 10.1 whereclause1 = '"Parcelles_class.OBJECTID" = 1' whereclause2 = '"output_table1.src_OBJECTID" = ...
2
votes
2answers
81 views

Error 000358 or Error 999999 invalid SQL

i've been searching arround all the answers in the questions of Error 358 and beyond, but i doesn't fix my problems, i tried every post and so on the problems stills there. I make two options in my ...
-5
votes
1answer
50 views

Can somebody help with me with my if statement code on the bottom [closed]

try: # Import the modules import arcpy from arcpy import env # Set up the environment env.workspace = r"C:\Users\Neng\Desktop\Fire_Files_For Oct_2010.gdb" env.overwriteOutput ...
1
vote
2answers
77 views

Changing field values with ArcPy update cursor?

I want to figure out how to be able to change values in fields for use in further projects. Right now , I would like to be able to add '-WA' to the existing field value 53. (ie 53-WA). This is a test ...
1
vote
1answer
39 views

Regarding the Python package PyGeoprocessing, does that need to be installed?

I have not found much documentation on PyGeoprocessing, but from what I have read, I would like to try it out. I downloaded the package from here . . . https://pypi.python.org/pypi/pygeoprocessing. ...
1
vote
1answer
33 views

Event programming in QGIS

I have identified a need to change VRTs raster order through its order of appearance in it's respective XML file. Unfortunately this seems to not be possible to do dynamically using QGIS commands or ...
1
vote
1answer
681 views

How do I find out if a given lat lon is in a KML Linear ring using shapely?

I'm a GIS n00b. I have some LinearRings in a KML file that give the areas for a bunch of different regions. And then I (will) have some lat lons that I want to test to see if they're in any of the ...
0
votes
0answers
32 views

How can i create a table in pgAdmin using python?

i am using below SQl query in python cur.execute('''CREATE TABLE Ambhara_Survey (id SERIAL PRIMARY KEY, geom geometry, chalta_no TEXT, ror_area TEXT, ...
0
votes
1answer
36 views

Import shapfile to Postgis using Python and ogr?

Iam not able to import a shapfile to PostGIS using the same library(ogr). I am using below link but it give me error. Import shp to Postgis using Python and ogr Error : Traceback (most recent call ...
15
votes
0answers
387 views

Calculating Focal Statistics for Special Neighborhood?

I'm looking to calculate focal statistics for each cell of a raster, within a neighborhood of a specified criteria. Background - I have three binary rasters, each representing a single vegetation ...
3
votes
1answer
151 views

Help with Python script to query feature server

For the purpose of saving the data locally from a feature server online I have written code below: import arcpy fcout = r'C:\Forum\Hydrants\test01.shp' url = ...
0
votes
0answers
20 views

layer name and longName are identical when they shouldn't be

I am attempting to use a script to re-source a bunch of layer files in a folder (adapted from Unable to change data source path for group layer file): import arcpy, datetime, os, io, sys def ...
15
votes
6answers
5k views

What tools in Python are available for doing great circle distance + line creation?

I need to use Python to create a great circle distance -- both a number, and preferably some kind of 'curve' that I can use to draw in a client-side map. I don't care about the format of the curve -- ...
0
votes
1answer
338 views

Grass 7 on Ubuntu 14.04. Can't start Grass

I attempted to install GRASS GIS 7 on ubuntu 14.04 using these instructions. When I call grass70 from the command line I get a welcome message and a prompt to continue. I then get two error messages: ...
1
vote
0answers
32 views

Make “qgis:delaunaytriangulation” and “qgis:dissolve” save their outputs on a specific predefined layer

I'm new to python and QGIS. I'm working on modifying a plugin which runs algorithms "qgis:delaunaytriangulation" and "qgis:dissolve" like so delone_triangles = ...
1
vote
1answer
35 views

QGIS script doesn't commit attribute changes

I have a script to generate random points within a polygon, and to give the points the attributes of their host polygon. It generates points, but for some reason it won't commit the changes to the ...
1
vote
2answers
665 views

How to copy attribute values of fields in selected features of one layer to another Qgis programmatically?

I am trying to get the values of attributes of the selected features of a layer field by field and copy to another layer that I created in qgis with pyqgis. Is here a example for this. Every example ...
0
votes
0answers
13 views

List of default attribute of a feature?

I am working with c++/!qt with the c++ api qgis 2.8.2 for a stand alone project application I had to change and add attribute for feature Does anyone know where i can find the default attribute of a ...
2
votes
2answers
52 views

Install QGIS on ubuntu using the compressed format qgis-2.8.3.tar.bz2

I just cant use apt install becuase slower internet connection and size of QGIS can you show me how to do insall using qgis-2.8.3.tar.bz2 file. I have tried decompressing and use the command ...
0
votes
1answer
19 views

Add event listener on QGraphicsEllipseItem

I'm creating a QGis Plugin in python which has a QGraphicsView in which I draw and ellipse on which I want to detect if the user clicks. I know the ellipse inherits QGraphicsItem which has a ...
0
votes
1answer
63 views

Problem doing a coordinate transform with GDAL python

I'm trying to do a concordant transform from the format of the shapefile (3309) to google maps(4326). This code works on one Centos 6.6 box with the SCL python 2.7 and a custom gdal 2.0 build. ...
5
votes
2answers
757 views

Load and display a layer from SQL Server using PyQGIS

I'm having a go at using pyqgis from within the QGIS python console to load a layer from SQL Server and display it. I feel like I'm part way there but I'm having a real issue getting the layer to ...
2
votes
2answers
221 views

Debugging ArcPy ImportToolBox AttributeError: Object: Tool or environment <ConcatenateRowValues_AA> not found?

I am trying to use the ConcatenateRowValues tool provided by ESRI. My overall code for my script is working fine except when it tries to use the ConcantenateRowValues Tool. I start by importing the ...
4
votes
1answer
107 views

Python toolbox tool objects do not remember instance variables between function calls?

I am developing a Python toolbox, and came across a peculiar behavior: The tool objects does not remember any instance variables between function calls. Consider this code: import arcpy class ...
2
votes
2answers
231 views

UpdateCursor on two tables with value from SearchCursor

I try to keep myself busy and learn some python. I have two tables test2.shp (for searchcursor) test.shp (needs to be updated) I want to update test.shp with a UpdateCursor. The column which ...
2
votes
0answers
36 views

Creating new empty vector layer that has same set of atributes as another layer and then copying subset of features into it

I am new to both Python and QGIS. Here's a sample of my code: unique = layer.uniqueValues(index) attributes = layer..dataProvider().fields().toList() assistant_layer = QgsVectorLayer("Point", ...