Tagged Questions

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

learn more… | top users | synonyms (1)

1
vote
2answers
77 views

How to create a new field with a combination based on another field with arcpy?

I like to create a new txt which has two columns: Id and GRIDCODE. This is the original Table: The Id column of the new txt should have just unique values. I’m able to do this with the following ...
1
vote
1answer
37 views

ArcGIS 10.2 arcpy — how to import/install win32com?

win32com used to be included with arcpy 9.x but no longer. I used to use it to manipulate excel occasionally. I downloaded and let win32com install itself and then tried to follow some online ...
2
votes
1answer
82 views

ArcGIS “Merge” tool is slower on arcpy than when starts it with ArcGIS interface

I am writing python script on ArcGIS 10.2.2 and found some strange bug. I use merge tool to process 498 shape files (they are located on a hard drive). Using arcpy script it takes 6 minutes, but when ...
1
vote
1answer
46 views

how to create a multipoint geometry in arcgis using python and arcPy library

I have specific points and I need to create multipoint geometries, in a model-builder python script, following an equation that provides me the new (x,y) points around my initial point. Is there any ...
2
votes
1answer
81 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: ...
1
vote
1answer
50 views

Add annotation feature class to mxd with arcpy

From what I have researched, I'm pretty sure the answer is NO, but I want to make sure no one has found a work-around. Annotation feature classes in personal geodatabases need to be added to mxds. ...
1
vote
1answer
61 views

select random rows with python in arcgis

I am new to using Python in ArcGIS, and I wonder: how do I select random lines (or every two lines) of an attribute table? I must select these lines and calculate them, so they are different from ...
0
votes
1answer
56 views

Cause of ExecuteError: ERROR 000539: Invalid field County Insets.OBJECTID Failed to execute (CalculateField)?

The following script joins two layers on a common id and attempts to use the OBJECTID in the joined table to update records for a field in the input table. In running it in "current" mode, it moves ...
2
votes
1answer
69 views

arcpy with multiprocessing throws “UnpickleableError: Cannot pickle <type 'geoprocessing Layer object'> objects”

I'm attempting to speed up a process which is currently running synchronously, by using the python multiprocessing module. I'm having trouble sending a feature layer to a function which is called by ...
0
votes
1answer
62 views

arcpy SearchCursor return a OBJECTID value not as an integer

I use summary statistics GP tool to extract the max OBJECTID from a feature layer. After that I use arcpy SerachCursor to get the OBJECTID value from the statistics, but the result returned is not an ...
1
vote
1answer
39 views

Maintaining reference to feature layer (rather than its name string) throughout Python script? [duplicate]

When creating a Layer in arcpy, the syntax uses a string to denote the layer name, as shown in the Make Feature Layer sample script: import arcpy arcpy.env.workspace = "C:\Program Files ...
1
vote
1answer
79 views

Why does arcpy.TableToDomain_management require exclusive schema lock?

I'm talking about arcpy.TableToDomain_management, ArcGIS Server 10.2 It seems that this function requires exclusive SDE database schema lock. Something that we can't accept. We have ESRI domains but ...
7
votes
1answer
291 views

Meaning of exclamation mark in Python parser of ArcGIS Field Calculator?

In the following line, I don't understand what those exclamation marks mean? And why put everything in quotation? I don't understand the purpose of the variable expression, please explain to me as I'm ...
1
vote
1answer
51 views

Populating Access (*.mdb) table with text from Text Elements to inventory MXDs using ArcPy/Python?

I am trying to write a piece of code to populate an Access mdb table with information from text elements in an mxd (text elements all have "names"). The purpose of this is to create a catalog of my ...
1
vote
1answer
39 views

ArcPy Label Class object returning unexpected value for expression property?

import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") for lyr in arcpy.mapping.ListLayers(mxd, "TestFile_LineToPoints13_Prod"): if lyr.supports("LABELCLASSES"): for lblclass in ...
1
vote
2answers
189 views

Split a string column into 2 columns in python [closed]

I have a csv file and this is the structure of that file. It has only one column with number of strings. I want to split this one column into 2 columns at the character \. Can anyone please tell me ...
1
vote
1answer
84 views

Conditional drop-down menu list in a python script tool

I have created a script tool from some python code, and in a previous question, I learned how to enable a drop-down list in this tool by changing the Validation code - see link and image below: ...
1
vote
1answer
97 views

List all Feature datasets & feature classes from a single geodatabase into CSV

I have prepared a python code and I got the following errors: "Parsing error IndentationError: expected an indented block (line 11)" and "Runtime error Traceback (most recent call last): ...
-1
votes
2answers
92 views

arcpy.Delete_management(“”) not working

I've written a script in a python toolbox. That script creates a folder in the user defined workspace for all the output files that are created during the script process. When the script is done, I ...
1
vote
2answers
43 views

Script fails when executed from toolbox but not in command window (MakeFeatureLayer)

I am able to run the below code in the Python command window in ArcMap 10.2.1 without issue. However, when I run this as a toolbox script, it fails at line 15: newLyr = ...
1
vote
0answers
72 views

Python coding problem - unicode string passed from dictionary to AddField

I tried all possible hints but I´m still stuck. I want to write a script that can be executed from a toolbox in ArcMap/ArcCatalog. It should rename fields (build lists with old fieldnames, new ...
1
vote
1answer
82 views

Export to SHP with ArcPy with query

I have a shapefile with table with area code (field areacode). How can I export with ArcPy each unique area code so I get a SHP file for each one? It takes too long to select the layer and query ...
0
votes
0answers
43 views

Arcpy Export To PDF exporting same PDF instead of changing

I have been trying to run a loop that would change a layer in an .mxd during each iteration and then export it to a PDF. When I run it, the exported PDFs are all exactly the same as the .mxd in the ...
4
votes
1answer
194 views

Setting up a Drop-Down list in the Parameters of a python script tool from a large list

I am trying to create a tool from a python script I have written that will take a list I have created and use it as a drop-down menu in the finished tool as one of the inputs (see attached image for ...
4
votes
0answers
155 views

Concatenate features in one feature class by the unique ID

Is there a way to concatenate features in ArcGIS by using ArcPy, or field calculator, to produce the following output? I am aware of the concatenate tool that Esri created, however it doesn't keep ...
2
votes
2answers
38 views

Assigning a vector to a field in feature class (UpdateCursor)

I don't know if my mistake is of a general nature. I come from R where it is very easy to store a vector in a matrix column. So now I (new to coding with arcpy) am desperately trying to do the same ...
5
votes
1answer
114 views

Calculate the common area between polygons using python?

I am trying to calculate the common "empty" area between the neighbouring polygons in order to calculate the porosity volume (the red area in the image) My idea was, first to use Convert ...
1
vote
1answer
73 views

ArcPy FieldMappings syntax using Merge tool

I'm working on script that takes several table results from the Zonal Statistics As Table tool and merges them into a single table. When merging I encounter the issue that the exported .dbf files have ...
1
vote
1answer
73 views

Is the MakeFeatureLayer temporary location the same as “in_memory”? [duplicate]

From the ArcGIS Desktop Help: The layer that is created by the tool is temporary and will not persist after the session ends unless the layer is saved to disk or the map document is saved. ...
0
votes
0answers
37 views

ArcPy PointToRaster memory locking error solution?

RasterToPolygon ArcPy tool fails on generated raster (PointToRaster) with large(?) dataset. Not sure the size threshold, but fails on 78559 x 33544 raster, completes on smaller datasets so I know ...
1
vote
1answer
56 views

ArcPy script stops running randomly with no error returned

I am doing a batch watershed and analysis process on 135 points. This script worked great the first time I ran it. Ever since the first time, however, I have had the script stop at random moments. ...
0
votes
1answer
52 views

Can FieldMappings be used to drop all attributes?

We have a script that regularly copies a bunch of feature classes out to shapefiles, keeping only the most important attributes (e.g. customer category) and dropping useless/private information (e.g. ...
1
vote
1answer
74 views

How to print log from FME when run from python script?

I created a Spatial ETL ToolBox in ArcCatalog. When I run the tool from ArcCatalog I see log massages. But when I run this tool from a python script, the logs do not print to the python console. ...
1
vote
1answer
45 views

Programmatically access HTML Popup in Layer Properties ArcGIS 10.2

Is it possible to access HTML Popups (found in layer properties) programmatically in ArcGIS 10.2? I can't find any reference but thought I'd ask to double check.
0
votes
0answers
35 views

What is the most efficient method for deleting row/features from a versioned FC in python?

I'm trying to delete all records from a feature class in SDE and then append new data using python. My dataset is versioned in SDE. I've tried Truncate Table (doesn't work with versioned tables), ...
1
vote
1answer
46 views

Creating fishnet from template feature class using ArcPy?

I can’t use the tool arcpy.CreateFishnet_management because define the parameter “templateExtent” with a shapefile it is not filling automatically the parameters “originCoordinate” and ...
2
votes
3answers
182 views

How to use ArcPy to Check if Search Cursor Returns Anything

How can I use arcpy to check if a search cursor returns anything and then do something based on the answer. So far I have this and it recognizes the positive - i.e. when i pass the query for 001 it ...
0
votes
1answer
283 views

'List indices must be integers not tuple' Error

I'm using an insert cursor to write rows to a destination feature class where the input Shapefile field names do not match the destination FC names. To accomplish this, I'm trying to use the indices ...
0
votes
1answer
9 views

How do I not specify a CustomerWeightField when scripting CustomerDerivedTA_ba?

When you run the Business Analysis toolbox wizard for creating a Customer Derived Trade area, you have the option of weighting each customer by count or for specifying a field (such as sales or number ...
1
vote
2answers
57 views

Automate Select and Export to PDF using Arcpy Search Cursor

I'm trying to automate a process to select each feature of a feature class one by one, zoom to it and export as pdf. using the code below, the first feature is selected and the pdf is exported, and ...
1
vote
1answer
28 views

Update row with another not None row

I'm working with an attribute table in ArcMap 10.2 where there are some 30 fields mainly consisting of NULL values. I don't want to display to users a table full of NULL values as it'll be difficult ...
1
vote
1answer
92 views

Create a fishnet in a 'for' loop with Arcpy

When running the following script, I get the error saying that I need a value for “origin_coord” and for “y_axis_coord”. So is it not enough to define a template dataset? But how can I fill the ...
2
votes
2answers
151 views

Join Field works in ArcMap but not in Python

I am trying to join a field of values found within a DBF to a multi-polyline shapefile. They share a common field name (filename) and the values found within each are identical. I was able to run Join ...
3
votes
1answer
61 views

Create conditional to check if raster has value

I have a problem with this code: ac = ExtractByMask(raster, "area.shp") arcpy.RasterToPoint_conversion(ac, "point.shp", "VALUE") The problem is that sometimes the raster has no value. (It's a flow ...
5
votes
1answer
112 views

Is it possible to drive one mxd (pan) using a different mxd with python?

I have 2 mxd's. mxdA and mxdB They both show different data, but are both in the same coordinate system. I want to be able to sync mxdB with mxdA, so that if I pan / zoom in mxdA, I can then, with ...
1
vote
2answers
58 views

Why does arcpy.sa.Sample give TypeError: Sample() takes at least 3 arguments (3 given)?

I'm building a script where I'm taking a standardized CSV that one of our data processing packages consistently exports and turns it into a z-aware shp after running through Sample as well. Along the ...
1
vote
0answers
69 views

SQL Prefix for arcpy.da.SearchCursor

Does the sql prefix - DISTINCT work well on SDE tables? http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000011000000 Syntax: SearchCursor (in_table, field_names, {where_clause}, ...
1
vote
2answers
141 views

Concatenating text and string in Field Calculator expression (python)

I'm trying to copy an attribute value from one field to another (sum of raster values), but I'm having issues in writing a functioning expression for a Calculate Field script. I'm adding a field ...
2
votes
1answer
56 views

Python loop with address locator

I was given a list of addresses without any zip codes, and I'm trying to write a python snippet that will loop through a set of possible zip codes and make a set of geocoded shapefiles that I will ...
1
vote
1answer
26 views

Short list of .prj options in .pyt

I'm tasked with creating a .pyt to distribute across our office and field computers (state geological survey) for converting .gpx to features but constraining the choice of projections/datums to seven ...