Questions tagged [arcpy]

A site-package created by Esri to expose ArcGIS Desktop (ArcMap and ArcGIS Pro) geoprocessing, mapping, etc, to Python.

A site-package created by Esri to perform geographic data analysis, data conversion, data management, and map automation with Python.

ArcGIS Pro currently has the following modules:

  • Charts module (arcpy.charts)
  • Data Access module (arcpy.da)
  • Geocoding module (arcpy.geocoding)
  • Image Analysis module (arcpy.ia)
  • Mapping module (arcpy.mp)
  • Metadata module (arcpy.metadata)
  • Network Analyst modules (arcpy.nax and arcpy.na)
  • Sharing module (arcpy.sharing)
  • Spatial Analyst module (arcpy.sa)
  • Workflow Manager (Classic) module (arcpy.wmx)

ArcMap currently has the following modules:

  • Data Access module (arcpy.da)
  • Mapping module (arcpy.mapping)
  • Network Analyst module (arcpy.na)
  • Spatial Analyst module (arcpy.sa)
  • Time module (arcpy.time)
10574 questions
17
votes
3 answers

Expecting ArcPy to overwrite files in geodatabase file?

I'm writing a python script, I've got an mxd and its workspace is a geodatabase file with all the files I need into. The problem I'm encountering in testing and writing code is that, despite of the command: arcpy.env.overwriteOutput=True all the…
Annalisa Minelli
  • 517
  • 2
  • 5
  • 15
14
votes
2 answers

Deleting in-memory Table View?

In a Python script, I'm cycling through thousands of Excel files and using arcpy.MakeTableView to create in memory table views from the first spreadhseet in each file. How do you delete the reference to the in-memory view? I've tried deleting the…
Jeff Berry
  • 1,820
  • 1
  • 13
  • 28
13
votes
1 answer

File Validation using ArcPy?

I have a script which scans a directory and outputs basic raster data information such as the file name, format, number of bands, and etc. I need a way to make it so if the directory does not contain raster data (i.e., anything other than raster…
kaoscify
  • 981
  • 2
  • 10
  • 22
10
votes
2 answers

Add value in attribute field using arcpy

I need to add values to an existing field in the attribute table. The values are to be determined by values in another field in the same attribute table. I am unable to define the values in another field in the script. Can anyone help me with it?
poshan
  • 761
  • 1
  • 9
  • 26
10
votes
2 answers

Python scripts that run inside ArcMap vs ones that run outside?

I'm just starting to get into Python scripting for work. I'm currently creating a script to automate a process. Basically, it asks the user the client name, gets a projection if available, creates directory on C: drive for client, creates file…
ianbroad
  • 9,141
  • 4
  • 42
  • 88
10
votes
3 answers

Does ArcPy have 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 explains what I want to do (more or less): def…
user8175
  • 111
  • 1
  • 5
9
votes
1 answer

The role of '#' in a python 'if':

I recently exported an ArcGIS model to python and was reviewing the script and am confused by the following line: if TRU_W_DatableFeatures == '#' or not TRU_W_DatableFeatures: What is the role of the '#'?
Kevin
  • 4,926
  • 2
  • 26
  • 50
8
votes
4 answers

Subset Folder Contents ArcPy

I have about 1500 .txt files within a folder named 3410001ne => 3809962sw. I need to subset about 470 of these files to process with a Python script. Below is the section of code prior to my for loop which lists all of the files in a folder: #…
Aaron
  • 51,658
  • 28
  • 154
  • 317
7
votes
1 answer

Checking if service pack is installed using ArcPy?

Is there a way to check with arcpy whether or not a specific ArcGIS for Desktop service pack is installed on the local machine? More specifically, my script can only work with ArcGIS 10.1 with SP1 or higher versions. In case of earlier versions, I…
isshp
  • 418
  • 3
  • 12
6
votes
1 answer

Why are results from Python tool not in Results window?

I am relatively new to ArcPy 10. and I want to return the list of feature class from a dataset. I can see them through the message, but cannot see them from the result window. Actually there are only inputs, environments and messages I can view from…
Alex
  • 377
  • 2
  • 11
6
votes
1 answer

Using feature class name as name in output (buffer_analysis)

I'm pretty new in python, and I'm trying to iterate through a list of feature classes, and perform a buffer on each feature class. So I've done this: import arcpy from arcpy import env env.workspace =…
Andy Fisher
  • 339
  • 2
  • 8
6
votes
4 answers

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 connector line is perpendicular to the polyline. If…
Michael Lachman
  • 101
  • 1
  • 5
5
votes
3 answers

How does one replace characters in a layer name using Python ("_" with " ")?

I can rename layers easily enough, but I really need to replace any "_" with a " ". This code just renames layers, but I would like to do a find and replace on each layer name mxd = arcpy.mapping.MapDocument("current") layers =…
user23498
  • 59
  • 1
  • 3
5
votes
2 answers

Backwards compatible python scripts in ArcGIS

As I move through my small collection of python scripts written for arcgis 9.3 I'm discovering that many things work with little or no changes in arcgis 10. For example this pattern "just works": import arcgisscripting gp =…
matt wilkie
  • 28,176
  • 35
  • 147
  • 280
5
votes
1 answer

What is the most efficient way to get a list of featureclasses from a large ArcSDE database?

I have a SDE DB which consists of 40 feature datasets and around 300 featureclasses. I need to get the full list of all featureclasses whose name does not contain "ARCHIVE". It takes several minutes using the script below. It will be unacceptable…
Alex
  • 377
  • 2
  • 11
1
2 3
26 27