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

learn more… | top users | synonyms (1)

3
votes
1answer
153 views

shapefile batch clip and merge combined

I have two shapefiles, one is polyline, the other polygon. For each polygon I would like to clip the polyline vectors inside. Using arcpy I already found part of a possible solution: ...
3
votes
1answer
1k views

How to create an empty group layer within an existing group layer with arcpy.mapping?

Referencing this question, Add a new group layer with python ArcGIS 10, I'm trying to use python to add a empty group within a group layer. So far I'm able to add a empty group within the map ...
3
votes
2answers
594 views

How to draw rectangle to clip layers using python addin in ArcGIS 10.1?

I want to clip rasters in data view using interactive rectangle (to define Area of Interest) and add them to current dataframe. Following is a piece of code which is not returning anything. Any ...
3
votes
2answers
160 views

Error with publishing Sort tool on ArcGIS Server 10

I have a model that has one tool (Sort), works fine on desktop. When I try to publish get this error. Geoprocessing service initialization failed. Invalid parameter: Tool - General Sort : Parameter ...
3
votes
1answer
203 views

How can I put coded domains into a list to be created in python script?

I have a large list of coded domains. They are numbers like: 01.6530.01, 05.7991.08, 05.7991.01, 05.7991.06 The code will be the exact same as the description. I've tried to make a list using: ...
3
votes
1answer
359 views

How to rotate labels using ArcPy?

I'm writing Python code for ArcGIS using the arcpy library and now I'm experiencing a little problem with labels. In fact I'm not able to rotate them in layout via arcpy (I should rotate all labels of ...
3
votes
1answer
967 views

insert cursor “Row contains a bad value”

I'm having a problem copying data from a shapefile to a feature class using an insert cursor. Here is the part that is causing trouble: newRows = arcpy.InsertCursor(Target) sourceRows = ...
3
votes
2answers
660 views

Comparing two shapefiles based on ID and spatial

I have two shapefiles that contain position information for individuals, one is their reported location (line segments) and the other is their high-frequency recorded location (point data); they have ...
3
votes
1answer
274 views

List Elements or Datasets of a given Layer

I am sorry of this might sound like a noob question but I cannot find any answer from google. I used arcpy to do batch processing of Network Analyst - Make Service Area layer of thousand of stores. ...
3
votes
1answer
272 views

How do I stop GP script from adding temporary data to Table of Contents?

I have a script that does a series of calculations, producing temporary data along the way. However, at each step of the script, data is added to the TOC and then removed when I call the ...
3
votes
1answer
919 views

How can I create an empty feature class in a file geodatabase based on the schema of an SDE feature class?

I have 150+ feature classes in SDE for which I need to create an empty feature class in a file geodatabase. For these feature classes I need to import the attributes and the name of the feature class ...
3
votes
3answers
3k views

Add feature layer to display with in a script tool for desktop mapping 'App'

The point of this question is to find a way to programatically change the map extent based on user input. My method involves creating a Feature Layer & Selection, but if you have another ...
3
votes
1answer
1k views

How to write a script that re-projects vector datasets in a folder?

This is probably a novice question, but I am a novice with python. I am trying to write a script that re-projects vector datasets in a folder. However there are rules in which to do this. They are: ...
3
votes
1answer
331 views

gp.CreateFeatureClass(..) and gp.CopyFeatures(..) isn't copying all fields of feature class

How do I get the ArcGIS 9.3 geoprocessor to copy all of the fields of a feature class? Here is a description of what I'm trying to do: I am modifying an existing script created by a developer not on ...
3
votes
3answers
1k views

How could I label features and convert them to annotations with arcpy?

how could I do the following steps with arcpy: right-click on the layer with the features Label Features Convert Labels to Annotations ... The annotions should be saved in a new shapefile. How ...
3
votes
1answer
1k views

How do you make a SQL join query for a NULL in a search cursor in ArcPy?

I am trying to learn how to do some error catching/avoiding in ArcPy. Here is a simplified version of what I would like to do. I would like to take some points, and then check to see if there is a ...
3
votes
1answer
2k views

Can you add dynamic text from a count of features in a layer with ArcGIS 10 ArcPy.mapping?

I am new to writing scripts, and I am trying to make a map series using ArcPy.mapping and data driven map pages. I would like to put some text on the map that updates for each map in the series ...
3
votes
1answer
119 views

How do I change to a Historical version using Python and arcpy

I am having an issue trying to change to a historical version on an SDE feature class using Python and arcpy.ChangeVersion_management. I am able to manually change the version to a specific date and ...
3
votes
1answer
81 views

Python MemoryError when running ArcGIS Python Toolbox tool

I have a Python Toolbox (.pyt) containing a single tool. Part of that tool is the following function, which creates a dictionary from an attribute table, where the keys are the rows' OBJECTIDs and the ...
3
votes
1answer
116 views

Python script (ArcPy) crashing one machine, but works on others?

I have been woking on a script that will select parcels that are within a particular ArcGIS 10.1 data driven page, create a list out of those parcels, and then populate a text element within my MXD ...
3
votes
1answer
302 views

After ArcGIS 10.2.1 update, Arcpy 64 bit import Error

I've updated my ArcGIS desktop version from 10.2 to 10.2.1 and have noticed that when I run the 64 bit version of IDLE I now get an error when trying to import arcpy: Python 2.7.3 (default, Apr 10 ...
3
votes
1answer
52 views

Keeping the Highest Valued polygon

I have a single polygon feature class that contains large polygons which represent signal strength. Often times these polygons overlap. I dissolve to get multi-part polygons with a value range of 3 ...
3
votes
2answers
63 views

Using arcpy, is it possible to check if a thumbnail exists for a specified file?

I have written a very simple tool that builds thumbnails for every map document in a folder : root_fld stands for root folder and rec tells if search must be recursive. import arcpy import os import ...
3
votes
1answer
371 views

Use arcpy to connect to database without connection file

It seems like arcpy can only work with connection files. This creates one of two problems: Deployment requires manual creation of connection files. We have to write a bunch of code to recreate the ...
3
votes
1answer
384 views

Generating a multivalue choice list in ArcGIS using Validation [Not availalbe for Standard License]

I'm trying to adapt a model and script combination found on ESRI's blog site titled 'Generating a multivalue choice list'. However, I've concluded that part of the validation used in the embedded ...
3
votes
1answer
70 views

How to Create Feature Layers and Search by Location for all Feature Classes in Geodatabase?

I'm very new to python, but I'm having trouble finding the answer on my own. I need to loop through a given file geodatabase, select any features that intersect a project polygon and then search the ...
3
votes
1answer
82 views

Any case when one must use older ArcPy cursors (not da module based)?

I was using the arcpy.da cursors in ArcGIS 10.2 to iterate for quite some time now yet didn't use "classic" cursors that became available in 10.0 a single time. Is there any situation where one would ...
3
votes
2answers
193 views

arcpy.SearchCursor loops one time but then does not repeat

The part of the script I'm having trouble with is the arcpy.SearchCursor. The cursor runs 1x and then does not re-run. The goal was to re-retrieve the field value and apply it to the image layout. It ...
3
votes
1answer
184 views

Selecting raster values at random locations in a raster in python/arcgis

I have a large dataset of integer rasters, and was hoping to find a way to generate a "random" selection of pixels for four of the rasters, while making sure all 5 classes, which I've specified based ...
3
votes
1answer
257 views

How to exclude stations from IDW interpolation?

I have the following problem: I need to calculate an average precipitation amount on a catchment using an IDW interpolation. The interpolation is performed in a loop since each precipitation station ...
3
votes
1answer
216 views

Small script crashes Python

I'm running a rather simple script with ArcPy, which extracts values of raster to points of a shapefile: def raster_overlay(input_files): for raster in input_files: in_shp = ...
3
votes
1answer
146 views

How can I make my python script results appear in model builder

I have a model (model builder) and within I added a python script to calculate a field. My problem now is, that I don't know how to make the output appear in my model as it is the same as the input ...
3
votes
1answer
60 views

How to select among overlapping linear features by create date?

I have a table which has overlapping linear data; for example: A----------C and B---------C. Of these two records I would only like to return the record with the latest create date; in other ...
3
votes
2answers
332 views

How to control state of buttons in Python Add-In?

I have bunch of buttons to perform separate tasks within a Python Add-In. Buttons are greyed out and required to be enabled after initial tools run. In the following example, tool1 is turned off after ...
3
votes
2answers
267 views

scratch files left behind by arcpy.sa.Con

I have a Con() statement that creates two "extra" scratch files during it's processing, but that do not get cleaned up once the operation is over and the output is saved. r=arcpy.sa.Con(elv, ...
3
votes
1answer
172 views

How to get default parameter value for script tool from csv file?

I am fairly new to python scripting. I have just figured out how to read and write input parameters for a python script from a csv file. Now I am being asked to pre-populate the script tool dialog in ...
3
votes
1answer
155 views

How to make multivalue input script run from a toolbox?

I have a working python script: import arcpy sdeconnection = arcpy.GetParameterAsText(0) layerfiles = arcpy.GetParameterAsText(1).split(";") for layerfile in layerfiles: print layerfile lyr ...
3
votes
1answer
177 views

How to check if geometry is M aware?

I am trying to determine whether my shape file that I pass is in M-aware (has M value). I keep getting an error Attribute Error: 'Polyline' object has no attribute 'hasM' Not sure what I am doing ...
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
907 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
443 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
445 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
732 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
172 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
342 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
313 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
614 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
804 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
661 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 ...