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 19819

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

3 votes
1 answer
381 views

Adding Combobox to Python Toolbox tool dialog?

import arcpy class Toolbox(object): def __init__(self): """Define the toolbox (the name of the toolbox is the name of the .pyt file).""" …
Mona Coder's user avatar
3 votes
0 answers
96 views

Creating MXD From Standalone ArcPy Snippet? [duplicate]

Is it possible to create some MXD from a list using Arcpy stand alone snippet? … For example if I have a list like counties = ['Benton', 'Caroll','Polk','Scot'] can I run a code like import arcpy for mxd in counties MXD = arcpy.mapping.MapDocument(r"C:\\"+ mxd+ '.mxd') …
Mona Coder's user avatar
3 votes
2 answers
6k views

Not Able to Pass Where Clause in SearchCursor in ArcPy

import arcpy from arcpy import env def unique_values(table , field): with arcpy.da.SearchCursor(table, [field], '"[NAME_1]" = Ohio') as cursor: return sorted({row[0] for row in cursor}) uniques …
Mona Coder's user avatar
3 votes
2 answers
445 views

Printing Shapefile spatial Reference Using ArcPy?

I am trying to read and print out the coordinate system of a shapefile like this import arcpy dataset = r"E:\GIS\Centers.shp" desc = arcpy.Describe(dataset) extent = desc.extent spatialReference = desc.spatialRe …
Mona Coder's user avatar
2 votes
1 answer
621 views

Select By Attributes Based on Unique Value in Shapefile gives ERROR 000840?

Using ArcGIS 10.4.1 and Arcpy I am trying to select a shapefile by it attributes and create new feature class based on unique values like import arcpy from arcpy import env def unique_values(table , … \arcpy\management.py 7182 ExecuteError: Failed to execute. …
Mona Coder's user avatar
0 votes
2 answers
125 views

Specifying Resource Field For Labeling in ArcPy with ArcMap

How do I specify which field acts as resource for labeling a layer using ArcPy? … Following code is some settings that I am doing on a standalone ArcPy snippet and as you can see I added layer.showLabels = True but assuming I have a field named name I do not know how to add it to the …
Mona Coder's user avatar
0 votes
0 answers
877 views

Creating Feature Class Based on Select By Attribute Using ArcPy?

Using ArcGIS 10.4.1 and Arcpy I am trying to select a shapefile by it attributes and create new feature class based on unique values. … import arcpy from arcpy import env def unique_values(table , field): with arcpy.da.SearchCursor(table, [field]) as cursor: return sorted({row[0] for row in cursor}) uniques = unique_values …
Mona Coder's user avatar
0 votes
1 answer
26 views

Not Able to Create New Feature Class From Selecting By Attribute

# Import arcpy module import arcpy # Local variables: Dataset = "D:\\GIS\\TPK\\src\\New Folder\\lui.gdb\\Dataset" Louisiana = "Louisiana" Louisiana__3_ = Louisiana mm = "D:\\GIS\\TPK\\src\\New Folder …
Mona Coder's user avatar
0 votes
2 answers
243 views

Add Feature Class from Geodatabase Dataset to MXD using ArcPy Standalone Script?

I am trying to add a Feature Class from a Geodatabase Dataset to an MXD and save a copy like this but I am getting following errors on each methos import arcpy import os arcpy.env.workspace = r"C:\arcgis … lyr = arcpy.mapping.Layer("C:\arcgis\ArcTutor\AAA\GDBs\Delaware.gdb\Kent\Kent") arcpy.mapping.AddLayer(DF, layer, "AUTO_ARRANGE") MXD.saveACopy('newmxd.mxd') del MXD print(" Done") and import arcpy
Mona Coder's user avatar
-1 votes
1 answer
251 views

Renaming Feature Classes in Geodatabase Dataset? [closed]

I am trying to replace/rename feature Classes in a dataset like this import arcpy import os arcpy.env.workspace = r"C:\\GDBs\Delaware.gdb\Kent" fcs = arcpy.ListFeatureClasses() for fc in fcs: desc … Message File Name Line Position Traceback <module> <module1> 11 Rename C:\Program Files (x86)\ArcGIS\Desktop10.6\ArcPy\arcpy\management.py 4515 ExecuteError …
Mona Coder's user avatar