Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 23263

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

3 votes
Accepted

Updating multiple fields with list values using arcpy.da.UpdateCursor

You are trying to call multiple indices at once, which does not work. Comma-separated values in Python translate into a tuple, so this: row[1, 2, 3] actually translates to this: row[(1, 2, 3)] …
BritishSteel's user avatar
  • 6,657
1 vote

Using erase tool in Python?

Here's how that could be achieved: import arcpy #Set workspace arcpy.env.workspace = "USER_TEMP\\RAY\\test\\" #Erase and Current buffer workspace eraseAndCurrent = [ ["/ADE01_ALL_BUFFERS_05_09_16 …
BritishSteel's user avatar
  • 6,657
2 votes
Accepted

ArcPy Dissolve Statistics Fields

I wish the error messages in ArcPy were sometimes more helpful. …
BritishSteel's user avatar
  • 6,657
2 votes

Set arcpy command line parameter same as Tool parameter

When running your tools from the console it is suggested you use the more general sys.argv instead of the arcpy-specific arcpy.GetParameterAsText(). This page from Esri shows you how to use sys.argv. …
BritishSteel's user avatar
  • 6,657
4 votes

ERROR 000732 from ArcPy?

Try entering your path as a rawstring, such as in this snippet: arcpy.CreateFeatureclass_management(r"C:\test_script\Fish.gdb", ... Basically, just prepend an r.
BritishSteel's user avatar
  • 6,657
2 votes
Accepted

Multiple rename shapefiles and feature classes in python

The following would do it with your directories: import arcpy InWork = ["D:\\GIS_Temp\Folder A", "D:\\GIS_Temp\\Folder"] for ws in InWork: arcpy.env.workspace = ws datasets = arcpy.ListFeatureClasses … Otherwise Python would name it, for example, dataset.shp.shp and that would crash ArcPy. …
BritishSteel's user avatar
  • 6,657
3 votes
Accepted

Simple python query: properly setting up arcpy.env.workspace and defining datasets

You forgot to mention the extension. If you are working with shapfiles in a workspace you always have to add the '.shp', such as here: PmsNet = r'MARCHNET.shp' You can work with the name alone onl …
BritishSteel's user avatar
  • 6,657
0 votes
1 answer
3k views

ArcPy Dissolve Statistics Fields

While running a Dissolve, when using statistics fields, I keep getting an error that the parameters are not valid. Here is my code: toBeDissolved = r"D:\TestingAfterMeeting\toBeDeletedTestingData\ …
BritishSteel's user avatar
  • 6,657
1 vote

python conditional statement to allow either two inputs or only one input going into a merge

There are at least two things you could do. You could define default values for your parameters, and then, if the default does not occur you will execute a certain piece of code. For example, let's …
BritishSteel's user avatar
  • 6,657
2 votes

Replacing arcpy.AddMessage() with open source?

I assume you are trying to convert your scripts so that they can be used in open source software or with open source libraries, otherwise the question's title would not make too much sense to me. Fi …
BritishSteel's user avatar
  • 6,657
5 votes
Accepted

Manipulating Text elements in ArcPy?

'Done' is printed in each iteration, whether 'Land Use' applies or not. So if there are three text elements, then 'done' will be printed three times. To just have it show once, you have to remove it f …
BritishSteel's user avatar
  • 6,657
6 votes
1 answer
4k views

Getting index of active data frame in ArcPy?

I am a little surprised to see that there seems to be no way to get the index of the active data frame in ArcPy, or did I miss something? …
BritishSteel's user avatar
  • 6,657
0 votes
Accepted

Arcpy buff does not provide the output attribute "Shape_Area"

Here is a script that would achieve it: import arcpy import os arcpy.env.workspace = r"D:\Test\Data_Points" Buffers = arcpy.ListFeatureClasses() out = r'D:\Test\data.gdb' for buff in Buffers: arcpy.Buffer_analysis …
BritishSteel's user avatar
  • 6,657
-1 votes

Removing white space from field values?

With ArcPy you would do the following: import arcpy with arcpy.da.UpdateCursor(r'pathToYourDataset',['theField']) as cursor: for row in cursor: row[0] = row[0].strip() cursor.updateRow …
BritishSteel's user avatar
  • 6,657
2 votes

Using ArcPy to zoom to Y,X (string) coordinate pair copy/pasted from Google Maps?

I just got this script to do what you want: def panToExtent(gmapsLonLat): mxd = arcpy.mapping.MapDocument('CURRENT') dataFrame = arcpy.mapping.ListDataFrames(mxd)[0] lat, lon = gmapsLonL …
BritishSteel's user avatar
  • 6,657

15 30 50 per page