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

learn more… | top users | synonyms

1
vote
1answer
1k views

SImple model works, resulting script doesn't

The goal is to convert an XY layer (from Excel) into a feature class. The "MakeXY" portion works flawlessly, the arcpy.FeatureClassToFeatureClass_conversion portion inevitably returns a 999999 "Table ...
5
votes
1answer
2k views

How to Make a New Shapefile Based on Attributes of an Existing Shapefile?

In my last post I had an issue where I wanted to create multiple shapefiles based on only one attribute field (years). How to do it was answered in that post. I want to make that tool more dynamic so ...
0
votes
0answers
33 views

web2py - openlayers

I have used web2py and there is test.py under controllers which shows a map as below: and its code is: for url in [ 'http://dev.openlayers.org/theme/default/style.css', ...
0
votes
0answers
19 views

Reading long lat values from line feature

I have created a vector layer selecting starting point and end point of the line and created the line by line geometry in QGIS. How do i read the all long. lat. values in the line feature? v_layer = ...
1
vote
1answer
191 views

Flatten / collapse one-to-many table and keep the 'many' attributes separate

I have a data set that contains intersection data. Each intersection node has up to 6 links which is identified by IN_LINK and OUT_LINK attributes. I want to create a new dataset that includes the ...
2
votes
1answer
1k views

How to fix python ImportError: DLL load failed: The specified module could not be found?

During import fiona, I am getting following error. Error is different from other user so I asked this question may be it is repeated. import fiona Traceback (most recent call last): File ...
1
vote
2answers
86 views

Debugging 'module' object has no attribute 'SdeWorkspaceFactory'?

I am new to python, am debugging one of existing python code, where am facing an error "'module' object has no attribute 'SdeWorkspaceFactory". Earlier this code was working fine but suddenly does not ...
1
vote
1answer
30 views

QGIS (2.6.1) Processing Toolbox InitGui error after changing /Users folder on Mac OSX

Using: Mac OSX 10.9.4 QGIS 2.6.1 I had previously installed QGIS and had everything running fine. My home directory was /Users/rowanbado, but for another application I had to add an ...
0
votes
2answers
57 views

Shapefile projection for Matplotlib Basemap

Preface: First time working with GIS data. I'm using python's Basemap library for overlaying data on maps. The tutorial I'm using includes a shapefile for London (london_wards.shp). I use the ...
2
votes
1answer
110 views

Python Error while installing Cartogram

I am quite new to GIS and qGIS especially. I would like to install cfarmers cartogram plugin. From what I understand, this has to be done manually - so I 've followed the instructions from ...
3
votes
3answers
574 views

Help with Python and adding a grouplayer to arc, renaming it from a folder name, then adding layers to it from that folder

I am trying to use os.walk to go through a directory tree, pull out all the .shp files in it, create a grouplayer in the mxd, rename the grouplayer the folder name, then add the layers from that ...
1
vote
3answers
53 views

How to return a unique value from table using Arcpy?

Using Arcpy in Python, I would like to return / print '0.15' from the following table: When I use the following code I get "(u'D', 0.20)" as my print statement in Python: import arcpy fc = ...
11
votes
9answers
22k views

Full list of ISO ALPHA-2 and ISO ALPHA-3 country codes

I'm searching for a full list of countries with their country codes. Like on this page (need full and valid): http://www.nationsonline.org/oneworld/country_code_list.htm Thanks.
1
vote
1answer
44 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
1answer
25 views

Creating ArcGIS tool that can run list of checks?

Is it possible to create a tool in Arcmap where by uploading a shapfile, the tool can run a various number of checks/tests (ie intersecting other shapefiles) and flags or highlights conflicting ...
1
vote
0answers
34 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: ...
3
votes
1answer
271 views

How come “Zoom to Polygon” always puts me in the middle of Nebraska?

This is an issue related to this question I'd asked a few days ago. I've got that code working, to an extent. Every time, though, that I double click on one of the Polygons in the attribute table that ...
1
vote
0answers
23 views

QGIS 2.6 SAGA Processing Algorithm, “Add grid values to shapes”, produces NULL Values

I'm using QGIS 2.6 Brighton on Windows with SAGA 2.0.8 installed using OSGeo4W. I have the same versions installed on OSX as well which is not having this problem. On Windows, I'm trying to extract ...
0
votes
1answer
113 views

QGIS Python - Convert the CRS of an in memory vector layer

In a python script of qgis I load layers from different datasources using the QgsVectorLayer() and the QgsRasterLayer() commands. The coordinate reference systems of the data sources differs. Since I ...
2
votes
2answers
2k views

Recoding values based on contents using ArcGIS Field Calculator or Python?

Is there a convenient (or even effective) method for recoding field values using the field calculator or standalone python script? In this case, I am given several unique strings to identify a type ...
0
votes
1answer
49 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. ...
1
vote
1answer
41 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 ...
0
votes
0answers
39 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 ...
2
votes
1answer
36 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 ...
3
votes
1answer
366 views

calling gdal_merge.py into another python script running GDAL processes

Good Afternoon All, I am wanting to use gdal_merge.py to merge a series of .tif files prior to clipping the merged file to a shapefile boundary, but want to do so as part of another larger script ...
2
votes
1answer
200 views

Setting up pycharm and pyqgis

I wanted to set up PyCharm the way this blog post explains: Setting up PyCharm for PyQGIS and Qt. I did everything as instructed but when it comes to adding project interpreters I got this error ...
2
votes
1answer
72 views

How to iterate over features and abort iteration with keypress in PyQGIS?

I would like to run a loop with PyQGIS, it should wait for the user to press a key either SpaceBar or Escape to continue. canvas = qgis.utils.iface.mapCanvas() aLayer = canvas.currentLayer() feat = ...
4
votes
1answer
716 views

Python script/Model to populate cross street names at intersections

Has anyone created a Python version/model of this VBA script from ArcScripts which populates the to and from street names at street intersections? A logical workflow is outlined quite nicely in this ...
3
votes
2answers
964 views

Multiline VBScript Label Expressions in Arcpy

I am able to set simple label expressions, but when I try to set multiline expressions (which all VBScript expressions are) it does not get copied into the expression box properly. I have tried using ...
1
vote
1answer
118 views

using postgis function in pyqgis

I'd use Postgis function in Pyqgis script. This code: qsql="(select gid, id, St_Buffer(the_geom,200) as geom from archi)" uri = QgsDataSourceURI() uri.setConnection("ip", "port", "x", "x", "x") ...
0
votes
0answers
25 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
53 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, ...
3
votes
1answer
45 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
114 views

QGIS Custom Form: “Other” category in combo box replaced by line edit [closed]

I am trying to create a custom form for QGIS 2.0 with comboboxes containing an "other" category. I wonder how to provide a line edit to enter info replacing the "other" choice if chosen. Not sure if I ...
0
votes
1answer
126 views

when using arcpy.mapping.ListDataFrames, python.exe crash

Has anybody had this problem? this drive me crazy. what is wrong with my code? import arcpy mxd = arcpy.mapping.MapDocument(r"D:\Project\Project.mxd") df = arcpy.mapping.ListDataFrames(mxd, ...
1
vote
0answers
26 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, ...
4
votes
1answer
932 views

Get a pixel value

How can i do this operation: I want to get a pixel value fro the satellite image (Landat, GeoTIFF, 7 bands) using qgis-python. What operators should i use? (for example in qgis's Python Console) ...
0
votes
2answers
358 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 ...
4
votes
1answer
135 views

SQL-query in arcpy - SELECT WHERE feature between two values

I need to select features between two values in python with arcpy. However, whenever I try to run the code below, it returns with error message "An invalid SQL statement was used". whereclause = ...
2
votes
2answers
2k views

How to find nearest line to point using ArcGIS Desktop (ArcObjects/Python)?

I am new to building custom ArcObjects, and am looking for a custom python script for arcgis version 10 that will loop through a point shapefile to find the nearest line segment of a line shapefile ...
3
votes
1answer
2k views

processing MODIS hdf files with gdal

I'm trying to open an MODIS file (hdf format) with gdal in a python script under windows OS. I use the HDF4 driver, as read at http://www.gdal.org/frmt_hdf4.html. But when I run it I got this error ...
2
votes
1answer
113 views

How to batch process near feature distance in ArcGIS

I have 2000+ point shape files. These are all GPS tracks. I want to calculate the distance from each point to the nearest feature (road, train line, restaurant etc) within a 30 meter radius. I am ...
1
vote
1answer
44 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 ...
1
vote
1answer
23 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 ...
2
votes
2answers
1k views

Running Different Versions of ArcGIS and Python?

As we know, there are few versions of ArcGIS (9.x,10) and Python(2.x,3.x) are in use. Issues are facing when we run scripts/toolbox of arcgis since the script written in one version of python and the ...
2
votes
1answer
382 views

Importing otb into Python

I have Python 2.7 (installed together with ArcGIS 10.1). Via OSGeo4W a have installed qGIS and otb application.I was able to connect qGIS and otb and it's working fine. Through OSGeo installer I ...
16
votes
5answers
1k views

How are people using Python data structures and classes in ArcPy?

This question may expose my ignorance on programming but I'm curious about how people are using different python data structures within ArcPy. This page lists the data structures in Python. I ...
1
vote
1answer
38 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 ...
4
votes
1answer
256 views

Why is the Frequency Tool in ArcGIS so Fast and Efficient?

Why is the Frequency tool in ArcGIS is so fast and efficient? Is it possible to make my own Frequency Tool with similar performance (in python)? I tried to do some based on python dictionary and ...
2
votes
3answers
1k views

Adding shapefile as layer in ArcMap via Python scripting?

I am trying to automate various tasks in ArcGIS Desktop (using ArcMap generally) with Python, and I keep needing a way to add a shapefile to the current map. (And then do stuff to it, but that's ...