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

learn more… | top users | synonyms

1
vote
2answers
1k views

os.system /subprocess.call error handling when error in command line function?

In my Python script I call a GDAL utility using: subprocess.call('gdal_rasterize -a ICE_TYPE -where \"ICE_TYPE=\'Open Water\'\" -b 1 -burn 5 -l ' + shapefileshortname +' ' + shapefile + ' ' + ...
1
vote
1answer
257 views

Export map to geotiff?

I try to export my map (layout or data view doesn't really matter) to a georeferenced tiff-file (geotiff). However, this presumably easy task is proving rather difficult to accomplish. I first tried ...
0
votes
0answers
108 views

Creating Parallel Road Lines

I am aware of the "Copy Parallels" option from the editing toolbar. It works fine when I'm dealing with 1000 roads or so, but when I need to create parallels for 300,000 roads it takes a long time, as ...
2
votes
0answers
110 views

How can i add a north arrow in QgsComposition?

I'm trying to add an svg image of north arrow in QgsComposition using this code: mapRenderer = iface.mapCanvas().mapRenderer() theComposition = QgsComposition(mapRenderer) ...
0
votes
1answer
429 views

How to disable the Escape key for a dialog? [closed]

I may have found the solution to my own question but I have another problem. It turns out that the user can just hit "Esc" and close the form. How can I disable the escape key? I'm looking for some ...
0
votes
0answers
65 views

Accessing QGIS attributes table interface with python

I try to use a python script to manipulate the attributes table windows in QGIS. The only thing I find is how to open the windows for a specified layer : iface.showAttributeTable(observLayer) I ...
1
vote
1answer
126 views

Why does connect to Excel spreadsheet through ArcPy give ERROR 000582?

My ultimate goal is to automate kernel density analysis on xy data from a table. I am trying to learn Python but I am very new. I built a simple model to take table data and display xy data. When I ...
1
vote
1answer
119 views

Python scripts of GRASS in QGIS 2.0

I want to use v.kriger from GRASS through sextante QGIS 2.0, but this command is not here. But I find, in C:\OSGeo4W\apps\grass\grass-7.0.svn\scripts, the command as a python script. How can I use ...
0
votes
1answer
255 views

Plotting 3D Data using Python

I have a Uniform Grid of 1KMx1KM squares as a shapefile with population data in each grid in a specific column as an integer. I would like to extrude each polygon based on the population and export ...
1
vote
1answer
160 views

QGIS Python Labelling

i want to label a point layer with those values exceeding a set of variables attribute table as follows 'loc field'(text),'a'(float),'b'(float),'c'(float) variables as follows vara = 5, varb = 3, ...
2
votes
0answers
107 views

How to display images as cross sections in 3d

I want to display a base map and several vertical cross sections in 3D. The base map image is easy to rectify as a geotiff. How can I also display the cross sections? The cross sections are at ...
0
votes
1answer
256 views

How to add several layers to the table of contents in ArcMap using Python in one shot?

I am already able to add individual layers to ArcMap table of contents using the following codes: # Adding the layer to the table of contents mxd = arcpy.mapping.MapDocument("current") df = ...
2
votes
0answers
45 views

Using the geocode function with cursors

How do I use a cursor with a geocodeaddress function? I want to be able to: 1) read from a table 2) only geocode addresses(from table1) whose street number is not 0 using a cursor 3) then update a ...
1
vote
1answer
107 views

How can i change vertex option programmatically using python in QGis?

I want to activate the option "Show markers only for selected features" in Setting-> options->vertex markers ,using python. does anyone know if i can do it programmatically ? i attached a photo of the ...
-1
votes
2answers
191 views

Python script not working after exporting it from ModelBuilder

trying to figure out why my script wont work (I should mention I'm still at an intro level). This is a script I exported from ArcGIS model builder which worked fine using that: # Import arcpy module ...
0
votes
1answer
87 views

Installing Lecos plugin for QGis 2.0.1 on linux fedora 20

I try to install Lecos plugin, which requires python imaging library (pil), but the installation fails with the following: "you need to have the image library pil installed" I installed the ...
5
votes
2answers
442 views

how would one get the end points of a polyline?

I am attempting to write a script to get the end points of a series polylines, and then use those end points to create a polygon. I'm not sure which tools to begin to use on this project. I would ...
16
votes
5answers
701 views

How to buffer raster pixels by their values?

The pixels to the left represent tree locations and their associated crown radii (i.e. pixel values ranging from 2 - 5). I would like to buffer these raster pixels by their crown radius value. The ...
-1
votes
1answer
218 views

Python code in Field Calculator gives General error executing calculator ERROR 999999: Error executing function?

In a shapefile, I have Field named Elevation with a text field containing integer ranges stored as strings: 1 - 2 3 - 6 2 - 3 8.5 - 12 11 - 12 I need to categorize it using rule that if Elevation ...
-2
votes
1answer
240 views

QGIS converting to ASCII question

I am attempting to do some analysis on a raster file and I need to convert it to ASCII. In QGIS, I used [Raster -> Conversion -> Translate] with the asc file format, and I suspect it is simply ...
6
votes
2answers
497 views

How to write scripts that can call on both Arcpy and PyQGIS?

I have spent quite a bit of time looking for a clear answer this topic and have still been unable to really accomplish my goal of accessing PyQGIS in a stand alone script. Parts of answers have been ...
0
votes
0answers
139 views

ArcMap 10.2 SplitLineAtPoint setSplitRule not calculating RATIO

I am trying to set a length field to use the RATION split policy. I set the split policy for the feature layer but when I use the SplitLineAtPoint_management it does not calculate the RATIO length. ...
2
votes
0answers
87 views

python equivalent of spatstat's spatial point process functions

Is there a free python package (i.e. PySAL?) that implements the standard summary statistics for spatial point processes, e.g. the F, G, J, and K functions? I'm happy to use R (i.e. spatstat) if ...
0
votes
0answers
21 views

How to integrate osgeo4w to main python installation?

I'm not sure if I can do this but I would like to access methods from osgeo4w from my main python27 installation. How do I accomplish this or are you only able to import osgeo4w from the python ...
0
votes
1answer
61 views

python tool parameter: what datatype to list unique values of field?

I'm attempting to convert a 9.3 arcobjects tool to a 10.2 python tool. The form needs to allow user input of a shapefile, a field, and then the user needs to enter numbers corresponding to unique ...
3
votes
2answers
228 views

Python, GDAL, VRT: help wth code efficiency and processing time

I'm going to attempt to make this question as succinct as possible while still including relevant information, as I have trouble with being concise and am trying to avoid writing unnecessary stuff. ...
0
votes
0answers
103 views

Invalid MXD filename in a python script

I have a script that prints and exports a batch of MXDs. It runs fine as long as the lenght of the path and mxd are shorter. I can't tell what the 'sweet spot' is, but I know it runs fine on my ...
0
votes
2answers
529 views

Can you change the processing extent in environment settings using python to a shapefile?

I have managed to do this manually at Geoprocessing>Environments>Processing Extent and setting the shapefile in the drop down bar. I was wonder if this could be automated with a python script? My ...
1
vote
2answers
193 views

Using python to get extent and split coordinates into list

I have the following code: for fc in fcs: desc = arcpy.Describe(fc) ext = desc.extent ext.split(" ") print ext I'm getting error: AttributeError: Point: Get attribute split does not ...
1
vote
0answers
60 views

header information is missing from image, after writing using opencv

I am doing complement of an image using open-cv python, while writing the image, open-cv is not writing the header information in the complemented image. my image data are in TIFF format. i am doing ...
3
votes
2answers
572 views

How to Populate new field using expression containing MAX value from another field in ArcGIS attribute table using field calculator?

I've got one field X with 10 numerical attributes (float/double). I've created a new field Y (also float/double) which I need to populate with the percentage of each record/attribute (in each of the ...
1
vote
1answer
317 views

Calculating Stream Length-gradient Index (Hack Index) with the field calculator

I'm trying to calculate the Stream Length-Gradient Index of a stream (example data below). Just started to get into python, but am struggling with a solution to this problem. I have 42 streams to run ...
5
votes
3answers
678 views

Sqlite, Python 2.7 and Spatialite

I am trying to spatially enable my sqlite database: import sqlite3 db = r'c:\temp\mydata.sqlite' conn = sqlite3.connect(db) conn.enable_load_extension(True) cur = conn.cursor() cur.execute(r"SELECT ...
1
vote
1answer
97 views

Is it a good idea to use GRASS Algorithms for Geoprocessing in a Server Environment?

I´m designing a web-service to run in a server environment that will do some geoprocessing actions to datasets uploaded by users and send the results back. I´m programming in Python, and so far I´ve ...
1
vote
2answers
176 views

How to form SQL Expressions with mix of integer/numeric and text/string fields/values in ArcPy?

I am trying to create a query for the select by attribute function within a Python script.This is my current code. lot = '96' dp = 756421 lotFile = ...
1
vote
1answer
55 views

Python script to select a point within a cell?

I have two features: points and grid cells (vector). I want to select a point within a grid cell (some cell do not have point) using python script and create a new feature layer with below conditions: ...
0
votes
0answers
27 views

Is it possible to create a functioning executable from a python script that uses geoprocessing tools? [duplicate]

I have a python script that uses geoprocessing tools which I would like to package in a Windows executable to distribute to other users. I was able to create an executable with the help of py2exe. ...
1
vote
0answers
586 views

smoothing results from scipy griddata interpolatioin

I am using the griddata interpolation package in scipy, and an extrapolation function pulled from fatiando: import numpy as np import scipy from scipy.interpolate import griddata import ...
1
vote
2answers
61 views

Fill Sinks of multiple rasters in a Python expression

I have 31 rasters that represent different watersheds and I would like to use the Fill (Spatial Analysis) tool to fill the sinks of all rasters at once in Python. All the rasters have the same name ...
-2
votes
1answer
134 views

How to create a link in the message body of email with Python? [closed]

I want to send an email with python that contains as a link in the body of an email as well. This link is actually a path to a file. If a receiver clicks on link It should open a folder where the file ...
1
vote
3answers
760 views

Python: How to create a Polygon Shapefile from a list of X,Y coordinates?

I have a list of X,Y coordinates from a csv file, that represent a polygon. I´m trying to create a Polygon-Shapefile from this list. I´ve been trying around and found a possbility to write the list to ...
1
vote
1answer
226 views

Why does OGR driver.Open() for File Geodatabase give AttributeError: NoneType object has no attribute Open?

There are a number of existing Questions that hint at a possible Answer to this Question, but none seem to be providing me with the solution to my problem: How to access feature classes in file ...
0
votes
1answer
874 views

Error Importing Arcpy - Python

I have written a script and am trying to run it in Python IDLE 2.7.6. I first try to import arcpy, but I get an error message saying "ImportError: No module named arcpy". Why doesn't it work? I'm ...
10
votes
5answers
2k views

Recommended programming language for remote sensing?

I am beginning studies that hopefully will lead to a long career as a remote sensing specialist. I am currently working with ArcGIS for some applications and learning ENVI for others. I have ...
0
votes
0answers
70 views

How to bulk change the schema name of layer properties in ArcMap

I would like to change the data source location (schema) in layer property in ArcMap. Our data are stocked in an Oracle Spatial database. Recently, the DBA has changed the schema name and then I ...
0
votes
1answer
218 views

How can i clip vector layer in qgis and python?

I want to write a python function to create a shape file layer from clipping an input layer using a mask. Does someone know the way how to do it?
1
vote
0answers
66 views

Automate data entry into Access from ArcMap

I have an Access 2007-2010 database that I'm currently working on by manually searching for roads in a defined set of areas in ArcMap 10.1 and then filling in the area's ID in an empty column in the ...
1
vote
1answer
166 views

ListRasters not recognizing raster files in python

I have 2 rasters in my workspace, one in TIFF Format and the other in GRID format: "C:\ExampleFolder" When I use the python script: import arcpy >>> ...
1
vote
1answer
108 views

Delete Turned Off (Unchecked) Layers from Arcmap with Python

I have about 100 figures that have been updated countless times and a lot of the old data was left in each .mxd but was only turned off (unchecked) and not removed. I would like to remove these ...
1
vote
1answer
103 views

no output file with grass:r.los

i'm using qgis 2.0 and i want to calculate a viewshed using r.los from grass tool box. after typing in the python console and a few seconds, i don't get an error message, but there is no file. the ...