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

learn more… | top users | synonyms

1
vote
1answer
62 views

Python in ArcGIS, CalculateField_management, updating with single value

I have a float field which I want to simply update all values with 1. I can easily do this within the field calculator but I have started using python today, what is the syntax to simply update a ...
1
vote
1answer
87 views

Python.dll could not be loaded with PyScripter

I'm trying to configure PyScripter with QGIS. I've installed it using OSGeo4W and I'm following instructions to setup a pyscripter.bat file by copying content of qgis.bat file. I have the following ...
1
vote
1answer
100 views

Python syntax error -can't figure out why? [closed]

This should be simple. I hope I don't get down votes! I just got the following code from an article about using Google Maps API and ArcGIS to calculate routes without network analysis and just can't ...
1
vote
1answer
117 views

QGIS Map tools and Map canvas--QString errors

I'm trying to learn more about using QGIS Map Canvas widgets and creating custom map tools, so the information from the PyQGIS cookbook is very helpful. After trying to experiment with mywnd.py from ...
1
vote
1answer
103 views

PostGIS Type Modifier Error

I'm trying to work an example from the "PostGIS Cookbook" and I'm getting an error I don't understand. I'm running the example using Postgres.app on a MacBook. Postgres.app is running PostgreSQL ...
1
vote
2answers
116 views

Mask image based on no-data pixels in another image with different projection - GDAL or Python

I've got a land cover image which covers the whole globe, and a satellite image which covers a very small part of the globe. These two images have different projections, co-ordinate systems and pixel ...
1
vote
2answers
142 views

Run a model from python problem

I am using arcGIS 10.0 SP5 I have the following code : import arcpy arcpy.ImportToolbox(r"C:\Documents and Settings\Derek\FRAME\FORTEST.tbx", "Derek") arcpy.TEST_Derek() The model is names TEST ...
1
vote
2answers
42 views

Is there a tool that allows the same functionality of extend/trim feature that was available in 9.3?

In ArcGIS 9.3 there was a tool called Extend/Trim Features that allowed you to select multiple segments and extend or trim them to a feature. In 10.1 that seems to have been moved to the Production ...
1
vote
2answers
473 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
46 views

Arcpy MosaicToNewRaster problem

I can't seem to get the mosaic created for this. import arcpy arcpy.env.workspace = r"C:\projectTemp\FloodAnalysis\output\2yr\raster" arcpy.env.overwriteOutput = True srName = ...
1
vote
1answer
110 views

What is correct Where Clause when using variable and Select By Attribute tool within loop?

I have seen several similar posts related to this technique but I am still having issues. The following script is intended to select all points from one shapefile that are within the boundaries of a ...
1
vote
3answers
119 views

How to prevent ArcGIS SOC from locking Oracle tables?

I have a python geoprocessing that performs CRUD operations on feature classes and oracle tables. Sometimes, when handling Oracle tables, ArcGIS SOC gets hung and locks the Oracle table. I need then ...
1
vote
1answer
141 views

Flow Direction Arrows in python

Any help would be appreciated. I am trying to write a python script to determine flow direction on a water pipe network. I have calculated the mid point of each section of pipe and created a point ...
1
vote
1answer
54 views

Unsupported operand error writing to file (Python, arcgis)

In the code below, I get a "TypeError: unsupported operand type(s) for +: 'NoneType and 'str'" on the f.write line. If I don't concatenate, it runs fine, but all the layer names run together. I ...
1
vote
2answers
164 views

Alter validation in ArcGIS script tool

I have a script tool in ArcGIS 10.1. Some of the parameters are optional and if they are left blank, will not be processed. They are numerical parameters and I want to enforce this in the tool, so an ...
1
vote
1answer
104 views

How to reset ObjectID after running Delete_Features on SDE feature table?

I have a python script that deletes all features on a SDE feature table and then inserts new features to it. I noted that the ObjectID keeps incrementing from where the last feature was with before ...
1
vote
2answers
312 views

Programmatically load composer from template and generate atlas using pyQgis

I Am trying to build a plugin to load a print composer from file, generate an atlas and export to image. So far I have been successful in loading the template and exporting it to image. I have been ...
1
vote
1answer
159 views

Automatically determine polygon overlap 'islands'

I have a shapefile with many polygons. Some partly overlap with each other, some are not overlapping. I'm considering a polygon to be overlapping given a minimum area of overlap. 'Islands' of partly ...
1
vote
1answer
130 views

Python code intended to merge files in subdirectories… not producing merged result

The short python code below is intended to merge a series of files (GIS files) which are contained in a series of subfolders. import arcpy import sys import os PointsMerged = ...
1
vote
2answers
85 views

how to identify qgsvectorlayer area?

I need to identify the area from Qgis qgsvectorlayer anyone have an idea how to do that in python ?
1
vote
1answer
125 views

Python/GDAL: Best way to read in raster for use in A* search algortihm

I want to create a least cost path program with Python and GDAL since I couldn't find any open source cost path additions for use in Python. As recommended here the best approach is to use A* ...
1
vote
1answer
144 views

pulling an excel sheet with =rand(between) in a Python while loop, and exporting results as .dbf

To preface my question: I am very new to stack overflow, and relatively new to Python. I am working on setting up a sensitivity analysis. I am working with 40 parameters that range from 0.1 - 1. My ...
1
vote
1answer
207 views

Connect not working for custom QGIS form

So I have a custom form for editting feature attributes. However, I can't seem to correctly disconnect and reconnect certain bindings. The init code is below and should work for any simple QT widget ...
1
vote
2answers
103 views

AML routines and python

I´m trying to use some AML files in ArcMap 10, but I have noticed that this option is not available for this version. Does anyone know or tried to "translate" the aml sequences to another language ...
1
vote
1answer
40 views

How to handle a UnicodeEncodeError with sampling tool?

I'm using qgis and I keep getting an error when using the point sampling tool, its keeping me from getting the sampling done. Does anyone has an idea what is it about? Thanks!
1
vote
2answers
133 views

Erase method using ogr

I'm trying to find the erase geoprocessing method as i am familiar with in ARC, but i can't seem to find it in OGR using Python. I have looked through the module ogr documentation but perhaps i missed ...
1
vote
1answer
133 views

Batch Aggregate Raster using Python

Trying to write a python script to batch Aggregate a bunch of different rasters. get a Parsing Error Syntax error for line 11. # Batch Aggregate raster tool import arcpy from arcpy import env from ...
1
vote
1answer
420 views

importing osgeo module in ubuntu 10.04

I have problem with importing "osgeo" module in ubuntu 10.04; I have installed GDAL 1.7 from source ( 1)./configure 2)make) however, still in python I cant import osgeo module. I appreciate any hints. ...
1
vote
2answers
167 views

How to modify the results of a geological dataset from vertical to horizontal?

I have a 3-D point shapefile of a geological fault dataset consisting of x,y, and z columns. I need to create a raster dataset from this point dataset. I have been trying to do this in ArcGIS; ...
1
vote
1answer
85 views

Create a plugin in QGIS-

i want to develop a plugin in QGIS to access to my database in postgres : i want to import a file.sql that contains my SQL Code in a textbox , and execute this code to assign myd database. Any ...
1
vote
1answer
325 views

Python GDAL/OGR: WGS84 & meters units

I'm dealing with shapefiles projected in: GEOGCS["GCS_WGS_1984", DATUM["WGS_1984", SPHEROID["WGS_84",6378137,298.257223563]], PRIMEM["Greenwich",0], ...
1
vote
1answer
331 views

How to add layer/raster with specific position in the QGIS layer list?

I use addRasterLayer(rast,'Name') but this adds the raster to the top. It is possible to set position when I add raster at once? Is it possible??
1
vote
1answer
575 views

Python GDAL: degrees to meters without reprojecting

I am trying to get senseful results in my Python script. I want to measure distance between features in a shapefile. I'm working with the SRS: GCS_WGS_1984, so my units are in degrees. But for the ...
1
vote
1answer
87 views

Setting More Than One Workspace

I have a number of tables that contain known values in a field. For example, I have a soil type table with one field in it. That field contains a list of known soil types. I have another table that ...
1
vote
2answers
793 views

How to Add Shapefile with Symbology from Layer File to ArcMap MXD using ArcPy/Python?

Say I have a Shapefile: C:\DATA\points.shp A layer file: C:\SYMBOLOGY\symbology.lyr And a map document: C:\MAPS\map.mxd How can I add points.shp to map.mxd with the properties of symbology.lyr ...
1
vote
2answers
730 views

What might cause invalid syntax from ArcPy with Raster Calculator and Multiple Rasters?

I am having trouble for writing script in Python (ArcGIS 10.1). The task is generally divide each raster by 100. I have many of these raster files.... So what I've done is the following: from ...
1
vote
1answer
671 views

Reverse geocoding to get city, state, country data separately?

I have longitude and latitude data. I need to reverse geocode to get city, state, country data separately. I have checked google service. Google provides complete address to a micro level. ...
1
vote
2answers
208 views

Weird File Path Returning from Print Statement Causing ERROR 000732

I have created a python script in ArcGIS 10.1. My first parameter type is a 'Feature Layer' set to as a multivalue input. I was running my script quite well off of data from one of my drives (my ...
1
vote
1answer
96 views

How to save ArcGIS process output to variable?

I've created script in Python for ArcGIS that simplify Line, and make buffer from processed line. input = "input.shp" name = "bord" buffer = "buffer.shp" gp.SimplifyLine_management(name, input, ...
1
vote
1answer
134 views

How to begin with tool development for GRASS gis or QGIS GRASS

I wanted to begin with customized tool development in Grass GIS or QGIS grass. How should i begin in to develop the tool. I search a lot in google search engine for begin with tool development in ...
1
vote
2answers
653 views

Where exactly are qgis.gui and qgis.core located?

I'm trying to create a standalone qgis app using pyqgis, i'll be deploying it by copying the install folder of qgis and source folder of my app, and so for the testing purposes i copied qgis install ...
1
vote
1answer
422 views

How to refresh a Combobox Add-in in ArcGIS 10.1

I need to refresh the value in the combobox after an event from other tool in the same add-in (ARCGIS 10.1. Python). I've changed the value of the combobox with the code: combobox.value = val and I ...
1
vote
1answer
507 views

how to install networkx python in QGIS

How to install and how to compile networkx python on QGIS? I always get an error that no module named networkx in the console of QGIS I copied the file networkx in C:\Program Files\Quantum GIS ...
1
vote
1answer
227 views

.Net to Python - ArcGIS Add-in

Background: I have been tasked with porting a 9.3 .NET toolbar to ArcGIS 10 / 10.1. I am a dyed in the wool Python programmer and, while digging through someone else's .Net is interesting, it isn't ...
1
vote
2answers
446 views

How do results from a Python script get added to an ArcGIS map? [duplicate]

I have a Python script for ArcGIS that makes a new feature class. I can add this to ArcGIS as a new Script (without parameters), however the resulting feature class is not automatically added to the ...
1
vote
1answer
968 views

Python/Arc10- Loop through multiple feature datasets and Intersect Files

I am getting an error with a python script I have created. I have 1 geodatabase with 3 feature datasets. What I would like to do, is loop through 1 feature dataset (NB) to get a list of feature ...
1
vote
1answer
454 views

Raster operation with grass.mapcalc

I need to iteratively add each raster map of viewshed analysis obtained from a series of single observer locations. For this i used grass.mapcalc with Python (GRASS 7 for Windows). However, my ...
1
vote
1answer
104 views

arcpy.sa.CostDistance from Python gives error about number of args but executes fine through Toolbox

I am attemping to call arcpy.sa.CostDistance to calculate the cost distance to a source point as well as generate the optional Cost Back link raster: arcpy.sa.CostDistance("input", cost, "costDist", ...
1
vote
1answer
104 views

keeping the coordinate system of raster files in the resulting raster file after operation with numpy

I'm trying to read as array two raster files using ReadAsArray in GDAL/python, perform some map algebra operation on it using numpy and then write the resulting raster file in GTiff format using ...
1
vote
1answer
2k views

How can I fix “ImportError: No module named qgis.core”?

First of all, I'm using Python 2.7.3, QGIS 1.8 (Lisboa) on Windows 7 pro 64 bits. Now let's go to the actual question: I have written some code (Python) that works well within the QGIS built in ...