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

learn more… | top users | synonyms (1)

5
votes
1answer
2k views

How do I correctly use 'MultiValue' in Python script parameters?

My script works fine with a single feature class selected for clip_fc = arcpy.GetParameter(0) . However when I set clip_fc to MultiValue in the script properties and then select several feature ...
5
votes
1answer
1k views

Cast arcpy result as an integer instead (arcpy.GetCount_management)

I am trying to get a number by counting how many points are in a shapefile. And this works (I think), except I then am running into trouble using that number somewhere else. Eventually, I'll be using ...
5
votes
3answers
3k views

Insert Raster to MXD using arcpy.mapping (ArcGIS 10)

What i want to do seems simple. But again i can't even find a workaround... I have got a lot of Raster-files (ESRI-GRID) which i need to insert into a layout mxd-file and then export the map to ...
5
votes
1answer
138 views

Listing ArcSDE versions using ArcPy?

I have an ArcSDE geodatabase with different versions for each user. How can I list each version using ArcPy?
5
votes
3answers
4k views

Remove lock on feature class

When i try to delete a feature class , after or during the use of an Arcgis engine app which uses the same feature class i got an error concerning the lock , so i can't get ride of this lock until i ...
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 = ...
5
votes
2answers
396 views

How to create an oriented buffer using arcpy?

I would like to create an oriented buffer for every polygon in my shapefile using arcpy. By oriented I mean that I have two angles a1 and a2 that constraint the direction of the buffer. This is ...
5
votes
2answers
994 views

How to implement bivariate Ripley's K function in ArcGIS 10?

The attached image shows a forest gap with red pine represented as circles and white pine represented as crosses. I am interested in determining if there is a positive or negative association between ...
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 ...
5
votes
3answers
2k views

Does ArcPy have a spatial search function for geometry?

My problem: Using ArcPy I want to loop over buffers and select geometry_features inside each buffer and do something (update) only the objects found within that specific buffer. The code below ...
5
votes
4answers
2k views

Automate Projection of multiple shp files using ArcPy

I have been trying to create a Python script that will convert all shape files within a folder from GCS WGS 84 to Web Mercator. Below is the code I have so far but what I'm struggling with is how to ...
5
votes
2answers
482 views

ArcMap Arcpy scripts: How to handle user password input?

I'm currently trying to write a script that has a username & password input which then returns some data if the user has appropriate access. The script works just fine when I hardcode my own ...
5
votes
2answers
255 views

Exit Python script in ArcGIS 10.0

I have a script with an bail-out function like so: def die(): from sys import exit exit() Occasionally in the script I check a condition and exit if necessary. This works great in 10.1, ...
5
votes
2answers
864 views

Describing a coordinate system in arcpy

I have a python script in ArcGIS 10.1 which takes in a few inputs from the user. One of the inputs is a coordinate system. I would like to test whether the coordinate system the user chose was ...
5
votes
2answers
1k views

arcpy.UpdateCursor for multiple fields

I've hit a wall trying to loop through multiple fields with arcpy.UpdateCursor. I have a list of files (2) with multiple fields (10-15'ish) that have its own error check in SQL, and an error value to ...
5
votes
2answers
2k views

ArcGIS 10 Python script to search directories and subdirectories for intersects and clip them

I'm trying to develop a tool that queries our company's data stores for any data that intersects a feature. So when we acquire a new property we can run this tool and it will find all of the data we ...
5
votes
2answers
2k views

Frequency, summarize tool options of ArcGIS for Desktop?

I'm looking for some general frequency, summarize tool. What I basically want is some tool like the summarize tool in ArcGIS (right click in the attribute table> summarize) that runs on all attributes ...
5
votes
1answer
856 views

How to check whether a fc is registered as versioned or not using python

How can I check whether or not a feature class is versioned using python? I'm trying to register feature classes using a python script. Before I do this I need to check whether a feature class is ...
5
votes
3answers
919 views

arcpy taking longer and longer in a loop

I am looping through an amount of point arrays, creating data on the fly. The features/arrays, are largely similar in size. One thing I have noticed, is that when I start the process, the time it ...
5
votes
1answer
6k views

How to access data from a selected feature in ArcGIS 10?

First to describe my problem as I see it. I've been asked to design a tool that will take a selected features attributes and copy it out to an output table, with each successive selection and ...
5
votes
3answers
86 views

Is it possible to calculate statistics across multiple fields in arcpy?

The summary statistics command can be used in arcpy to calculate statistics - this tool runs against a single field, eg: SUM—Adds the total value for the specified field. Is there an ...
5
votes
2answers
292 views

Download data via a ftp server using polygon features

The attached script loops through the features of a polygon featureclass and uses that attribute information to download particular files via a ftp server. The script works great for downloading ...
5
votes
2answers
600 views

Make Buffer like Offset in Arcpy

I would like to make a buffer for a polyline and get as Output a Polygon with the same angles as the polyline, having not arcs, like in ordinary buffers. i tried the FLAT option in arcpy, but it's ...
5
votes
2answers
522 views

Correct usage of a counter using arcpy.da.UpdateCursor

In the Python code inside a Calculate Value tool in my model, I have the following: getNum("%Selected Features%") def getNum(ftr): lst = [4, 11, 15] #values for SQL expression x = 20 fields ...
5
votes
1answer
97 views

Is there any restriction on file size while using arcgis tool box or arcpy methods

I am working with ArcToolBox's tools and their python supports. I found there is some restriction on file size of shape files/feature classes etc. It makes me interested to know about is there any ...
5
votes
1answer
523 views

How to use a search cursor on a joined table in ArcMap?

I'm struggling to get a search cursor to work on a joined table view. I've used search cursors before, but never on data that has been joined. Arcpy keeps saying that some of my joined fields don't ...
5
votes
2answers
651 views

arcpy - how to check if a domain contains a particular coded value?

How can I check if a domain contains a particular coded value? How to check if domain already exists? shows how to verify whether a domain exists in a geodatabase. However, I can't see how to check ...
5
votes
2answers
4k views

How to clip a vector feature to the extent of an existing raster dataset using arcpy

I have a clipped raster dataset with polylines (from the contour tool) overlayed (see attached). I am trying to clip the polylines to the extent of the raster dataset, which seems simple enough, but ...
5
votes
2answers
2k views

Use arcpy.mapping to list broken data layers?

I want to list all the broken links in all mxds in a server drive. But whenever I try I get an error come up. Can someone use a specific example, say the drive is D drive, how would I put it into ...
5
votes
4answers
2k views

Creating perpendicular snapped polylines between an existing point and polyline using arcpy

Here's my situation - I'm working on a project that requires 20,000+ short connector lines be created, each drawn from a point to a snapped location on a nearby polyline such that the resulting ...
5
votes
1answer
525 views

Determining ESRI File Geodatabase release version?

Is there any method in Python, ArcObjects, or the File GDB API for determining the release version (9.3, 10.0, etc.) of a file geodatabase? There is a need to find all of our shared 10.0 version file ...
5
votes
1answer
99 views

Pause ArcPy script until feature class lock goes away

My script needs to copy data into a feature class to an SDE geodatabase that might have a lock on it from another application. I shouldn't break the lock (that app has priority over a data update), ...
5
votes
1answer
226 views

Is there a way to use ArcPy module in the python shell that is not with ArcGIS?

I have ArcGIS 10.2 installed on my machine. When ArcGIS was installed, python 2.7.3(32 bits) was also installed. I need python 2.7.5 64bits for some gdal functions. So I installed python 2.7.5 64bits ...
5
votes
1answer
362 views

How to select specific row in attribute table using ArcPy (without iterating through whole table)?

I am using ArcGIS 10.2 and have assumed until now that it is possible to select a specific row in an attribute table. However, I can't seem to find a way to do this. The only available methods seem to ...
5
votes
3answers
5k views

Why can't I import arcpy?

>>> import arcpy Traceback (most recent call last): File "<interactive input>", line 1, in <module> File "C:\Python27\lib\arcpy\__init__.py", line 21, in <module> ...
5
votes
2answers
910 views

arcpy.da.SearchCursor - unique value get second field value

I have a feature class and using arcpy.da.SearchCursor I'm getting unique values of a field (e.g. Name). How can I use this method to get the associated row value of a different field (diff field = ...
5
votes
2answers
197 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. ...
5
votes
1answer
1k views

Copy a polygon geometry in Arcpy

This to me sounded very simple so I am probably missing something basic here. What I need to do is to create a copy of a polygon shapefile to a new shapefile with slightly different attributes. Where ...
5
votes
1answer
2k views

How to programmatically add shapefile to data frame in Arcmap

I have a toolbox with python script which creates a shapefile from JSON txt file, but it does not show the generated shapefile in arcmap, i have to add it from the output location. What code shall I ...
5
votes
4answers
6k views

How to use Arcpy UpdateCursor to update a field?

This should be simple but I've spent days trying everything to get it to work. I need to update a field in a layer based on two other fields. I can't even get it to update based on one field. Could ...
5
votes
1answer
2k views

Is there a way to delete a raster using arcpy / ArcGIS 10.0?

I'm trying to find a way to delete a raster dataset (in any format) using arcpy. As it is now I have been writing custom functions for each file type (eg, delete directory and pyramids for grids, ...
5
votes
2answers
2k views

How do I calculate a weighted centroid with respect to a raster, e.g. population weighted centroid

In ArcGIS 10.0, how do I calculate the weighted centroid of a collection of polygons, where I want the weight to be a raster layer. In particular I am using a raster of population counts and would ...
5
votes
2answers
235 views

Is there a way to refresh imported modules in a ArcGIS Python Toolbox?

When using a python toolbox (.pyt) in ArcMap, I'll typically follow a pattern where the .pyt file itself is simply a wrapper to collect input arguments and define the tools themselves. Supporting ...
5
votes
1answer
454 views

How to do a separate Python installation with ArcGIS?

I see a lot of threads asking how you can have a separate Python installation (e.g. the Anaconda or Python XY distribution) and get it to work with arcpy, while not 'breaking' ArcGIS at the same time. ...
5
votes
1answer
1k views

How to Make a New Shapefile Based on Attributes of an Existing Shapefile?

In my last post I had an issue where I wanted to create multiple shapefiles based on only one attribute field (years). How to do it was answered in that post. I want to make that tool more dynamic so ...
5
votes
1answer
334 views

Good practices for storing connection info while deploying geoprocessing tool on Server

I have a geoprocessing tool written in python. It will be deployed on ArcGIS for Server 10.1 as a GeoProcessing Service and it's processing workflow includes some manipulations with data in SDE ...
5
votes
2answers
635 views

Problem with the where clause in ArcGIS when dealing with variables

I am writing a python script for ArcGIS. I have an input feature class which contains multiple pipelines which is saved as a variable InputPipeline. I would like to iterate through the pipelines and ...
5
votes
3answers
2k views

How to create lines from points pair coordinates with arcpy?

I've got some points pair coordinates (start and end points) which I have to transform into lines. Until now, I used an append of both the coordinates in a pippo.Point(), a pippo.CalculateGeometry() ...
5
votes
2answers
819 views

How to check if domain already exists?

I am trying to check the existence of domains in my file geodatabase which contains 4 domains (automatically populated after I created some annotation feature classes). My code is as follows: import ...
5
votes
2answers
689 views

Create a polyline buffer with Arcpy

I'm trying to write a python script with ArcPy that draws arcs and I've achieved something with creating a buffer and then clipping it with a bounding box so I only keep the length I need (I thought ...