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

learn more… | top users | synonyms

4
votes
1answer
1k views

Map Algebra expression in a model fails on open workspace

I have model which runs 2 processes that create rasters and a third process that (attempts to) add the two of them using Map Algebra. The expression is very simple, just "%Raster_A%" + "%Raster_B%". ...
3
votes
1answer
476 views

FME values used in python

I need one attribute value from FME and use it in python script as a parameter. How can I do this? Do I have to have def_init_() def input(), def close() also?
10
votes
1answer
465 views

OGR/GDAL threading results in low core utilization

I'm trying to process some raster data using ogr/gdal and I can't seem to get full utilization of all the cores on my machine. When I only run the process on a single core, I get 100% utilization of ...
4
votes
1answer
252 views

How to dynamically view Python script results in ArcMap?

I want to view the output of arcpy scripts (run in Python IDLE) in ArcMap. I tried refreshing the ArcMap data frame after I run the script. This does not work. Please advice me on this.
2
votes
1answer
457 views

How to add GDAL Programs folder to ~/.bash_profile

I have recently installed on Mac OS X Lion 10.7.4 the GDAL Framework 1.9 with Python bindings from [http://www.kyngchaos.com/software:frameworks][1]. I need to add the following Programs folder to my ...
3
votes
2answers
800 views

Python Widget Wrapper ArcGIS Viewer for Flex

I'd like to create a flex wrapper for python code run locally (utilizing arcgis data and outputting data that can be displayed on the flexviewer). I'd like to use gdal or pyproj modules to process ...
3
votes
2answers
624 views

Adding VBA into a Python script generated by ModelBuilder

I have created a model that does a calculate field and have used VBA in the code block. But when I export it to Python, it doesn't work. Here is the VBA code: new_value = ...
1
vote
1answer
449 views

Passing parameters to PostGIS SQL queries in Python: weird behaviour

The following code always goes to the except section and I do not understand why..Any help would be much appreciated. l = None c = conn.cursor() try: s = "SELECT ST_NPoints(ST_GeomFromText(%s))" ...
6
votes
1answer
5k views

issues importing arcpy in Python IDLE

Hi I would want to use arcpy in my python code. I am able to import it through the ARCGIS desktop python console. But I am not able to import it into Python IDLE. I get the following error Traceback ...
2
votes
1answer
506 views

How to display local file's geometries as rubber bands in QGIS

I'd like to get geometries from a local file (e.g. GML) displayed as rubber bands (QgsRubberBands) in QGIS. However, I wouldn't like to load the layer into the map because in the real scenario there ...
1
vote
2answers
181 views

Toggle editing option in plugins

I am working on python plugins for QGIS.I developed the plugins same as RT SQL LAYER plugins. When we draw the layers using query builder of "Add Postgis Layer" option,toggle editing option is ...
2
votes
3answers
4k views

Python script: Access data from databases [closed]

I need to access data that is inside an oracle database using a python script. Its a Unix server running oracle 10g. I dont have much access to the database server. It works fine on model builder ...
2
votes
0answers
161 views

Is there any way to suppress the calculate field dialog box in arcpy script?

I've got a python script that I inherited. The python script takes input from a variety of feature classes and tables and spit it out to a single table. When I run this script via a scheduling ...
2
votes
1answer
733 views

Batch intersect from a text file using Python (ArcGIS)

I am attempting to modify my code below which reads from a text file of shapefiles and executes an intersect and outputs them to a user specified location: import arcpy, sys, os from arcpy import env ...
5
votes
2answers
3k views

ArcGIS 10 Python script to search directories and subdirectories for intersects and clip them

I'm trying to develop a tool that queries our company's data stores for any data that intersects a feature. So when we acquire a new property we can run this tool and it will find all of the data we ...
1
vote
1answer
592 views

How to create a pop-up box if a condition is true in a table? (ArcMap 10)

I'm creating a script that will grab layout data from a table for the current Building Number of the current building my map series is on. It works fine, but I need it to pop up a window if multiple ...
10
votes
4answers
3k views

ArcGIS 10.0 Python SearchCursor file locking

I have a script that gets a value from a shapefile's field to return to the user. It seems that only when the arcpy.SearchCursor is called ArcMap locks the file and it doesn't get removed after the ...
2
votes
1answer
278 views

Directing output to a mirrored file tree. ArcGIS, Python

I am attempting to modify the Batch Project script to: a) read from a text file of file names located on our server b) build a mirror of the paths to those files on my local machine c) output to my ...
4
votes
1answer
733 views

GEOS Python: Taking Union of several geometries

I am using the GEOS/OGR library in Python. I have files full of geometries that overlap, and I want to convert these to files of geometries that don't overlap. The way I have been approaching this ...
4
votes
1answer
1k views

How to assign OGR geometry a spatial reference when writing to a new layer using the Python API?

I'm using the Python OGR API to add new features to a PostGIS layer. However, despite setting the geometry spatial reference, when the geometry is written out the spatial reference is missing. This is ...
2
votes
2answers
477 views

How do I set custom spatial reference/coordinate sys to my shapefile

I have a python code which converts JSON text file to a shapefile. I have to set coordinate system to this shapefile created. I do not want to access the .prj file from my computer as this code will ...
2
votes
1answer
153 views

Merge section polygons in PLSS

I am trying to merge quarter quarter sections of polygons from PLSS into a quarter section. However, I also want it assigned to correct Township/Range/Section while merging. I know I can hand merge ...
3
votes
3answers
578 views

Convert cursor output to list of geometries

I want to convert all the geometries returned by search cursor to a list. import math import arcpy from arcpy import env env.workspace = r"C:\GIS Data\GIS data_for Maeenul vai" desc = ...
6
votes
2answers
227 views

projection tool as standalone script

How would I automate the define projection tool in arcmap so I can just enter my layer each time? I have it as a script in toolbox, but I am unsure how to set it so I can just input my layer as ...
6
votes
3answers
4k views

Using model builder, how can I extract certain fields for 1 selected feature from a point shapefile file with multiple features?

I have a point shapefile that is filled with many features. If I have 1 feature selected I need to be able to export certain fields of that selected feature (ID, lat, long) into a dbf file. What ...
9
votes
1answer
4k views

“Field Mapping” in ArcGIS 10 - ArcPy

I've wrote a Python script that does a spatial join and some simple calculations. My problem is with setting the merge rule for one specific field, and leaving the rest of the fields as is. For ...
3
votes
2answers
492 views

Using Batch Project Script to read from a text file as Input

I was wondering how I would modify the code of the Batch Project script shown below, to read from a text file of shapefile names as input. A sample of the textfile is shown under the code: #Import ...
1
vote
2answers
429 views

FieldPyculator Plugin - How to Classify Fields?

Could someone tell me how to classify/populate fields with QGIS FieldPyculator Plugin? In the Attribute Table, I have a field named POPULACAO with population data: I want to apply a weight to ...
2
votes
0answers
124 views

OpenLayers Issue: plugin crash during opening [closed]

I've encountered problems while loading the OpenLayers plugin in Quantum GIS 1.7.4. My hardware: Windows 7 Home basic 64 Bits My Python crash window: Traceback (most recent call last): File ...
3
votes
3answers
772 views

How to stop ArcGIS Python script printing warnings and other outputs to the console

I've written a Python script using arcgisscripting to do various processing steps on some data. I'm planning to run it from a stand-alone command-line window (ie. not within ArcGIS at all) and, as ...
2
votes
1answer
352 views

AddMessage issue

I wrote the following code as a wrapper around messages pushed durring the running of the script. Using Python IDLE this works fine, but in eclipse I get the following output: def ESRIP(gp,message): ...
4
votes
3answers
1k views

arcpy join field tool is not licensed

I am using ArcGIS and arcpy to process some shapefiles. When I try to use the function arcpy.JoinField_management() the program stops and Python says that the tool is not licensed. This confuses ...
5
votes
4answers
1k views

Does File Geodatabase performance degrade as it fills up?

I'm having a memory leak issue. Upon investigating this more, it seems the file based geodatabase I write to in a loop, is growing very large, and as it grows, it significantly degrades the ...
10
votes
2answers
368 views

Aggregating Polygons To Meet Privacy Requirements

I have a point feature class representing office locations of all employers in a certain industry. The feature class has an attribute for storing the number of employees working at each office. ...
5
votes
3answers
4k views

Select Layer By Attribute using loop

I have 273 features in the feature class and i want to select them one by one and use the statement in the following code. At the line: *arcpy.SelectLayerByAttribute_management ...
0
votes
1answer
740 views

Python: 'Select by Attribute' in ArcMap 10

I would like to get the search the field value 'SURFACE LOCATION%' in column 'RefName' in layer '*.dwg Annotation' This is what I have so far... # Find the Dataframe df = ...
3
votes
3answers
951 views

Adding shapefile directly to geoserver

I have py script which is creating shapefiles using shapefile.py. Once the shapefile is created I have to add them manually to the geoserver. Is there a way to add it dynamically to the geoserver? ...
1
vote
2answers
2k views

How can I save raster dataset using arcpy

I'm trying to save filled raster object to geo database by my specified filename. import arcpy from arcpy import env from arcpy.sa import * env.workspace = r"C:\GIS ...
3
votes
1answer
927 views

How to create an offset polyline in arcpy?

I am trying to create an offset polyline using arcpy, identical to the function in ArcObjects (constructoffset). After trying to access ArcObjects in arcpy, which I found difficult for those not ...
0
votes
1answer
487 views

Defining projection in arc toolbox (JSON to shapefile) in python

I have a arc toolbox which converts JSON txt file to a shapefile but we have to define the projection. How can I hard code the defined projection so that user don't have to input the projection ? ...
2
votes
3answers
839 views

Python and CalculateField

I am having trouble with using Python together with my gp.Calculatefield tool in my python script, and I am not sure why.. Heres the code (UPDATED) import arcgisscripting, os, sys myTempWorkspace = ...
1
vote
1answer
84 views

Filegeodatabase fanout and Python problem

I have fme wb which does fanout with gdb. It means that in the end as output sets of data I get few new created gdb. But If I start this fme wb within python script It does not do fanout. Just write ...
5
votes
2answers
2k views

Use arcpy.mapping to list broken data layers?

I want to list all the broken links in all mxds in a server drive. But whenever I try I get an error come up. Can someone use a specific example, say the drive is D drive, how would I put it into ...
14
votes
4answers
1k views

The best language to program with GDAL

I'm going to start to create programs to handle geographical data from a PostGIS server, and going to use GDAL. According to your experience, with the best language to program with it? I can program ...
3
votes
2answers
162 views

How can I read the settings for the QgsPaperItem from XML?

I saved a template qpt for the map composer and now I want to read all the settings. I am able to insert the items with composition.addItemsfromXML... But this doesn't load the settings for the ...
4
votes
2answers
1k views

How do I convert a text file with coordinates to database table in Python?

How do I convert a text file with point coordinates to database tables in the Dbase.dbf format in Python?
3
votes
3answers
4k views

Add feature layer to display with in a script tool for desktop mapping 'App'

The point of this question is to find a way to programatically change the map extent based on user input. My method involves creating a Feature Layer & Selection, but if you have another ...
6
votes
1answer
457 views

Use Python to find the pathname of “Current” Arcmap

I am trying to find the path name of the current ArcMap document that the python script is currently running in. For Example: "F:\2012\1111\MyArcMap.mxd" I tired using sys.argv[0] as shown ...
3
votes
1answer
463 views

Is it possible to use Python to perform network analysis on only part of a network?

I have a large network dataset and want to perform an analysis on it which would output the start/end point, the distance between them and whether they're first, second or third (etc.) nearest ...
3
votes
1answer
862 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) ...