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

learn more… | top users | synonyms (1)

3
votes
1answer
1k views

Can't import arcpy in IDLE, pyscripter, or even ArcGIS10.1's Python window

After using arcpy and python for months with ArcGIS 10.1 without any problems I'm encountering something I can't work around or even find help with online. Something as simple as "import arcpy" is ...
3
votes
2answers
850 views

Can't Select and Export from Python Script

I am a novice in python programming but I am trying to learn by doing. I got stuck with this function a while back and can't seem to find a solution or a workaround. I am writing a script that is ...
3
votes
1answer
410 views

Issues with arcpy.sa.Reclassify

I have a raster file with classifcation codes, and want to reclassify valid codes to 1, and all others to 'NoData'. RMAP2 = arcpy.sa.RemapValue([[3.2, 1], [4.1, 1], ...
3
votes
1answer
427 views

How do I programmatically export a single Data Driven Page to JPEG?

I am trying to write a python script to export a individual pages to a jpeg. I am getting the error "PageLayoutObject: Error in SetDataDrivenPageID". Can anyone see where I am going wrong? import ...
3
votes
1answer
684 views

How to pan to a specific feature using arcpy?

I am attempting to use python and arcpy to automate the creation of some standardized maps I need to export for feature classes from various projects. I have a set of points and I need to export a ...
3
votes
1answer
170 views

ArcObjects/VBA to python Network edge to junction lookup IEdgeFeature equivalent in arcpy

In an effort to migrate a script that transfers attributes from a geometric network to a feature class (on a given network edge segment, what are the up and downstream junctions?) I would like to ...
3
votes
1answer
338 views

Update Arcpy version?

This is probably the answer to my previous question. The version of arcpy that I am using does not include GetNAClassNames naClasses = arcpy.na.GetNAClassNames(serviceAreaLayer) ...
3
votes
1answer
304 views

Batch Sum Fields Script

I have created a python script that batch summarizes all string fields within a fc table based on the concatenation of two fields. The script loops through a list of the fields, however it stops ...
3
votes
1answer
567 views

Python scripts runs from PythonWin but not ArcCatalog (ArcGIS 10)

I add a field to the target FeatureClass it is not present, via arcpy.AddField_management(...). Works fine from PythonWin, but the AddField call fails when the script is run from ArcCatalog. I have ...
3
votes
1answer
786 views

Select Layer by Location Produces Empty Output in Python

I am new to using Python scripts to execute ArcGIS tools. In my first script I am attempting to loop through many Select Layer by Location operations on overlapping feature classes. I want to create a ...
3
votes
1answer
644 views

Geocoding failure on concurrent requests with arcgis-10.0

I've created a small python synchronous geoprocessing script (ctagc) that runs on AGS. The script accepts a table (GPRecordSet) as an input parameter. The script then calls ...
3
votes
1answer
193 views

arcpy pydev 3rd party toolbox intellisense

I am just newly started to look at arcpy and i see that it has good intellisense for system toolboxes by default and also if you import a custom toolbox - the intellisense gets update also - however ...
3
votes
1answer
408 views

Disaggregating multiring polygon for editing, then recombining

BUMP? We have many rows of multi-ring polygons, displayed on a Flex front end. We need to be able to select a polygon (a row), split the rings for editing, edit them, then combine into one polygon ...
3
votes
1answer
119 views

Are there any alternatives to ArcGIS Locator Report?

I'm a pretty new GIS programmer and I've found ArcGIS/Arcpy to be extremely unstable. I'm trying to run a Locator Report in arcpy with no success. I'm wondering if there are any other alternatives? ...
3
votes
2answers
67 views

Efficient way to use a CSV to Define a Feature Class

I was provided an Excel Spreadsheet which had the definitions of fields for a feature class. There were several worksheets in the file, each containing field definitions for different feature ...
3
votes
0answers
48 views

Arcpy in Python Plugin for SPSS

Is it possible to run the arcpy module in the Python for SPSS plugin to run the search and update cursors?
3
votes
1answer
91 views

How can I exclude a field on a table from being copied?

I have a query "layer": >>> r = arcpy.MakeQueryLayer_management(r'C:\path\to\connection\file\connection.sde', 'TEST', 'SELECT T.ID AS OBJECTID, T.* FROM MY_TABLE T WHERE T.SOME_COLUMN = 1', ...
3
votes
0answers
79 views

How to extract zipped shapefile and check its shape type using arcpy module without writing on disk

I have a zipped shapefile saved on my disk. I want to extract it in memory and check the shape type. I'm using arcpy module and want to stick to only default modules comes with python installation. I ...
3
votes
1answer
142 views

Can folder connection in ArcMap Catalog window be added using python?

I have created a set of general scripting tools for map automation etc. in one of my tools a geodatabase is created in the workspace folder the script points to. Just out of curiosity is there any way ...
3
votes
0answers
220 views

Move shapefile from one folder to another using python [closed]

I'm working with shapefiles and using the ArcPy library. My script is creating a new shapefile based on a join and I want to know how to move the newly joined-shapefile from the environment location ...
3
votes
0answers
251 views

Is “Python scripting for ArcGIS” book a good reference? [closed]

I'm thinking of purchasing the Python Scripting for ArcGIS book. I haven't seen any reviews on the book. I was wondering if anyone here has read or flipped through it that can make any suggestions
3
votes
0answers
623 views

How to rotate and move polygons to different angles using ModelBuilder (or ArcPy)?

I have a few thousand polygons (all square) that I need to rotate to various angles that are in the attribute table, and then move so that each polygon gets moved 3/4 up from the original centroid, ...
3
votes
1answer
221 views

How come “Zoom to Polygon” always puts me in the middle of Nebraska?

This is an issue related to this question I'd asked a few days ago. I've got that code working, to an extent. Every time, though, that I double click on one of the Polygons in the attribute table that ...
3
votes
0answers
48 views

arcpy adding time to Raster Mosiac Footprint

I am trying to create a raster mosiac for use in animating data over time. The current workflow is: Create .gdb (arcpy.CreateFileGDB_management) Create Raster Mosaic ...
3
votes
1answer
176 views

Exporting records from an attribute table and placing them in a txt file

I am trying desperately to grab records in a shapefile's attribute table and copy them, with additional formatting to a txt file. Below is the code I have developed thus far: I have used the ...
3
votes
0answers
523 views

Reset python add-in

I have a toolbar which enables a second and third combobox when a selection is made on the previous. I would like to add a button to 'reset' the toolbar. Basically reload the toolbar to it's original ...
3
votes
0answers
92 views

Why aren't a layer's serviceProperties exposed if the data source is broken? [closed]

In ArcObjects you can get the service properties of a map layer by looking at its IWorkspaceName.ConnectionProperties property set, even if the layer is currently invalid due to a broken connection. ...
3
votes
1answer
141 views

Enabling ArcSDE Archiving with Python and C API using ArcGIS 10.0?

I have a script that does some register as versioned and updating privileges. How would I call into the c api for ArcSDE to enable archiving with python? ...
3
votes
1answer
1k views

ArcPy replaceDataSource

I'm attempting to replace a datasource in an outline map frame using ArcPy. The rest of the script seems to run OK, but after the script has run the datasource the datasource of that layer shows an ...
3
votes
0answers
218 views

How to symbolize vector features using RGB values stored in three fields?

I need to symbolize a vector layer in Arcmap based on RGB (or HSB - can do either) values found in fields in the attribute table. I'm working with up to 10 different datasets, each with over 100 ...
3
votes
1answer
2k views

error on mxd.save/saveACopy

I'm trying to use arcpy to save an .mxd and am having an issue. It doesn't matter if I use mxd.save or mxd.saveACopy I get the same error. I know it doesn't look like I am doing anything w/ it here, ...
3
votes
1answer
157 views

No placement inside feature dataset using arcpy XYtoLine?

When I run the following code with the outFC creation path set to a feature dataset inside a file geodatabase... arcpy.XYToLine_management(tempFC, outFC, "POINT_X", "POINT_Y", "NEAR_X", "NEAR_Y", ...
3
votes
1answer
820 views

Multiline VBScript Label Expressions in Arcpy

I am able to set simple label expressions, but when I try to set multiline expressions (which all VBScript expressions are) it does not get copied into the expression box properly. I have tried using ...
2
votes
3answers
753 views

SearchCursor() fails to read feature class

First of all, I would like to apologize if this problem is trivial for you guys since I am very new to ArcPy and Python in general. I want write a script to read attribute table from a feature class ...
2
votes
4answers
331 views

Error When Trying to Run Slope Analysis Script

I have written a script which is supposed to loop through all the rasters in a folder and perform a slope analysis on each raster and save the results in another folder. I keep getting the following ...
2
votes
3answers
429 views

Adding a new field and calculating area using Python

Using Python, how do you add a new field to your shape file and calculate the area in km2?
2
votes
2answers
450 views

How to select specific filenames nested within several folders?

I have hundreds of shapefiles that are stored in separate folders, which are nested within several other folders. Among the shapefiles I only need the ones that are named 'POINT*.shp' How do I get ...
2
votes
1answer
839 views

How to add feature class to MXD with ArcPy (Python)?

I am using ArcGIS 10.1 and I am trying to add a feature class that I create to an MXD, so that I can join to it. This all needs to be done using Python. Is this possible?
2
votes
2answers
2k views

how to get ALL FIELD NAMES from table? (using arcpy.ListFields)

I have a table: , Script at ModelBuilder's "calculate values": Expression: a("%path%") Code BLOCK: def a(path): fields = arcpy.ListFields(path,"FID_*") for field in fields: return ...
2
votes
2answers
1k views

ArcGIS and Python Issues with Different Versions

As we know, there are few versions of Arcgis (9.x,10) and Python(2.x,3.x) are in use. Issues are facing when we run scripts/toolbox of arcgis since the script written in one version of python and the ...
2
votes
3answers
2k views

Does ArcGIS 10 have a Geoprocessor Programming Model by using Arcpy?

Does ArcGIS 10 have a Geoprocessor Programming Model by using Arcpy? is it possible to use ArcGIS 9.3 Geoprocessor Programming Model within ArcGIS 10?
2
votes
1answer
220 views

How to change value of an individual pixel using arcpy?

I want to change the value of an individual pixel in a raster using arcpy. The code I wrote for changing the value is below, but it changes all of pixels in my raster. How can I set an individual ...
2
votes
2answers
80 views

Performing an Arcpy code using Python on all shapefiles in a folder or geodatabase?

I have a geodatabase with many polyline feature classes all with different names. I would like to write a code in python ArcGIS 10.1 to use a geoprossing tool on all classes in the gdb. How would this ...
2
votes
3answers
281 views

How to set Definition Query on ArcPy layer from shapefile?

I'm trying to determine options to set a layer definition query using ArcPy. I know that it is possible when using arcpy.mapping.ListLayers(). However, in this scenario I am loading in ...
2
votes
1answer
109 views

How to calculate a field in using updatecursor?

I'm trying to simply add a string in front of a group of numbers from another field in a new field. The filed I'm using update cursor in is GIS_ID_PAM and I'm trying to bring over numbers from a ...
2
votes
2answers
148 views

Why use “ from arcpy.sa import * ”

Previously on the following post: How to get an extent for Raster using python A user edited the original Python script by adding the following code: from arcpy.sa import * Why did he do this and ...
2
votes
2answers
247 views

Errors using SelectLayerByAttribute in ArcPy

I cannot for the life of me persuade SelectLayerByAttribute to work (I need to automate this for a complex script). Working in ArcMap's python console on already loaded shapefile, the format below: ...
2
votes
4answers
2k views

How to enumerate ArcGIS Server 10 map services with ArcPy

I need to connect to ArcGIS server with ArcPy and enumerate over map services. I need to: Loop through each ArcGIS server map service Stop/Start the service Get the service source document (MXD/MSD) ...
2
votes
1answer
222 views

How to build SQL Expressions in ArcGIS 10.1 Python script tool dialog?

I've made a python tool that requires the user to establish which state to select within an input's table (the "Prepared Footprint"). However, once the user drops in the layer and tries to write the ...
2
votes
2answers
61 views

Need to understand desc.workspaceType to use in conditionals

I need to differentiate between two possible types of workspaces for an arcpy script. So I check the workspaceType: rootWorkspace = raw_input('Geodatabase workspace to analyze: ') desc = ...