A site-package created by Esri to expose GeoProcessing from ArcGIS to Python.

learn more… | top users | synonyms (7)

4
votes
2answers
3k views

Creating empty group layer within existing group layer using arcpy.mapping?

Referencing this question, Adding new group layer with ArcPy?, 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 document, ...
4
votes
1answer
858 views

Access Metadata from ArcSDE-tables using python

Is it possible to access the metadata of a feature class in a ArcSDE-data, using arcpy / python (on Arcgis 10.0). I suppose I could export the metadata to xml and parse the xml, but is there a more ...
4
votes
2answers
386 views

Getting junction id for roads in network dataset using ArcPy?

I have a network dataset with roads and junctions. I am wondering what class I can use in ArcPy to extract FromJunctionId and the ToJunctionId for each road segment in the network dataset.
4
votes
1answer
512 views

Programmatically export to geotiff in different scales from ArcGIS Desktop?

I would like to programatically export geotiff files in different scales (e.g. 1:25000, 1:50000 etc) using arcgis10. As input I have some shape files and a DEM file as well as a corresponding style. ...
4
votes
1answer
593 views

How to best organize files for a large arcpy script tool?

I am writing a lengthy arcpy tool and am working with multiple python scripts, simply for organization's sake. Everything runs well when I run it from the command line, but now that I am starting to ...
4
votes
1answer
2k views

Getting a constant background color for transparency

I am creating a series of tif files at 1:10k scale over a vast area (760 tiles) using arcpy.mapping.ExportToTIFF and then stitch them together to create a single ecw. The output looks ok but when I ...
4
votes
2answers
4k views

Using arcpy from the command line on ArcGIS Linux Server 10.1

We installed ArcGIS SERVER (not Desktop!) 10.1 on a RHEL (Red Hat) machine. ArcGIS Sever is supported for Linux. However, it appears they don't make it easy to script in python, from the command ...
4
votes
2answers
2k 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 = ...
4
votes
3answers
1k views

Using threading module with Arcpy: Manager/Worker architecture

I asked this question on Stack Overflow on how to setup a manager/worker scenario. But I am getting some error when trying to use threading on my Python install with ArcGIS 10 (just the python ...
4
votes
2answers
2k views

arcpy: check for same record in cell above and below

After using the find duplicates in arcmap 10, I want to check if the feat sequence ("find duplicates" marks all records with the same attributes with the same number [in "feat_seq"] and creates a ...
4
votes
2answers
200 views

Spawning a process from ArcGIS ToolValidator

I attempted to spawn a separate process from the ArcGIS ToolValidator script. Unfortunately, it launches another instance of ArcCatalog. What is going on behind the scenes that causes ArcCatalog to ...
4
votes
2answers
235 views

Appending Point Shapefile Location by GPS values in text file using ArcPy?

In my industry it is common to create preliminary design maps for point locations that have a unique identifier. Upon the actual construction on the design, points change location based on ...
4
votes
2answers
1k 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, ...
4
votes
2answers
3k views

Create Polylines from arrays of points

Let me describe the data setup. A line has been provided as an array of coordinate pairs, one for each vertex. This array is variable in size, anywhere from 2 to 200 coordinate pairs per line. What I ...
4
votes
1answer
908 views

Can I change the font type in all Text_Elements in a page?

I want to change all the font styles in a number of mxd's from "Lucinda Sans" or whatever the current one is to "Arial" without changing the font size. I wrote a simple script to find/replace text ...
4
votes
1answer
916 views

occasionally empty search cursor looping through a raster list with arcpy

I'm looping through a raster list, to export cell counts (from "Count" field in the table) to a text file, I'm only interested in cases where the field "Value" = 1, so I have included this in my ...
4
votes
1answer
48 views

Update row with next row's value

I am trying to extract the endpoint of a line with very fine scale and overlapping GPS data. I would normally just use the locn_id+1 but that doesn't work because the data were originally rarified. ...
4
votes
1answer
42 views

Access to graph properties in arcpy

I am using data driven pages and arcpy.Graph() object to automate production of synchronised map/long-section series similar to this: I'd like to keep vertical scale for long-section part. In order ...
4
votes
2answers
86 views

How to prevent arcpy from adding new features to current workspace

I have the attached code. The code takes a huge raster, and a set of point features. For each of them creates a circular buffer (100), then squares it, and then clips that part of the buffer. In doing ...
4
votes
4answers
168 views

Swapping Lat and Lon coordinates of shapefile?

I have a shapefile that consists of one polygon whose boundary is defined by a large number of points. Whoever originally made the file inverted the latitude and longitude coordinates, so the data ...
4
votes
1answer
90 views

Importing MXD to ArcGIS Pro programmatically?

I have a problem with importing an MXD file to ArcGIS Pro programatically. I try to do this by using the following arcpy.mp code: import arcpy aprx = arcpy.mp.ArcGISProject(r"C:\test\blank.aprx") ...
4
votes
1answer
58 views

Excluding pages without point within extent from Data Driven Pages?

ArcMap 10.2 I am creating a utility mapbook to show HVAC points on an installation. The data driven pages are named and sorted by a separate layer (area feature class). There are 70 named areas, ...
4
votes
1answer
124 views

Automatically create new layers from a single dataset using definiton query for unique values in a field

I would like to automatically display a featureclass as different layers based on a specific field. I've seen a few tools online and on XToolsPro under the category of Split by Attributes, but they ...
4
votes
2answers
292 views

Fastest way to numerate intersecting polygons in ArcGIS

I need to numerate a thousands of polygons in groups, so each group will get unique number. Every intersecting polygons is unique group (see picture). So polygons have field "groups" with values: ...
4
votes
1answer
2k views

Calculating geometry area in ArcGIS for Desktop using ArcPy?

I have a polygon shapefile and I want to write a Python script to add a field named "area" and calculate its geometry areas. The script is like this: ...
4
votes
1answer
561 views

Find max and min values from a table based on two fields

I have a geodatabase table with the following fields: County_Name, State_Name, Date_Time, Customers Example Alameda, CA, 8/1/2014 12AM, 6 Alameda, CA, 8/1/2014 1AM, 1 Alameda, CA, 8/1/2014 2AM, ...
4
votes
2answers
458 views

How to get arcpy.da.walk to continue walk after encountering corrupt/problem file?

I am relatively new to python. I am trying to iterate through all DWG polylines in a directory with multiple (hundreds) of subdirectories. I would like the code to skip any DWG files that it cannot do ...
4
votes
1answer
347 views

How to cancel tool execution in python

I've written a python function that calls a tool (Import CAD to GDB) in a loop. When I run it I have seen that it hangs sometimes, and I have to force the script to quit. I am wondering if there is a ...
4
votes
1answer
724 views

Getting ArcPy autocomplete to work in IDLE?

I want to write scripts in IDLE, but I love how the built in python window in ArcGIS 10.2 automatically fills in the module names as you start typing them. For example, if I type arcpy.Lis..., the ...
4
votes
2answers
290 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 ...
4
votes
1answer
289 views

Modifying script published as Geoprocessing Service in ArcGIS for Server?

In ArcGIS 10.1 before publishing script as a new GPService I have to run it in ArcMap. It is a good solution when I handle small amount of data. When I want to change something in my script I have to ...
4
votes
1answer
828 views

Problem: Arcpy Graph function empty graph output

Background: I have some python code that I need help with parameter passing into the MakeGraph_management arcpy function. I would like to create a two-series vertical line graph for every pair of ...
4
votes
2answers
915 views

How to replicate an unversioned SDE geodatabase to a file geodatabase?

I need to implement a process for creating a file geodatabase copy (a read-only snapshot, essentially) of a production SDE geodatabase without using versioning, adding global ID columns, etc. I cannot ...
4
votes
2answers
765 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, ...
4
votes
1answer
1k views

Using matplotlib to create and export graphs automatically from ArcMap

I am going to start a project soon where, after the data has been processed in various ways, an output jpg showing a graph of the data should be produced. The workflow is as follows: 1. A feature ...
4
votes
3answers
1k views

Adding group layer, renaming it from folder name, then adding layers to it from that folder, using ArcPy/Python?

I am trying to use os.walk to go through a directory tree, pull out all the .shp files in it, create a grouplayer in the mxd, rename the grouplayer the folder name, then add the layers from that ...
4
votes
1answer
374 views

Slow performance on splitting a shapefile by attributes

I've tried to develop some workflows with the ArcPy module for splitting a shapefile based on the unique values in a specified field. The code works as expected except one thing I am not able to ...
4
votes
2answers
431 views

Running Python 2.6 and 2.7 in ArcGIS Desktop?

I figure that there must be a way for me to run python 2.6 and 2.7 on the same computer. I've got a program that requires 2.7, but ArcGIS 10.0 requires 2.6. I'd like to be able to run both programs ...
4
votes
1answer
187 views

Converting dbf into raster image using Python as way to add table to layout?

ArcPy does not have a function to add a table to a layout. I was thinking that maybe taking that table (e.g. a dbf), there may be some python script command to turn it into a raster (e.g. do ...
4
votes
4answers
1k views

Arcpy add and calculate fields for features in a list

I have a script I am working on and am hitting a runtime error. I am attempting to create a list of all of the shapefiles within a root directory, then add a field to each shapefile and calculate it ...
4
votes
2answers
1k views

Programmatical Setting of 'Store Relative Pathways' for multiple MXDs ArcGIS 10.1

I am looking to move large number of mxds to a different location on the same drive. Many mxds haven't got 'Store relative pathways' option checked therefore this operation will result in broken links ...
4
votes
1answer
1k views

Pass a variable from Modelbuilder into a Python script

I'm new to modelbuilder and python. I have used modelbuilder to iterate through all rows in a shapefile (Points), process them, and produce a seperate output shapefile for each row. The filename is ...
4
votes
1answer
406 views

Counting and storing events contained within polygon using ArcPy?

I have a fairly large project and I would like to automate some tasks using Python. Problem is, I don’t have any experience with Python for ArcGIS. And I rarely use ArcGIS until something big like ...
4
votes
3answers
380 views

Filtering dataset using SQL or Python in ArcGIS Desktop?

Using ArcGIS Desktop 10.0 SP4. I have a large dataset of sites that needs to be filtered down to a usable size. There is an attribute for the site_ID and another one for the site_type. There are ...
4
votes
2answers
6k views

How to reference a specific layer in a dataframe with Arcpy

I am trying to reference a Layer named "Tim" in the dataframe "Layers" in my .mxd. It is not working. I have looked at the ArcGIS online help and all else in this forum. Can't get rid of this Runtime ...
4
votes
3answers
6k 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 ...
4
votes
3answers
1k views

Questions on smooth lines on soil polygon?

In a couple of weeks I am going to do QA/QC on soil polygons and I'm wonder if there is a way for me to run a script or a tool box that allow me to find the jagged lines ? Alternative, my plan would ...
4
votes
1answer
828 views

How to save and reload legend settings using Python?

I know how to change settings of a legend individually by arcpy (like: Patch, Title, Items, Columns, Frame, Element Size&Position, etc.), but now I would like to use the exact legend settings ...
4
votes
1answer
2k views

Repairing broken links for new paths of layers to shapefiles using ArcPy?

I have an .mxd with broken link layers and each layer has a different new path. I know the python script for repairing the broken links of the layers, but I want to put all the new paths of the layers ...
4
votes
1answer
458 views

How to write code for downloading a file in ArcGIS 10?

I have an offline database which has lat & long coordinates. The functionality I need to provide is to have a (latitude, longitude) point which will have country and city in it. Once the user has ...