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

learn more… | top users | synonyms

8
votes
3answers
3k views

How do I use variables from one Python script in other Python scripts?

I want to set up a single python file containing variables that have the locations of all my data sources. This would then be used by all my other scripts, then as a data source changes, I only have ...
4
votes
1answer
823 views

occasionally empty search cursor looping through a raster list with arcpy

I'm looping through a raster list, to export cell counts (from "Count" field in the table) to a text file, I'm only interested in cases where the field "Value" = 1, so I have included this in my ...
3
votes
3answers
748 views

Is it possible to create a python script to rec/post versions?

I’m trying to set up a python script so that I can schedule our rec/post to run on a server. I’ve created a model with the Reconcile Version tool, with the option to Post checked on. I then export ...
3
votes
2answers
3k views

Dealing with empty feature classes in a ArcGIS 9.3.1 Python script

I have a script that goes over all the feature classes within a geodatabase (in ArcGIS 9.3.1) and copies them. The problem (as far as I can understand) is that when the script goes to a empty feature ...
5
votes
2answers
1k views

Can a “Join” be detected programmatically?

I have some Python code that is launched from within an ArcMap project. Any joins that the user may have created in the project must be removed in order for my code to run. Unfortunately, the code ...
8
votes
1answer
338 views

Running ArcGIS 10.0 Under Virtualenv

I am working on a Python package that has a mixture of command line tools and ArcToolbox tools. For Python development it is really useful to use VirtualEnv, especially when working with installers. ...
6
votes
2answers
2k views

Is it possible to access ArcGIS's table operations “Summarize…” and “Statistics…” in python?

ArcGIS has a few nifty table tools, including Summarize and Statistics. Is there a way to access them through arcpy, or will I have to hack my own methods via math and lists?
5
votes
1answer
934 views

Rescale Raster Band With GDAL Python Bindings

I am trying to figure out how to rescale a raster band's pixel value using the GDAL python bindings. I am looking to emulate the -scale switch in gdal_translate.exe; rescaling the pixel values in my ...
9
votes
2answers
660 views

Scriptable alternative to ArcScan (particularly vectorising lines within tolerances)

Sadly the answer to this question suggests that it is not possible to script ArcScan from within a python script. Therefore, does anyone know of any alternatives to ArcScan (either within ArcGIS, or ...
5
votes
2answers
959 views

Backwards compatible python scripts in ArcGIS

As I move through my small collection of python scripts written for arcgis 9.3 I'm discovering that many things work with little or no changes in arcgis 10. For example this pattern "just works": ...
2
votes
2answers
1k views

Putting multiple lines of Python into ArcGIS 10's Field Calculator

I've gotten some incredibly valuable help here on this already, much Thanks. Entering these lines of Python one at a time works like a charm.... Just need one more seemingly simply issue solved... ...
1
vote
2answers
1k views

unique value symbolize layers from a lookup table

I need to create a large number of Arcmap layer files (v9.3 or 10), perhaps a hundred, from lookup tables. I don't have to set the symbol patch itself, that can be random, but I do need the value and ...
0
votes
0answers
488 views

Change from data --> layout view using arcpy? (ArcMap 10)

The opposite, from layout to data, was asked and answered, but I can't figure out how to switch to the layout view from data view using arcpy. Can it be done? Thanks.
3
votes
2answers
1k views

Is it possible to get arcpy on 9.3* or Qgis? Or maybe some of the functions?

If this isn't possible what would be the closest equivalent open source? Could parts of the module be ported to work on 9.3 or QGIS? I'm not sure if this would infringe on the license porting for 9.3. ...
1
vote
1answer
100 views

CalculateDefaultGridIndex

Has anyone found that using CalculateDefaultGridIndex in arcGIS9.3 does not return the ';' delimited string suggested in the documentation?
5
votes
2answers
937 views

Using an integer variable in where-clause in arcgis python script

I've seen some questions on this, but there seem to be many different answers... and none have seemed to work. I'm trying to include an integer variable in the SQL where-clause of a tool like this ...
3
votes
1answer
142 views

Calling LineString.closestPoint or LineString.project methods from Python?

I'm trying to use the GEOS library from Python, specifically via Django (django.contrib.gis.geos). Looking at the GEOS documentation, there are two methods on LineString I want to call that aren't ...
8
votes
4answers
425 views

Joining lines when direction is not known

I am struggling with this problem. I have a polyline made up of several segments. Each segment is made up of points, each point identified in 3D space by coordinates and elevation. Together, if ...
5
votes
1answer
807 views

Problem with deleting file locks in ArcGIS 10

I did not realize that I should have been deleting cursors after accessing attribute tables until today. Up until now I never did this, but I've noticed that there are lots of file locks after my ...
3
votes
1answer
1k views

Count of raster cells as variable in arcgis 10 modelbuilder

I want to use a cell count of an integer raster as a variable in Arcgis 10 modelbuilder (and later in a python script), but can't seem to find how to access this information. Is there a (python) ...
2
votes
2answers
740 views

Any python script to convert a geoPDF to a KML embedded with a jpg link?

I have many geoPDFs. I want to turn them into KMZ or KML+JPEG using a python script. Any suggestions? SEE CODE BELOW
0
votes
1answer
1k views

Arcpy and arcobject [duplicate]

Possible Duplicate: How do I access arcobjects from python? Hi : I'd like to begin programming with Python in ArcGIS 10 by Arcobject.but i don't have any experience about python and ...
2
votes
2answers
2k views

How to recode field values based on field contents?

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 of ...
1
vote
1answer
696 views

How to Convert Code from VB to Python in Map Algebra?

I have a problem with Map Algebra in ArcMap 10 to convert some codes made by VB, so i need to convert it to python to work in arcmap 10 without problem. and can any one help me how do i deal with map ...
0
votes
1answer
421 views

Update, Insert Cursors don't work on Features that have annotation?

I've been working on a script to update my feature classes by grabbing new data from one feature class, and applying it to another feature class. It does this with several cursors, basically get ...
3
votes
2answers
3k views

How to export selected records to a .txt file

I am working on a project where I need to create a tool/method to export the attributes of selected features to a .txt file. I have point features containing addressing information, and the tool ...
5
votes
2answers
2k views

Cannot get rid of lock on file geodatabase and feature class created in Python script

I have a python script, (for ArcGIS 10), that creates a new file geodatabase, creates a new feature class in that file geodatabase and then reads data from an SDE feature class to populate the new ...
2
votes
2answers
287 views

How to use any ArcMap tool from a python script?

I'm trying to develop a tool that uses some of arcmap default tools like the Sketch Tool or Trace Tool. Is it possible? Let me explain a little more, I need to draw a feature, ask for user input, and ...
2
votes
1answer
2k views

How to update feature class by iterating through values with branching?

I'm really struggling with getting this to work. Basically, I want my script to get the "newID" value and use that as a look up value. If the "newID" is found in the OldID list then do one thing, ...
1
vote
2answers
852 views

Help with a Simple Code to Read a Metadata from a Raster File

Please help me with a python code to read metadata from a Raster file. Thanks
1
vote
2answers
2k views

How do I programmatically update/recreate an ArcSDE feature class from external sql data?

I have an ArcSDE feature class that contains project points based on xy data from an external SQL databaes. (Not a geodb). I am looking for the best way to "recreate" the ArcSDE feature class from the ...
4
votes
4answers
615 views

Compressing map algebra outputs from ArcPy

When creating a raster map algebra output, is it possible to set its compression? I'm creating a model which generates many hundreds of rasters, and currently each is being stored without any ...
8
votes
5answers
5k views

update one shapefile attribute table with values from another dbf table

I try to explain here what I am trying to do: I have one shapefile and one independent dbf table with the same fields. In the dbf table all the fields are populated but in the shapefile attribute ...
2
votes
3answers
544 views

Why is this polygon “self intersected” and invalid?

I have a polygon defined as follows: segment from 43:29:02 N 003:50:39 E to 43:34:12 N 003:43:04 E arc(CW): center (43:34:49 N 003:58:16 E) from 43:34:12 N 003:43:04 E to 43:45:45 N 003:59:56 E ...
5
votes
2answers
1k views

Call FWTools (ogr2ogr) from ArcGIS python script

In ArcGIS, I want to use a Python script (and a standard ArcGIS script tool UI) to call functionality from FWTools. How would I make the call to FWTools? I tried using ...
0
votes
1answer
305 views

Eliminating a column from a copied feature class via a fieldmap object in ArcGIS Python

The use case is exporting a feature class via a Python script (arcgisscripting v9.3x. Only a few of the columns are needed in the result feature class. I commonly use the fieldmappings/fieldmap ...
10
votes
2answers
3k views

Point (of a linestring) within Polygon using ogr and Python

I'm currently working on a project in which I need to build a topological network out of the geometry features I find in shapefiles. So far using Ben Reilly's open source project I've managed to ...
7
votes
3answers
2k views

How to create a circle in arcpy

Suppose I have a dataset where each record has an x,y and r (the centroid and radius of a circle). How can I create a polygon feature class containing parametric circles? Sorry to those who have a ...
4
votes
2answers
803 views

Calculate spacing of polylines along transects in ArcGIS

I have a shapefile with a number of roughly parallel lines in it, and I want to calculate the spacing between these lines using a number of transects across the map. How should I go about this? I ...
6
votes
2answers
5k views

How does one access a featurelayer in SDE via Python?

I am trying to use Arcpy to run the CopyFeatures_management script so that I can copy a featurelayer in SDE. What do I use for the input (and output, for that matter, since I'll be copying the layer ...
4
votes
1answer
123 views

Is it possible to install 9.3 Desktop Administrator as a standalone program?

I have ArcServer 9.3 installed on a server that I use for running scheduled Python geoprocessing scripts. I have several running, and now I'm trying to schedule one to rec/post, delete and recreate ...
2
votes
1answer
493 views

How do I group layers in Mapnik?

I might be thinking about this all wrong, but right now I'm using Mapnik's OGC Server, and using that WMS with OpenLayers. How would I group multiple layers (say country, water, state borders) into ...
5
votes
1answer
689 views

Altering composer label items in QGIS with Python

I'm only new to QGIS and Python so this may exists already, and hopefully be easy to do. What I'm hoping to do sometime in the future is build a map book generator using QGIS as the base. In order ...
2
votes
1answer
342 views

ArcObjects ITextSymbol.GetTextSize in Python revisited: usage with StartDrawing and FinishDrawing methods

I am using ArcGIS 10.0/ArcObjects and Python 2.6. I am trying to get the usage of the ITextSymbol.GetTextSize method correct. The syntax, as established in an earlier question, is: dblx, dbly = ...
1
vote
1answer
302 views

Can you access ArcScan from a python script?

I'm using a python script with ArcPy in ArcGIS 10, and want to access some ArcScan functions. Is this possible? I can't see anything in the documentation about it, but I can't really find any very ...
3
votes
3answers
176 views

Is there a way to locally add links to an OSM data set

Here's what I'm trying to do: I'm modeling some transportation logistics data I want to test the effects of a "new highway" on existing travel demand The new road will be created from an arbitrary ...
5
votes
3answers
2k views

ArcMap/ArcObjects - Drawing graphics onscreen: Explanation or tutorial for Draw/Refresh/PartialRefresh methods?

I find myself woefully lacking in understanding of when, why, and how (which type) to do screen draw/refresh/partial refresh. For instance, in a standalone Python script outside the application ...
4
votes
1answer
208 views

ArcObjects ITextSymbol.GetTextSize in Python: Why are the out params equal to 0?

This is related to the question I asked earlier about the syntax for this method under Python and comtypes. Now that I know the syntax and am trying to use it, the returned out params are equal to 0. ...
6
votes
2answers
4k views

How should I use GDAL to perform a transformation?

Greetings, I am a student who wishes to use GDAL to transform a series of images from Lambert Conformal Conic (EPSG: 9802) to Google Earth's WGS 84 (EPSG: 4326) for a web mapping project. I know ...
3
votes
2answers
258 views

Segmentation Fault (segfault) when using OGR CreateField() in Python

Receiving a segfault when running this very short script in Ubuntu. from osgeo import ogr, osr shpfile = 'Census_County_TIGER00_IN.shp' def cust_field(field): '''cust_field(shpfile, field) ...