A site-package created by Esri to expose ArcObjects to Python.

learn more… | top users | synonyms (1)

7
votes
4answers
5k views

'Import arcpy' error (RuntimeError: NotInitialized) when using IDLE

ArcGIS Version: ArcGIS 10, Python 2.6.5 Machine: Windows 7 64bit (Intel) I'm receiving the following error when importing arcpy using the the IDLE (gui and cmd prompt) and when using pythonwin. I ...
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 ...
8
votes
4answers
6k views

Remove feature layer using ArcPy script?

I have an ArcPy based script where I'm trying to intersect two layers where one layer must have its centroid in the other layer. Since I need to know that one layer (feature_layer below) includes ...
4
votes
4answers
596 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 ...
1
vote
1answer
564 views

user select fields to be deleted in a feature class

How do I make the script below accept parameter arguments correctly in ArcGIS 10? I added it to a toolbox as a script, created parameter called Fields to be Deleted: and type as Field, but when I ...
3
votes
2answers
539 views

Enabling time aware layers using arcpy

Is it possible to enable time aware on a layer programmatically? I can add a time-enabled layer to a non-time aware data frame as shown here: ...
14
votes
3answers
7k views

Listing all feature classes in File Geodatabase, including within feature datasets?

From python how can I build a list of all feature classes in a file geodatabase (*.gdb), including inside feature datasets? The standard example only lists feature classes at the top level of the ...
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 ...
0
votes
0answers
478 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.
5
votes
2answers
2k views

(New at Python Scripting) Creating a Loop so i can replace text in page layout in multiple mxds instead of one mxd at a time

I found some code on a website that will perform a search and replace on page layout text elements. Currently you can only do it one MXD at a time. I was hoping to change the code so I can do a search ...
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 ...
5
votes
2answers
4k 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
3answers
1k views

Why would “import arcpy” hang Python script run from DOS/cmd prompt?

I have a very small test script (test.py) that I use to see if Python is installed and ready to use ArcPy. All it contains is: print "Starting" import os print "OS imported" import arcpy print "ArcPy ...
1
vote
1answer
284 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 ...
11
votes
1answer
829 views

How can I display raised error messages to the user in the ArcGIS geoprocessing results window?

Question: Can print statemnts raised from a custom exception be displayed in the gp results window? Background: I modified a script that I found that takes two inputs from a user, finds the ...
13
votes
2answers
2k views

Add a new group layer with python ArcGIS 10

Does anyone now how to add a group layer with python can I use arcpy.mapping.AddLayer but surely this is only for an actual layer as opposed to a group layer. so far I have this import arcpy mxd = ...
6
votes
3answers
3k views

Writing world file when exporting TIFF using ArcPy Mapping?

According to documentation, the options are: Syntax ExportToTIFF (map_document, out_tiff, {data_frame}, {df_export_width}, {df_export_height}, {resolution}, {world_file}, {color_mode}, ...
6
votes
4answers
1k views

Raster to Polygon Scripting Problems

I am trying to make a script which selects every .png file in a folder beginning with the letters "LG". I then want the scipt create a shapefile, replacing the "LG" with "SH", and then i want the ...
4
votes
3answers
943 views

How to automatically create 2D-point features from addresses in an SQL database

I currently have an SQL-Table which contains our buildings. I already added the table and now want to create features ( 2D-Points ) from that information. The biggest problem I have is that the ...
2
votes
1answer
1k views

How to change the datasource with python?

How do I change the datasource of all layers in a map document using arcpy and python
9
votes
1answer
5k views

How to create a script tool that will create a copy of a feature class and offset it by a given distance? (arcpy)

I want to duplicate a polygon feature class and offset all of the polygons by about 10 feet in both the x and y directions. I asked if there was any way to do this last week, and I was informed that I ...
2
votes
1answer
482 views

Can I create a balloon callout on an address point on a published map?

Very new to this, so please excuse any ignorant question! I've created a vb.net app to open a published map in ArcReader. Have a few questions... First, I started with the query attribute sample ...
3
votes
3answers
1k views

How to create a copy of a feature class that is vertically and horizontally offset by a given distance?

I want to duplicate a polygon feature class and offset all of the polygons by about 10 feet in both the x and y directions. Is this possible to do using arcpy, or are there any geoprocessing tools ...
6
votes
1answer
566 views

Is there anyway to make GPModels with python scripts execute faster?

I do not know if anyone else has this problem but my GPModels that include simple python scripts seem to take way too long to execute. One example is a model I built which is a simple select feature ...
5
votes
4answers
5k views

Field Calculator syntax

I can't get the syntax correct for a fairly simple if statement. Right now it looks like this: dim Output as Integer If [HECTARES] >= 30 AND [HEIGHT] >= 17 AND [CROWN] >= 59 THEN Output = ...
6
votes
2answers
1k views

Change from layout view to data view using python? (ArcMap 10)

Is there a way to change from layout view to data view using python? I would prefer to do it using arcpy.
0
votes
2answers
1k views

KeyboardInterrupt doesn't work when arcgisscripting module is loaded

The KeyboardInterrupt exception -- thrown when Ctrl-C, or Ctrl-Break on some machines, are pressed in a Python console window -- is commonly used to gracefully break out of long-process loops, ...
6
votes
2answers
1k views

Is anyone successfully using arcpy.ExportMetadata_conversion?

I don't know if it is a bug or my lack of python skills, but I keep getting 'ERROR 000816 The tool is not valid' in my python script when I call ExportMetadata_conversion Initially, I was attempting ...
3
votes
2answers
3k views

Assertion Error when attempting arcpy.mapping.AddLayer

Whenever I attempt to use AddLayer it gives me: Runtime error <type 'exceptions.AssertionError'> This is what I've been using: arcpy.mapping.AddLayer(MainDF, ...
1
vote
1answer
556 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 ...
12
votes
4answers
7k views

Is it possible to use Arcpy in ArcGIS 10 to zoom to a selected feature?

The answer to this may be a simple yes or no, but I'm hoping that someone is aware of a way to zoom to the extent of a selected feature using the ArcPy modules in ArcGIS 10.
14
votes
3answers
2k views

Can i use ArcPy to get layer symbology?

Hello all Since ArcGIS 10 comes with ArcPy package, i'm wondering it is possible to use ArcPy functions to get Symbology (i.e color, width...) of a layer? Thanks in advance
12
votes
3answers
8k views

Will ArcGIS 10 support Python 2.7 or Python 3.1?

I'm curious to know whether ArcGIS 10 will support newer versions of Python than 2.6. And for that matter newer versions of NumPy (ie, 1.4, 1.5 etc). I'm sure that this documentation is on the ESRI ...
18
votes
7answers
2k views

Is there a way to code-complete arcpy scripts using an external editor?

I have been scripting in Python for ArcGIS 10, and so far I have just been using Notepad++. I like how the Python command line interface code-completes arcpy functionality for you, showing you your ...
1
vote
3answers
815 views

an arcgisscripting method for sanitizing a filename?

Is there an arcgisscripting method for sanitizing a filename to get rid of characters which Arcgis barfs on, the meek hyphen - for example?
68
votes
5answers
10k views

Accessing ArcObjects from Python?

I would like to be able to script some things that are not exposed via arcgisscripting or ArcPy. How do I access ArcObjects from Python? I'm working with ArcGIS Desktop 9.3.1 right now, but will be ...