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

learn more… | top users | synonyms

0
votes
1answer
66 views

SyntaxError: can't assign to function call, arcpy set parameter as text

I have a python script loaded into arcgis ModelBuilder, and when I run the model I keep getting an error when the script tries to run, at the line where I am setting the output as a text parameter. ...
2
votes
1answer
53 views

QGIS gets stuck when running script to automatically refresh layer [closed]

I have a QGIS layer that represents a set of links and nodes to show the streets of a city and the traffic speeds on each street. I've been trying to write a script so that if I change the speeds in ...
1
vote
1answer
52 views

How to exclude a certain attribute from being added to the Processing script output layer?

I have a working script to split a layer by field attributes and save the single features as files: ##[User scripts]=group ##input=vector ##class_field=field input ##output=output file from ...
1
vote
2answers
149 views

Using Python in the field calculator - if/else over multiple fields

I'm trying to work out how to populate a field depending on the lowest score across 6 other fields. I've read several other questions relating to if/else statements but I'm only just starting to learn ...
1
vote
0answers
49 views

How to set time field when generating a GPX track with Python OGR?

I want to generate a GPX file with Python OGR. In particular I want to generate a tracks (layer of features of OGR type wkbMultiLineString) My script is below. I get the error ERROR 1: No such field: ...
0
votes
0answers
42 views

Is there any way to create user login for single project in QGIS?

Is there any way to create user login for single project in QGIS? I want to track changes on database when users update features. I know that I can do this on database level but is there way to do ...
0
votes
0answers
29 views

Invoke PostGIS geocode function using Python

I have a PostGIS Geocoder built with using Tiger data. Using SQL, I am able to execute all database functions and queries. I want to use it with my Python program. One of the option would be to write ...
1
vote
0answers
30 views

How do I compute uncertainties in the positions transformed using Helmert transformation?

I am familiar with Python, MATLAB and Mathematica. My data is given by Cartesian coordinates (positions in X,Y,Z (meters), standard deviations XX, YY, ZZ (meters) and a correlation matrix (XY, YZ, ...
0
votes
2answers
43 views

Performing batch Join Field in ModelBuilder?

I have a list of 250 feature classes (X1, X2 X3, ...) which all have an individual field that I want to join to another feature class Y. The join can be established through a common field that are ...
3
votes
1answer
49 views

What is the replacement for 'setColorShadingAlgorithm' in QGIS 2.6?

I have been struggling with setting the colorshadingalgorithm for a raster layer in QGIS with no success for the past few days. The QGIS cookbook seems to be pretty outdated. Anyways, the code that I ...
1
vote
1answer
40 views

Getting a number from QLineEdit and passing it to the buffer function

I am developing a plugin which finds buffer. In that i am using lineedit for getting distance from the user and pass it to the buffer function. My current code throws an error "'QLineEdit' object has ...
1
vote
0answers
37 views

Pan Sharpening Quickbird Images in Python

I'm attempting to pan sharpen four band images in python with a higher resolution panchromatic band image. I have imported them using gdal and converted them to numpy arrays for the purpose of ...
1
vote
1answer
39 views

WFS, python and updating

I'm trying to develop a script, something that can be run every hour/day/week etc that will look at some shapefiles (initially downloaded from a WFS) compare them to the WFS and download and append ...
2
votes
0answers
55 views

How to Bulk “Add Selected” Attributes to a Relationship Class ~ 40000 Records

I have 2 Feature Classes (FC's) and 1 Relationship class. FC1 and FC2 share a common field with almost 40,000 matching records. For each matching record (i.e. when the matching records from FC1 ...
1
vote
1answer
48 views

Getting values from Qt widgets and using them for a buffer

I am writing a simple plugin that finds buffer. My gui has 2 combo box and 1 Line edit. The first combo box will have a drop down of values from column 'States' and 2nd combo will have a drop down of ...
2
votes
1answer
77 views

How to move layers in the QGIS Table of Contents via PyQGIS?

I have loaded two layers in canvas and would like to move the layers using the following code in TOC, but it is not moving the layers to the position based on the index given. from PyQt4.QtCore ...
2
votes
1answer
35 views

How to apply a filter to multiple vector layers in QGIS?

I am trying to apply an attribute filter to multiple layers in QGIS at once. The filter is to be applied to .osm data brought in through PostGIS to QGIS. I have tried selecting multiple layers -> ...
1
vote
0answers
65 views

Updating attribute table from an Excel file using Python

I am kinda new to Python, please excuse for such a trivial questions. There is a shapefile (let's call it Materials.shp). I have an attribute table with different fields (for example, windows, doors, ...
1
vote
0answers
40 views

Embedding python to select feature in QGIS action

I am working from QGIS actions with python and want go to select the current feature that I've identified using the identify tool. (Key point is that there is a difference between identify and ...
5
votes
2answers
125 views

Automating labels with numbers

Is there a way to strip characters from a string using python? The string is varied in length... Examples of strings: Interstate 10 Auxiliary road 24 State highway 14 I am looking for just the ...
1
vote
1answer
46 views

Python GDAL: Rasterising point data, raster and points are not geolocated

I am trying to rasterise some point data using Python GDAL module. But when I plot the data there is an offset between the two (original points and raster). I am sure it has to do with the ...
3
votes
1answer
61 views

PROJ.4 cs2cs is too slow. Alternative?

I use PROJ.4 cs2cs to convert data from a Lambert Conformal Conic to a geodetic coordinate (NAD83) or vice versa. In my application, sometimes I need to convert a lot of data. Because I call cs2cs ...
1
vote
1answer
52 views

Apply Symbology Layer to a group layers

I have several mxds (located in C:\Project ) that have 250 layers each. All the layers as the same name- "plan" and they all in group layers like that (added picture for example): I try to change ...
0
votes
0answers
34 views

copy WFS features to featureclass or shapefile using python

I'm trying to copy the features from a WFS to a geodatabase but cannot use the ESRI WFS tool because the WFS in question only works with the 'prefer HTTP Post, if available' selected in the ...
0
votes
1answer
45 views

ArcGIS Spatial Analyst in arcpy - FATAL ERROR (INFDEF) DIRECTORY FULL

I have been running into this error in several geoprocessing scripts I've written lately. When I call a spatial analyst function I return this error: FATAL ERROR (INFDEF) DIRECTORY FULL import ...
1
vote
1answer
94 views

Adding field values to a QComboBox in PyQGIS

I have a layer say 'Cities'. There is a column called 'NAME_1' in the layer. My GUI has a QComboBox in which i want the values of column 'NAME_1' alone to be displayed in the drop down of the combo ...
0
votes
2answers
19 views

Arcpy/python Syntax Error. Variable Creation

I'm having a problem when trying to create a new variable within python. i = datetime.datetime.now() tme = i.strftime('%d/%m/%Y') print tme This portion of the code creates a date variable (tme) in ...
0
votes
1answer
43 views

Select by location and copy to new shape and name based on attribute

I have a point features and polygon features. I need to: Select points that intersect the polygons Copy the points to a new shapefile Name this new point shapefile using an attribute of the polygon ...
0
votes
1answer
19 views

Pycsw Harvest SOS Error Exception

when I used the Harvest operation by the pycsw, and there was a Exception as the following picture: Picture 1: The Response of Harvest Operation Picture 2: The document default.cfg setting so how ...
1
vote
1answer
49 views

How do I properly import python sklearn to QGIS PyQt plugin?

A bit of background: I'm somewhat new to python and QGIS plugin development. I've created a plugin structure for QGIS using the Plugin Builder on QGIS and I've added some controls to the gui and ...
0
votes
1answer
44 views

Finding Pseudo Nodes using ArcGIS for Desktop?

Trying to write a python scrip to find and dissolve pseudo nodes for a large dataset. Anyone have any code to perform such a task? For example, I have a road line with several end/start nodes ...
2
votes
1answer
100 views

How to check if an ArcGIS extension has already been checked out manually in arcpy?

I've written a python script that uses a Spatial Analyst function and hence requires the Spatial Analyst extension to be enabled. I would like to be able to check out the extension only if it hasn't ...
0
votes
0answers
11 views

Importing XML Schema, Update/Delete Field Names

Presently, I am trying to write a script to import a XML workspace that contains the outline of schema. I want to create a tool/script that allows the user to import it, specify the number of certain ...
0
votes
1answer
28 views

Sum a field, and take that sum and use it to populate an existing field in the same table

I am trying to break down land uses in a watershed by making a tool in ModelBuilder. Right now I am clipping a land use layer by a watershed polygon, dissolving land use layer by land use code, ...
1
vote
1answer
92 views

How to enable the snapping options for vector layer using the python programming?

I want to enable the snapping options for the the existing layers using python programming. How can I do this?
0
votes
1answer
50 views

How to position the Qwidget form/QDialogBox in the left corner using python programming

1) I am creating a Qwidget Form or QDialogBox using QT Designer. I am using the following code to move the form: sDialog.move(50,450) But i want to fit the dialogBox to fit in the left corner.How ...
4
votes
2answers
107 views

Adding a vector layer at QGIS start

I have added a shape file in QGIS using Python plugin. I want to add this shape file when QGIS is loading so i have to add code in the initgui() method. I have used following code in the initgui() ...
3
votes
2answers
37 views

How do a transform a geotiff image to use the projection of another image?

I have two sets of glib2 data from different sources which I would like to process together. Each image has a different projection and resolution (I don't know if resolution is the correct word to ...
0
votes
1answer
96 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: ...
2
votes
1answer
84 views

How can I iterate over several layers and run a process using PyQGIS?

I am trying to find road intersections within each of my memory Polyline layers (which are named road_layer_i for i in (0-99)) so this is what I tried: import processing self=qgis.utils layers = ...
0
votes
0answers
19 views

Building simple offline map application using Python? [duplicate]

I need to build a simple offline map application using python, which will need some plotting and overlays, using some form of a satellite imagery. I need some help getting off the ground. what ...
0
votes
1answer
65 views

Paper PDF maps to geoJSON

Is there a way to do this? Maps with lat/lng can be analyzed in Acrobat with the analyze/geospatial tool. When a user clicks on the map, the lat/lng is returned. There has to be a way to grab these ...
1
vote
1answer
46 views

Keeping dev scripts in sync with projects

How do you keep your development scripts in sync with your source code management (SCM) and your projects? For instance right now I have things like D:\code\reusable-stuff that goes to an SCM (e.g. ...
1
vote
0answers
70 views

WindowsError: [Error 32] The process cannot access the file because it is being used by another process

I am reading images (through Python) and do something. These images are placed in a temporary file, through: tf = tempfile.mkdtemp(filename) I use gdal to read the images (short part of code): ... ...
1
vote
3answers
211 views

Extract numbers from string field

I am trying to calculate field test2 with only the numeric values from a string field test. The entire script is like: def makestr(test) list=[] for s in test: if s.isdigit(): ...
0
votes
1answer
41 views

GetParameterAsText(arcpy) does not work

I am new in this area. I was practicing the function GetParameterAsText(). I know that when you run the code (for example in PythonWin) it works like the function raw_input(), therefore it should ...
1
vote
1answer
105 views

Error: 'NoneType' object is not iterable (arcpy.ListRasters)

I am trying to extract a raster through a particular shapefile. import arcpy from arcpy import env from arcpy.sa import * arcpy.CheckOutExtension("Spatial") env.overwriteOutput = True ...
2
votes
2answers
119 views

How to load a data table as a 'vector layer' using PyQGIS?

This might be a simple problem, but how does one load a simple two column CSV with no associated geometric data? I have given a couple go's via QgsVectorlayer[delimited text, spatialite] types - but ...
0
votes
1answer
62 views

How to create lines from points from different feature class ArcPy

I want to create lines based on two points: 1st line: point number 1 from pointFc, point number 1 from centFc 2nd line: point number 2 from pointFc, point number 2 from centFc and so on Where did I ...
2
votes
0answers
67 views

How to change the group icon in legend via Python in QGIS 2.6?

How to change the group icon in legend via Python in QGIS 2.6? At version 1.x I did it this way: self.legendTree = self.iface.mainWindow().findChild(QDockWidget,"Legend").findChild(QTreeWidget) ...