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

learn more… | top users | synonyms (1)

3
votes
1answer
850 views

Workaround for Raster data input in ArcGIS Server Geoprocessing Service

UPDATE I have accomplished the Python script, but only tested in desktop environment, i.e. ArcMap. #Import ArcPy site package module import arcpy from arcpy import env from arcpy import Extent from ...
3
votes
2answers
558 views

How do you get access to a Network Analyst layer item in ArcPy?

I have a Python script that I'm working on. I have created a Closest Facility layer (in memory). I add facilities. I add incidents. I perform the Solve. These all complete. The only problem is, ...
3
votes
1answer
845 views

Update layer datasource in multiple map documents using ArcPy?

I would like to update the data source of a specific layer in multiple map documents using ArcPy, however I'm getting a <type 'exceptions.SyntaxError'>: invalid syntax error on this line: if ...
3
votes
1answer
393 views

Arcgis -> python -> ctypes -> c++ dll tool cancels itself, why?

Since optimizing my python-ctypes-dll based geoprocessing tool, it seems to cancel itself a lot. Followed by arcmap reporting a pure virtual function call (which is odd, because you'd think any such ...
3
votes
1answer
927 views

Can ArcPy test for availability of SDE Connection before trying to use it?

In a Python script that I use to publish ArcGIS 10.0 Geoprocessing Services I have some code: arcpy.AddMessage("If process hangs here, check for ArcSDE connections issue by trying to open " + mapFile ...
3
votes
1answer
605 views

Strange Behavior in Focal Statistics

I am trying to calculate the maximum value in a neighborhood on a raster using the Focal Statistics tool for Spatial Analyst in ArcGIS 10. Using python, I loop though several different radii, with ...
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 ...
3
votes
1answer
36 views

Creating individual points from count field in point feature class using ArcGIS for Desktop?

I have a point feature class with a count field associated with each of the points. I would like to create a new feature class where each of the points are duplicated by the value of the count ...
3
votes
2answers
55 views

Using ModelBuilder, how to define directory while using a Python script?

I have a model (shown below) in which at the very end of it I run a Python script ('SumFieldInsertNew'). One issue I'm having is that I'm creating this model for an end-user that will have little to ...
3
votes
1answer
49 views

Build Network Dataset with python comtypes

I know this isn't possible in arcpy, so I thought I'd give it a stab using comtypes. I am trying to translate some of the VB.NET code to create a network dataset from the help docs: ...
3
votes
1answer
51 views

Crosstable two fields of a pointfile (ArcMap)

I'd like to produce a simple crosstabulation from two fields of a point feature class. These fields contain land use class information which I'd like to compare. One option is to export a dbf and do ...
3
votes
1answer
331 views

Multiprocessing issues with ArcPy

I am using ArcGIS 'watershed' routine in a script which makes use of multiprocessing. This works fine, but during execution I get the message: Unable to remove directory. Possible causes: 1- Not ...
3
votes
2answers
152 views

Setting the Centroid of a Set of Polygons

I'm trying to shift a set of rectangle polygons over an area of interest (AOI). I thought it would be as easy as setting the SHAPE@TRUECENTROID of the polygon area of interest to the ...
3
votes
1answer
131 views

Creating a polyline from point data that represents multiple linear features in ArcGIS 10.0

I have a problem where I have to somewhow create a polyline feature class in ArcGIS 10.0 from points that were collected in the field using a Trimble GeoXT that represent the start and end of multiple ...
3
votes
1answer
360 views

How to calculate angle of polyline at its midpoint using Python/ArcPy?

Trying to calculate the angle of a line at its mid point using python; this will be used to display flow direction on a water network. I've developed this script, which works in terms of generating ...
3
votes
2answers
228 views

How to rename points by clockwise direction or change starting point in polygon features?

I have a polygon feature class. I convert it to a point. Name of field (for example !Number!) in a point feature converted from polygon "A2"(The first point should be in the upper left corner ...
3
votes
2answers
186 views

How to publish GP Service with importing of numpy in ArcGIS for Server 10.1?

I use a lot of scripts as GP Service almost all use the arcpy functions but one (and very important) of my scripts needs a gdal/ogr and numpy imports. I can run this script in PyScripter or as a tool ...
3
votes
2answers
154 views

Selecting features to project to different coordinate system?

I've got data from all over Europe in one feature class projected in Web Mercator Auxiliary Sphere. Due to the fact, that length and area values are not usable I'm now working on a python script ...
3
votes
1answer
733 views

Python: Change SDE data source for mxds in specific folder

I've searched all the forums and help and have made progess but recently got an error that has thrown me for a loop - also some mxds are not being changed at all! What I'd like my code to do: Iterate ...
3
votes
1answer
267 views

ArcPy merge datasets with slightly different fields

i have many (>15) shapefiles which have slightly differing fields. s1: (Name, age, layer_1, ...) s2: (Name, age, layer_1, layer_2, ...) ... s_n: (Name, age, layer_1, layer_1_extra, ...) I want to ...
3
votes
1answer
290 views

Using field mappings to remove fields from a merged table

EDIT: Soreted, thanks :-) I'm trying to combine a (large) number of tables into a merged table, keeping only certain fields. I've tried the below, but it still gives all the fields. Any ideas? ...
3
votes
1answer
639 views

Arcpy does not execute “CopyFeatures_Management” to write a featureclass to an ArcSDE database

I have some problems with my Python script. The script gets an JSON with different information about images. The information includes general information about images and also the gps position of ...
3
votes
1answer
157 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

Creating empty group layer within existing group layer using 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
620 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
163 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
212 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
369 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
1k 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
670 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
276 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
280 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
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
334 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
20 views

Accept multiple input types in ArcGIS Script Tools UI

everyone! I'm working on a python script that calculates aggregations of ACS Variables (i.e. adding "Renters who spend more than 30% of Annual Income on Rent", "...40%...", "...50%...", etc.). The ...
3
votes
1answer
126 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
90 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
121 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
356 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
55 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
67 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
454 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
73 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
86 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
214 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
191 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 ...