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

learn more… | top users | synonyms (1)

2
votes
2answers
1k views

How to clip multiple raster datasets with county polygons?

The example below shows three raster (i.e. in black) and a single county polygon feature class. How can I clip/extract by mask the rasters by their corresponding county polygons (i.e. Edwards, Clark, ...
0
votes
1answer
964 views

Why do i get an input error no module named arcpy when i try and import it into pythonwin?

Here is the error i get when i use the import arcpy command in pythonwin: Traceback (most recent call last): File "", line 1, in ImportError: No module named arcpy Can any one tell me how to fix ...
4
votes
2answers
450 views

focal statistics with variable radius

is there an easy way to do focal statistics on a raster, with a variable radius for the neighbourhood to be searched? As in: that search radius would be stored in another raster? i tried something ...
5
votes
2answers
204 views

Using newly created features in the next part of a python script

Good Afternoon I am trying to write a python script which buffers a large number of features from a geodatabase (but not all) and then dissolves the newly created buffer shapefiles together. ...
0
votes
0answers
156 views

How to iterate throught fields names in a table and change row values?

I got table like that one (Example). I need to change 0 to 1 and -1 to 0 in each field except first and second. The problem is that every time i have different number of fields and field name is ...
1
vote
1answer
143 views

ResultObject: Error in getting output

I am getting "ResultObject: Error in getting output" message when I run the following code. I know it has something to do with "os.path.join" but can't figure out what. Thanks. Sam import arcpy ...
2
votes
3answers
495 views

Is there a way in arcpy to convert map units from feet to decimal degrees?

This is my problem: I have an arcpy script that finds the XMax, XMin, YMax, and YMin of a polygon. It shows the results in feet, but I want them to be in decimal degrees. In ArcMap I can change the ...
5
votes
1answer
258 views

Adding kernel density output to map with ArcPy

I am trying to emulate the behavior of the Kernel Density tool from the ArcMap 10 GUI in a script; in other words, I want to calculate the density of a dataset, and add the visual result to a map. If ...
2
votes
1answer
279 views

Python script for Data Driven Pages to run a series of DDP at once?

I have a several different polygon shapefiles that I am using to create individual maps for each polygon within the shapefile. The layout is the same for each map, the only thing that changes is the ...
10
votes
2answers
257 views

Count raster value in a bounding box (spatial extent)

I have simple question: given a bounding box, how can I count the number of specific values (say, I am interested in the number of value == 1 ) in a raster in 1) arcpy, or 2) raster package in R?
2
votes
1answer
292 views

Python add-in won't buffer from output layer

I have a simple add-in script for Arcmap 10.1 to create a toolbar, select a layer from a drop down list of the current layers in the project, buffer that layer four-miles, then use the resulting ...
3
votes
1answer
1k views

Writing Python script to give multiple buffers of different sizes in ArcGIS for Desktop?

I want to write a loop that will cause the output to be multiple buffer shapefiles. For example, I want a circle buffer of 50ft, 100ft, 150ft, etc. Can anyone help? I'm new to this and am trying ...
1
vote
1answer
78 views

Change printer for a specific map document from Arcpy

Is it possible to change the printer for a particular map document from ArcPy? The mxd is saved with the default printer settings, and I know with the PrintMap() function one can specify the printer ...
4
votes
2answers
1k views

Trouble finding YMin and YMax of a shapefile in ArcMap 10 and Arcpy

I want a python script that tells me the Xmin, Xmax, Ymin, and Ymax of a polygon. (I guess this is finding the extent of a polygon?) My current script gives me the correct the Xmin and Xmax, but it ...
2
votes
1answer
745 views

Move TEXT_ELEMENT using arcpy.mapping and data driven pages

I'm customizing an automated mapping solution using arcpy.mapping and data driven pages. Using a looping statement, I'm hardcoding the position for the mapping elements (legend, north arrow, inset ...
1
vote
1answer
481 views

How to calculate field as cursor name?

First time dealing with cursor. I have lines intersecting polygons, I want to get a table with all attributes of the lines, add a field and calculate the field as the name of the polygon. I was able ...
1
vote
2answers
557 views

Python scripting for ArcPad Checkin

I can use ArcGIS Desktop model builder to leverage the ArcPad Check In Tool. When I run the model it executes successfully. When I export the model as python I get this code: import arcpy # Local ...
1
vote
1answer
641 views

How to drop ArcSDE connection using Python scripting?

I want to be able to control connections to ArcSDE via python. Here is my script so far using ESRI's example. import arcpy from arcpy import env env.workspace = r"SDEConnection" fcList = ...
1
vote
1answer
125 views

Substitute for SpatialJoin tool?

I have to write a script in Arcgis which I would like to use the SpatialJoin tool (arcpy) but I do not have the appropriate extension. It may be a tool (or example of scripts) for doing the same ...
2
votes
1answer
820 views

Convert MapInfo - MapBasic Script into Python

I have a mapbasic script that divides an irregular polygon into smaller polygons of 1 hectare each. Would anyone help me to convert the following into an arcpy python script. ' This program ...
9
votes
2answers
838 views

How to bypass errors in arcpy for/while loop?

I have a handy script tool that loops through a workspace and renames and copies shapefiles to a feature dataset. However, if there is a corrupted shapefile somewhere in the workspace the script ...
0
votes
1answer
172 views

How to populate Unique ID field after sorting?

I am trying to create an new unique id field in a feature class. I already have one field called "SITE_ID_FD", but it is historical. The format of the unique value in that field isn't what our current ...
0
votes
1answer
758 views

Can variable be set to reference in_memory workspace object in ArcPy?

This is an offshoot question related to a question I posted earlier. I have the following arcpy code that inputs a Python list of polygon geometry objects to the Union_analysis tool, which then ...
0
votes
1answer
431 views

Looping Dataframe in Python doesn't Return Expected Results

I'm creating a python addin script to be used on some mxd's I have created as templates. Each map contains 2 dataframes. I need to loop through each dataframe and do some processing on each. I set my ...
0
votes
1answer
1k views

ArcGIS/arcpy: Input of in-memory geometry object to Dissolve tool in arcpy script throws Error 000732, input doesn't exist or is not supported

In an arcpy script, I run a Union on a list of geometry objects. The output is set to an empty geometry object. The Union runs fine. What I am trying to do is then feed that output into the ...
1
vote
3answers
285 views

Why do I get a no module error when I try to batch process in Arc10?

I was trying to batch reproject a set of shapefiles and I kept getting the error No OS Module As the set was relatively small I just did it individually, however I want to be able to batch process in ...
3
votes
1answer
2k views

How do I use python to batch process the reprojection of a group of shapefiles?

My client would like his shapefiles reprojected and I would like to get a script that can batch process all the files located in the same folder. I am new to Python and ArcPy but am very interested. ...
13
votes
1answer
2k views

How do you write a Python script for repairing data sources in ArcGIS 10

So, I have about 50 mxd's with all broken layers that I have been going through and manually resetting. The data was moved from another computer and the folder structure was changed so it isn't just ...
2
votes
1answer
248 views

How do I write a script to list those layers with broken data sources?

In my SHP to GDB toolbox, I create a list of layers in MXD, then I check for those not broken I move them. Despite using ListBrokenDataSources I have errors like this: Runtime error : [Error 3] ...
1
vote
1answer
763 views

Modify dataframe extent using data driven pages and arcpy.mapping

I'm customizing an automated mapping method using arcpy.mapping and data driven pages. Essentially I have a script that loops through each page, and modifies the location of the inset map, legend, ...
3
votes
1answer
186 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 ...
2
votes
0answers
133 views

How can I draw an ellipse filling the dataframe with ArcPy?

I need to modify one of my template scripts to draw a circle from the centre of the (inset) data frame to the edge of the data frame. This will then be used to clip the data frame to shape. I'm using ...
8
votes
4answers
1k views

How to split points by polygon?

I am looking for a way to split points by a county polygon feature class. The attached image shows two feature classes: one composed of points and the other a county polygon feature class. The split ...
0
votes
1answer
421 views

Parse attribute table value to export filename using data driven pages and arcpy.mapping

I'm trying to customize a data driven page looping statement workflow and want to set a better filename to the final export. Currently the file name uses the page index (pgIndex), but I would like it ...
4
votes
2answers
2k views

Create temporary files as intermediate output to be used as input in concatenation

Q_PART_I I need to merge many (MANY) tables in one unique output table by means of the arcpy.Merge_management. Anyway, I'd like to avoid the creation of tons of intermediate files as my script ...
1
vote
2answers
380 views

Cannot get arcpy.MosiacToNewRaster to work with list

Below I have a snippet of a much larger code that I cannot get to work and I am not sure why. It seems that I always have trouble using arcpy functions with rasters. Can anyone help me get this code ...
3
votes
1answer
84 views

> - operator and “Shape_Area” field in a geodatabase

this might be a pure python problem or a problem with arcpy. please help me out: min_area = float(GKPROZ_functions.min_of_field(out_name,"Shape_Area")) print area_max if min_area > ...
7
votes
2answers
1k views

Permanently replace/update server/service in each ArcSDE Layer in MXD?

Using the mxd.findAndReplaceWorkspacePaths method, if and MXD is updated and the path the the .sde connection file moves again all of the data sources will break again. Is there a method to ...
2
votes
2answers
1k views

Help with ListFields and CalculateField_management syntax

I need some assistance with the syntax for a CalculateField_management calculation as I have still yet to master all the python syntax rules. What I am trying to do is find the max value in a ...
6
votes
3answers
2k views

How can I select vector features that overlay raster in arcpy?

I have two datasets: point feature class and raster (stored in file geodatabase). The spatial extent of the raster is smaller than the point dataset. Is there a way I could select (or create new, ...
1
vote
1answer
261 views

Project layer with custom projection

My ultimate goal is to know UTM and UTM Northing and Easting. The data can be anywhere in North america. I calculated UTM using arcpy tool (arcpy.CalculateUTMZone_cartography) and I tried to truncate ...
4
votes
1answer
337 views

String format for geodatabases in ArcPy scripts

Several ArcPy functions take strings as geodatabase identifiers. I've looked through the ESRI docs, but can't find a good reference for the various acceptable formats. I'm looking for examples of ...
5
votes
4answers
2k views

Exploding overlapping to new non-overlapping polygons?

Given multiple polygons that overlap in multiple ways, I would like to export from these features all polygons that don't overlap with others, iteratively. The product would be a number of features ...
3
votes
3answers
2k views

How do I access a multivalue output parameter from a python script in modelbuilder in ArcGIS 10.0?

How do I access a multivalue output parameter from a python script in modelbuilder, in ArcGIS 10.0? That is, I have a python script that loops through several input layers (working through a script ...
2
votes
1answer
181 views

Import 3D Analyst Functions With ArcPy

This really seems like I should be able to do this, but I am running into some problems. I want to import 3D Analyst with python, in the same way I import Spatial Analyst, but it returns an error. ...
1
vote
1answer
237 views

AddLayer method does not add all bands of .tif image (3 bands total)

I am currently having trouble getting 3-band raster's to display correctly when I call the arcpy.mapping.AddLayer() method. It should be said that I am using a pre-existing mxd template to automate ...
4
votes
1answer
1k views

How do you add a long list of rasters together in Python?

If you have produced a long list of rasters (lets say 50) and want to add them together, is there any shorter way to write in python rather than typing all the inputs, like so: outRas = inRas1 + ...
6
votes
1answer
227 views

Is it possible to install ArcPy on a server for use in a geoprocessing web application?

I have a website on my intranet and would like to add some geoprocessing tools to it with Python. Many Users will not have Arc installed on their machines, so I think I need to have the scripts set ...
3
votes
1answer
562 views

Create a new Dataframe using Arcpy in 10.1

Does anyone know if there is a way to create a new empty dataframe in ArcMap 10.1 using Arcpy? Thanks
8
votes
2answers
3k views

Finding mid-point of line using ArcPy?

How can the mid-point of a polyline be calculated using the geoprocessing framework, e.g. in a Python script? The polyline.centroid property returns The true centroid if it is within or on the ...