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

learn more… | top users | synonyms (7)

1
vote
1answer
845 views

How to use python to export ArcGIS Server Map Service Properties?

What arcpy module can I use to write a python script to mine for fields of my map service properties and export them to a .tx file? I assume we need to tap into GIS Servers within the ArcCatalog ...
1
vote
1answer
681 views

Using arcpy.Exists for domains?

A script I made creates domains within a selected geodatabase. I need it to not create the domains if they already exist because if they do, it gives an error saying invalid domain name. Is there ...
1
vote
2answers
2k views

How to Set up Data Driven Pages using arcpy?

I've read a lot about the topic data driven pages. I'm writing a python script for ArcGIS and I've defined my stripmap using the arcpy.StripMapIndexFeatures_cartography command and now I have to set ...
1
vote
1answer
293 views

Debugging error 000539 from ArcGIS Field Calculator?

What am I doing wrong in this field calculator logic? Pre-logic def re_score(elev_t,f2, contour): f2=contour if elev_t.endswith('.5'): f2 = "Midi" return f2 Expression for field "Contourtyp" ...
1
vote
1answer
28 views

Calculate Field throws an error when parsing python with backslashes

I have an FTP I need to access through a python script. It works fine with forward slashes, but I don't need it to be read as an html. Below are both sets of code: Working: ...
1
vote
1answer
38 views

Python Process Question

I'm a new Python student looking for some help regarding a homework problem. I need to analyze wells with each county in a state. So I have the wells shapefile and a counties shapefile for a state. ...
1
vote
2answers
42 views

Recording the ArcPy script execution method

I have composed an ArcPy script which is run via a windows scheduler.The same script is loaded into a script tool so a user can run the process manually. I've used: get parameters as text, with or's ...
1
vote
2answers
50 views

Count number of group layers or Layers inside group layer using ArcPy? [closed]

I am looking for a way of counting the amount of layers within a group layer I have an empty group layer inside my map and I am looking for a way of initiating a process if there are 0 layers inside ...
1
vote
1answer
32 views

Iterating through list of fields using field calculator?

import arcpy, sys, itertools arcpy.env.workspace = r'path to geodatabase' fields1 = ['gearqty', 'cnemarea', 'fzone', 'qdsq', 'tensmsq', 'crew', 'nanglers', 'port', 'totalquant', 'trip_days', ...
1
vote
2answers
30 views

Writing value from attribute table to text element using ArcPy?

Is there a way, using ArcPy, to read a field from an attribute table and write the contents of that field into a text element? I have a point feature class with a field name called "Cities". I will ...
1
vote
1answer
60 views

Text field character length optimizer

I need to automatically optimize text field character length to their current largest attribute character count. For example the field "MyName" is 250 characters long, but has attributes that are a ...
1
vote
1answer
54 views

how to save a raster after converted from numpy array?

I'm trying to save a raster after calculation in numpy array. Here is what I wrote: rasterSM = arcpy.NumPyArrayToRaster(SM, lowerLeft, cellSize, value_to_nodata=nodata) rasterSM2 = ...
1
vote
2answers
67 views

Checking if SQL where clause is valid with Make Feature Layer?

Unfortunately it's possible to apply an invalid SQL where clause when using arcpy.MakeFeatureLayer_management. This can cause issues later in a script. For example, I created a feature layer and ...
1
vote
3answers
57 views

Find Max Value and next highest two in Column using ArcPy?

I have a piece of code where I am able to find the max value. How can i edit this code to find the second largest, and then the third? I found this code here ...
1
vote
2answers
84 views

Replicating Summary Statistics tool with case field using own calculation within ModelBuilder?

I thought this would be a simple problem to solve, by my googling hasn't provided the answers so far. I have created a near table (Using the 'Generate Near Table' in Arc) comparing two sets of ...
1
vote
1answer
56 views

Export legend element using arcpy.mapping

I'm working on an ArcGIS JS API web application that requires a heavily customized PDF report. When a user submits their desired extent to our reporting function, we need to convert their webmap to ...
1
vote
1answer
43 views

Problem adding feature name to field in attribute table

I have a small script that should take the name of the file and add it to a newly created field in several shapefiles. import arcpy arcpy.env.workspace = r"c:\users\athom\desktop\timber\New4" ...
1
vote
1answer
217 views

Arcpy getCount_Management doesn't match row count with Cursor

I have some troubles to understand the behaviour of my code below. Obviously, GetCount_Management doesn't match the rows in my layer selection. This code is part of a long for loop. I have hidden the ...
1
vote
1answer
62 views

arcpy and ArcGIS Pro: update Z values of a pointMZ geometry

I am trying to "reverse" the values of Z in a pointMZ geometry with arcpy.da.UpdateCursor. Anyway, I am not able to find a way to achieve this, although my script seems to work (no errors, printing ...
1
vote
1answer
83 views

convert dbf file to txt file using arcpy

I have a series of dBase files and I'd like to convert them to text files Anyone can help me? I've tried table to table, doesn't seem to work. The idea is to get ASCII files so I can do further ...
1
vote
1answer
31 views

How to create dynamic point_coord variables for Neighborhood Selection?

I'd like to us the arcpy.GANeighborhoodSelection_ga in a loop where the point coords would come from a different source. What I tried already: If I define the coords, it works: pointcoord = ...
1
vote
3answers
106 views

Arcpy/REST: how to save raster dataset from URL

I have a script which downloads features from an ArcGIS MapServer via the REST API. Getting vector features is relatively trivial since the features can be retrieved as JSON. However, when retrieving ...
1
vote
2answers
65 views

Adding output parameter to Python script tool?

How do you add an output parameter in a python script in a toolbox?
1
vote
1answer
62 views

Cannot access row[1] using arcpy.da.SearchCursor [closed]

My code creates a dissolved feature class with 2 rows. For some reason I am unable to access the 2nd row using the following code: fcCount = arcpy.GetCount_management(fc) print(fc) #2 def ...
1
vote
1answer
149 views

Create polygons from points representing the corner vertices (ArcGIS)?

I am on ArcGIS 10.3.1. I have a point feature class that represents the corner vertices of the polygons. They are located in a regular grid. The labels represent the OBJECTID. The points can be ...
1
vote
1answer
72 views

Change numeric field values into negative

I would like to change one field values into negative (i.e. original column, row 1 = 5, new column row 1 = -5 in a feature class list. I got until the addfield and calculate field functions, but it ...
1
vote
2answers
49 views

how to export fclist and fccount to csv

i am looking for a method by which i can export fc list and fc count into xls or csv. for example i have 3 featureclass in Scratch.gdb. 1.PaLakh 2.PATest1 3.Point i want all 3 of these ...
1
vote
2answers
75 views

Selecting MultiPart Polygons if there are buildings in at least two of the parts

my data situation: shape of polygons (some are MultiPart Poylgons) shape of building locations (Points) What I need: Select all polygons that have two ore more parts and contain one building or more ...
1
vote
1answer
85 views

How to add separator in ArcGIS python add-in tool bar?

I am trying to separate two sets of button tools in a python add-in toolbar. I am trying to make a toolbar like existing arcmap toolbar where different classes of tools separated by "|". Can this be ...
1
vote
1answer
45 views

Updating a feature class based on evaluating different fields with arcpy.da.UpdateCursor

I have a feature class with a number of fields, two of wich are key fields, named key and front, and secondary fields named key_n and front_n. The thing is I need to search in the whole table for any ...
1
vote
1answer
72 views

Adding drop down option for layers in Python script tool?

I've code that will add fields to feature classes. I've parameterized the script so the user can navigate to the location of the feature classes to be edited. If the feature class is already open ...
1
vote
1answer
87 views

How to create an ArcGIS toolbox programmatically?

Is it possible to programmatically create an ArcGIS toolbox? The aim is to write a plugin that works in ArcGIS and have a single source for the tool parameters which is then compiled to an Arc ...
1
vote
2answers
173 views

Creating tool in Python toolbox to export field list to Excel?

I am creating my first tool in a Python Toolbox (*.pyt) to export a list of fieldnames to Excel. I have the following bits of code: import arcpy class Toolbox(object): def __init__(self): ...
1
vote
1answer
141 views

How to copy attachment feature class from personal GDB to File GDB?

I have some feature classes with attachments in personal geodatabase . I want to copy these from personal to file geodatabase automatically using arcpy. I used the code suggested by @Aaron to copy ...
1
vote
1answer
83 views

Determining local geodatabase release version with arcpy?

Can anyone get the release version of a ESRI local geodatabase, using arcpy? I should be simple, and yet... I use the "Describe" function on both personal and file geodatabases, and need to retrieve ...
1
vote
2answers
354 views

How to check for empty values in fields of a featureclass?

(ArcGIS Desktop 10.0 Python 2.7) I need to check if any empty fields exist in featureclass fields in a gdb. These could be NONE, NULL "". The field name here is "Stand". The following code doesn´t ...
1
vote
2answers
43 views

Problem using object as output path for arcpy.SaveToLayerFile_Management

I am simply trying to create a selection of a street layer from street names that appear within a separate .dbf of street names and create individual layers of each selection with a for loop. ...
1
vote
2answers
107 views

AddIndex_Management throws maximum open cursors exceeded

The following script is run to create indexes across all the feature classes within a particular dataset: import arcpy import os.path def listFcsInGDB(): for fds in ...
1
vote
2answers
273 views

Use Python to Find duplicate values in a feature Class and populate a field

So I found this python script on another post here and was trying to adjust it for my needs. I'm a very novice python user so I'm struggling with how to modify the script. I have a Feature Class ...
1
vote
1answer
181 views

ArcGIS 10.2: ArcPy - how to replace workspace paths?

I am teaching myself ArcPy and I am attempting to make a code to replace paths to the items in my workspace. I had a file geodatabase and its path changed so I would like to automatically modify the ...
1
vote
2answers
130 views

Spatial Join - One Join Feature to Multiple Target Features

I want to join a set of target features (polygons) to a set of join features (points). The polygons can, and do, overlap. I want the join features to be counted (joined) to as many target features ...
1
vote
2answers
193 views

Access individual bands and use them in map algebra

I have a list of multiband rasters, consisting of: Red=Band 1, NIR=Band 2, SWIR1=Band 3 and SWIR2= Band 4. What I want is to access only the red and NIR bands and save it to new file. Then, I'll be ...
1
vote
1answer
70 views

CalculateField with variables

I'm trying to make a python script on arcmap 10.2.2 which will copy values from an old field (selected by the user) and paste them in an new field (named by the user). I wrote that: fc = ...
1
vote
2answers
81 views

Error when creating data with special characters and numbers [duplicate]

My code will not project and store the feature layer in the scratch.gdb. "ERROR 999999 ... The table name is invalid. The table was not found. [17_5330_51961Lake]" The interpreter doesn't like "-" ...
1
vote
2answers
134 views

Arcpy - Calculate total time, last value minus first value

For the script tool I've written (below), one of the things I want to do is after user input has pulled tabular data (into a feature class) I want to take the last value of the 'logdt' and subtract it ...
1
vote
1answer
90 views

Add and Calculate Field in Table with ArcPy?

I have written the following script to iterate it as a tool for all my tables with ModelBuilder, but i have a problem wth my codeblock. I want to add a field FID to all my tables and to add the values ...
1
vote
1answer
83 views

arcpy.da.Editor undoOperation(): does it actually work

Ok, so I have looked over the ESRI documentation thoroughly and I'm still baffled by the arcpy data access module and the function undo operation. So far I have tried: workspace = pathtofile ...
1
vote
2answers
185 views

Python Crashes when Running ArcPy's ExportToPDF(), ExportToPNG(), ExportToJPEG()

I am attempting to loop through a folder of ~400 .mxd's and save each to a .pdf in another folder. All tested arcpy.mapping export functions (pdf, jpeg & png) kill python without a chance to ...
1
vote
1answer
90 views

Debugging/logging ArcPy / Python code behind ArcMap function?

Considering I Can use the right click --> set datasource at an mxd file to change the datasource. The following pictures describes how this can be done in arcmap.. How can I see the arcpy / python ...
1
vote
2answers
137 views

Deleting output shapefiles which have no data/features using ArcPy?

Still working on cleaning this up but it runs fine. Below is the rough code for a tool that iterates through field rows and clips accordingly to that row's shape. Everything outputs nicely but there ...