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

learn more… | top users | synonyms

2
votes
2answers
543 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
162 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 ...
1
vote
1answer
104 views

How do I retrieve an arc ascii grid file from NED 1/3 second data using python and OWSLib

I have my bounds, and have been able to connect to the server http://imselev.cr.usgs.gov:80/wmsconnector/com.esri.wms.Esrimap/USGS_EDC_Elev_NED_3? in python. What I don't know how to do is send a ...
3
votes
3answers
632 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 = ...
3
votes
2answers
567 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 ...
5
votes
1answer
1k views

Reproject script in Python with GDAL

I'm having a lot of trouble with GDAL. Besides just the at times lacking documentation, there seems to be little support in Python. Anyways this is just a batch reproject script that goes thusly: ...
3
votes
1answer
301 views

Python SQL connection causes crash in ArcMap

I have the following code which I have striped down to just included the part that is causing a crash in ArcMap. import pymssql # Connect to the Research db using Windows Integrated Authentication. ...
2
votes
0answers
142 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 ...
1
vote
2answers
470 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 ...
11
votes
3answers
5k views

How can I iterate over map layers in QGIS python

I'm having trouble figuring out how to iterate over map layers. I can access the currently highlighted layer in the table of contents via iface.activeLayer() but I want my code to operate on all ...
8
votes
0answers
377 views

Two machines running the same arcpy based software - only one is leaking memory [closed]

Ok, so I'm running a rather large Python application based on arcpy on two separate machines - one of them is leaking memory and one is not. Both are running the same operation in the software. The ...
1
vote
2answers
197 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
1answer
4k views

How to Clear Selected Features in Arcmap using Python

I would like to Clear Any Selected Features using python since it causes an error if I run my tool and the user has a recorded selected. I need some thing here that runs ("CLEAR_SELECTION") first ...
6
votes
1answer
3k views

How to programmatically add shapefile to data frame in Arcmap

I have a toolbox with python script which creates a shapefile from JSON txt file, but it does not show the generated shapefile in arcmap, i have to add it from the output location. What code shall I ...
0
votes
1answer
784 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 = ...
2
votes
1answer
517 views

Python: Run script when opening an MXD in ArcGIS 10

This post is related to Run a Python Script when opening an MXD? I would like a python script to run every time a .mxd is opened. However, the link above uses VBA to do it, which ESRI suggests ...
0
votes
1answer
529 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 ? ...
1
vote
2answers
3k 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 ...
2
votes
1answer
1k views

Outputting results message from spatial statistics tool to text file using Python?

I'm using the following tool in ArcGIS 10 - Calculate Distance Band from Neighbor Count (Spatial Statistics). I'm using a python script to execute this tool several times on different shapefiles: ...
2
votes
3answers
981 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 = ...
10
votes
2answers
470 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. ...
4
votes
3answers
3k views

'NoneType' object has no attribute

I am new to python geospatial programming. i ran the following script and got the corresponding error message >>> import osgeo >>> import osgeo.ogr >>> shapefile = ...
3
votes
1answer
1k 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 ...
4
votes
2answers
2k 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?
7
votes
1answer
692 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 ...
15
votes
4answers
2k 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 ...
7
votes
1answer
2k views

How can i create sectors for telecom towers

friends i am seeking advice from the GIS community I work in the Mobile networks industry and i took up a task to create a plugin for QGIS using c++/python that does the following: step 1: Create ...
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 ...
4
votes
1answer
1k 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) ...
3
votes
3answers
1k 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
1answer
255 views

Using Python in Arcmap to partition strings [closed]

I have a title "Text that remains Proposed Thing to replace" var_a = New Text I want the output to be "Text that remains Proposed New text" Currently outputs this "(u'Text that ...
1
vote
1answer
147 views

Button that allows project search and zooms to site once executed

I am trying to create a button that will execute a Python script. I have limited Python experience. What we are trying to accomplish is to recreate these steps: Query on project Site and Radius ...
9
votes
5answers
5k views

How to workaround large mosaic process which is failing?

I need to mosaic about 550Gb of tif imagery together and the software I have tried keeps failing. The area has been split into zones so that the smallest has approx 200 tiles. I have used the latest ...
11
votes
3answers
4k views

Exporting arcgis features with attachments, for outside ArcGIS

Arcgis 10 features the new ability to add attachments to individual features to feature classes stored in a geodatabase. One use of this would be to add multiple pictures to a specific location, fire ...
6
votes
2answers
1k views

Big Satellite Image Processing

Im trying to run Mort Canty's http://mcanty.homepage.t-online.de/ Python iMAD implementation on bitemporal RapidEye Multispectral images. Which basically calculates the canonical correlation for the ...
1
vote
1answer
1k views

The table was not found error - ArcGIS 9.3.1, Python

I have a python script that does the following on multiple tables maketableView - not shown in code Addjoin Copyrows MakeTableView it was working ok, until all of a sudden it stopped. Heres ...
3
votes
1answer
213 views

Problem with precision when convert from WKT to shapefile

I have a problem with converting from WKT to shapefile in pygdal. In wkt I have fields with precision (for example real 7.2). When I create a shapefile I have field numeric with no precision (numeric ...
6
votes
3answers
5k views

Splitting lines automatically at specific distances using ArcGIS Desktop?

I have a set of polylines which I need to split at varying distances from their starting points. In general, I'm looking for a something similar to the SPLIT function within the editor tool. There ...
3
votes
1answer
3k views

Exporting .jpg files from data driven pages in Arcmap

I have generated about 90 maps through data driven pages(ArcGIS 10.0). I now want to export them as .jpg files in either landscape or portrait format. I tried python but it is not working, it worked ...
3
votes
1answer
186 views

How to unload() a plugin in QGIS 1.7?

I am writing a python plugin for QGIS 1.7 (started it on QGIS 1.6 but switched to 1.7 recently). Since I switched to 1.7 my unload function doesn't seem to be working anymore. Whenever I implemented ...
3
votes
2answers
880 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 ...
1
vote
2answers
999 views

How to automate relative filepath when adding a new toolbox to the arcmap catalog?

So I'm creating an arcpy script for a custom toolbox and I want to make it so that a user can essentially utilize the script in that toolbox without having to change the source path (which I made ...
5
votes
2answers
1k views

How to check if domain already exists?

I am trying to check the existence of domains in my file geodatabase which contains 4 domains (automatically populated after I created some annotation feature classes). My code is as follows: import ...
6
votes
3answers
2k views

Saving *.dbf as *.xls using Python?

i've been let loose in the workplace to learn python to do things in Arcmap10. so, i've learning python as i go and trying to remember the programming i have done. where i am in this project is ...
2
votes
2answers
925 views

Moving all shapefiles (SHP) in MXD to new File Geodatabase (*. gdb) using ArcGIS Desktop?

What I need to do is to move all the shapefiles in an mxd into a newly created gdb, checking prj, and update mxd reference. I have ArcGIS 10 SP4, license ArcView. I studied a bit of Python and get ...
3
votes
2answers
691 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
2answers
983 views

ArcGIS problem accessing fields attribute table

I encounter a strange problem. I have a simple shape file to which I added some fields and then populated them. Now I wanna access those fields from a script to run some buffer operations. I wanna ...
2
votes
2answers
4k views

GDAL: Convert specific RGB (GeoTIFF) color to transparent

I have an RGB GeoTIFF file and I want to convert a specific RGB colour to transparent. I would like to use GDAL for doing this, but external Python scripts are also an option (though I haven't learned ...
6
votes
3answers
2k views

Check if shapefiles exists in folder

In ArcGIS modelbuilder I want to check if a shapefiles exists, if not I want to create the shapefile in that folder. I guess the calculate value tool within ArcGIS modelbuilder can be used, but I need ...
2
votes
2answers
833 views

How to truncate file geodatabase tables with python?

Everything is in the title. I need to truncate file geodatabase tables (1 or all) with python. What is the code for that? Thank you in advance!