Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [arcpy]

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

1
vote
3answers
21 views

Not Able to Pass Where Clause in SearchCursor in ArcPy

Can you please take a look at this snippet and let me know why I am not able to properly pass the Where Clause ('"[NAME_1]" = Ohio') in SearchCursor? import arcpy from arcpy import env def ...
0
votes
1answer
17 views

Find and replace image path

I have multiple mxd's with many company logos as jpg's. We've moved the location of the logos from the F:\ drive to the C:\ drive. I have a script that is supposed to change the path, but not sure ...
3
votes
0answers
28 views

Is it possible to automate sewer service line creation?

I am a GIS Tech working for a utility company, part of the asset maintenance program entails running a camera down gravity mains (sewer pipes) from the upstream manhole to the downstream manhole. ...
0
votes
0answers
31 views

Converting Easting/Northing to National Grid

I'm working on an AddIn toolbar, the first button is a tool which will give you your XY and NGR when you click on the map. I have the XY section working as it is relatively simple: import arcpy ...
0
votes
1answer
26 views

ArcPy - Update empty field with calculated data

I have a current script that calculates how many wells are in each county. Now, how do I update (fill in) the COUNTIES shapefile attribute fields of 'Well_Count' and 'Density' import arcpy arcpy.env....
-1
votes
0answers
12 views

Learning ArcPy as a Beginner? [duplicate]

I'm a graduate student in Georgia Tech and I am learning arcpy with python 2.7 and pyscripter. I feel like there are not much examples that I can practice with during my study. Any recommendation ...
2
votes
1answer
48 views

Calculating wells by county and then updating county table with that data using ArcPy?

I have the following code to calculate the number of wells within a counties layer. Right now it is giving me a total number of wells. Where and how do I get it to loop through all the counties ...
0
votes
0answers
11 views

Not Able to Create New Feature Class From Selecting By Attribute

Can you please take a look at this demo and let me know why I am not able to create new feature class from a shapefile based on selecting by attribute and saving the new future in a Geodatabase? The ...
0
votes
1answer
22 views

How to implement a script?

I am currently having trouble implementing a script suggested for a question I previously posted Using arcpy.da.SearchCursor to script snapping one set of points to location of another set of points? ...
0
votes
1answer
33 views

Other users unable to use ArcGIS Python script tool in shared folder?

I created a new toolbox with a script tool that successfully works for me when I run it. I have it saved in a shared folder that my coworkers can access but when they try to run it, it doesn't work. ...
1
vote
1answer
24 views

Using select by attributes then calculate field on selection in ArcPy?

ArcGIS Pro 2.3 I want to create a standalone script which runs outside of ArcGIS Pro (for automation purposes), which selects features (with blank attributes) in a feature class and runs calculate ...
0
votes
1answer
16 views

Clipping Raster Object with Polygon Object in ArcPy?

I have about 400 rasters that I want to clip each of them based on a polygon object. The code I tried to use is the following: import arcpy, os origpath = ur'd:\test' jpgs = [f for f in os.listdir(...
1
vote
1answer
18 views

arcpy: Select layer by attribute with SWITCH_SELECTION seems not to work

I have a large feature classes, where a field named "gridcode" contains integers values from 6 to 17. I would like to get rid of features, where the gridcode = 6, 9 or 15. Therefore, I have created a ...
-1
votes
3answers
49 views

Using arcpy.da.SearchCursor to script snapping one set of points to location of another set of points? [on hold]

I am trying to shift a large number of point features (layer name Building_Point_NeedToSnap) to a newly created second set of point features (layer name BuildingFootprint_XYTablePoint) which is based ...
0
votes
1answer
32 views

Adding serial number text to Layout view using ArcPy?

I have 250 maps (in separate MXD's). In each map, in the Layout view there is "aaa" text. the element name value is aaa. I try to find a way to add serial numbers to each map, so each "aaa" text will ...
-3
votes
0answers
24 views

How do I break this Python script down by its elements? [duplicate]

I took a shot at breaking this down by element type but unsure how successful I was as I am a beginner. Please let me know what to correct and/or what I missed. import arcpy from arcpy import env ...
0
votes
1answer
37 views

UpdateCursor not updating when run from PyCharm?

I have a script in ArcPy that iterates through a set of intersection points and determines if all intersecting streets have the same attribute value in the CROSSLTS field, and if they do, sets the the ...
-1
votes
2answers
21 views

Arcpy UpdateCursor not Updating, but no Error Reported

Below is the code I'm using in an SDE GDB, on ArcMap 10.4.1: import arcpy # Variables inputAsbuilt = arcpy.GetParameterAsText(0) transmedia = inputAsbuilt + "\\Transmedia" structure = inputAsbuilt + ...
0
votes
1answer
25 views

How can I insert odd and even number in attribute table for selected feature in Arc Map?

I work with addressing, in right site of street must be inserted even number, and in left site of street must be inserted odd number in attribute table. Is there any code to insert odd and even number ...
-1
votes
0answers
21 views

CalculateField_management explanation in ArcPy?

I have two shapefiles s1 and s2. I want to do a join as seen below. (hope it's accurate) Then calculate a new field called lenew from s1 according to dac field from s2 Script: arcpy.env.workspace ...
1
vote
1answer
27 views

Making loop over shapefile attribute using ArcPy?

I have a polyline shapefile. The shapefile has a field called "NAME" I would like to make a loop over each line (A,B,C,D,...). This is the python code for only first line named "A" profileLine = ...
0
votes
0answers
43 views

How do I break down this Python script by element type? [closed]

Not 100% sure I broke this down correctly as I am a beginner. Please critique my labeling and let me know how badly I did as well as any labels I missed. I am working with the element labels that are ...
1
vote
0answers
18 views

Separating multiple overlapping polygons using ArcPy? [closed]

How do I separate multiple overlays in a polygon using arcpy, according to image? Each overlap must be a single polygon
0
votes
0answers
28 views

Configuring conda environment suitable for Python and ArcGIS Desktop gives UnsatistifiableError?

I want to set up a conda environment that is compatible with the Python 2.7 install that comes with ArcGIS Desktop 10.6.1. There are a number of tutorials online describing the how to do this. For ...
0
votes
0answers
26 views

Getting Invalid Destination Path in ArcPy using PyCharm? [closed]

I am trying to debug this error. I have read all the posts about this including: Debugging AttributeError: Invalid destination path from ArcPy? Which arguments are incorrect when running ArcGIS ...
0
votes
0answers
19 views

Storing densified line of profile graph as shapefile with ArcPy?

I know that in 3D Analyst option we can store the profile graph as a table and a shapefile. I would like to this with ArcPy. This is the script that I used for making a table.dbf : arcpy....
1
vote
0answers
21 views

Copy attributes from one attribute table to another

In ArcPy I've created a set of polygons, which I want to keep in my final map. I've created points at the centroids of these polygons and used 'extract values to points' to give them the value of the ...
0
votes
1answer
37 views

Understanding why list object has no attribute name?

I have this script which gives me an attribute error and points out line 8. The error says " 'list' object has no attribute 'name'" Not sure what went wrong. How do I fix this script to run? ...
-1
votes
0answers
33 views

Inheritance in ArcPy [closed]

I am new to scripting and I am trying to find a couple of examples of how the concept of inheritance has been applied in ArcPy. I am looking for something simple since my understanding is beginner ...
1
vote
1answer
32 views

Exporting only some feature classes to XML using ArcPy?

Is it possible to only export only some feature classes when exporting a workspace to an XML document? I know that when I am in ArcCatalog, I can right click my database --> Export XML Workspace ...
0
votes
1answer
18 views

Updating Map Layout Pathways in ArcPy for ArcGIS Pro?

I have a map which has two insets which looks like this: The first map frame is in the upper left and the second is all of the background. Using my exact same map layout as shown here I just want to ...
0
votes
2answers
33 views

Iterate through tables in a map document and replace workspace paths using Python 2.7 and ArcGIS 10.4.1

I am creating a script that walks through folders and scans for mxds. I use a set to get unique data sources and copy the data to a new folder keeping the same data format. I would then like to access ...
-1
votes
0answers
28 views

Python script throws errors when run from toolbox? [closed]

When on custom toolbox it throws errors often while in arcpy it works normally. Like: ERROR 000732: Input Features: Dataset ASTENOT_lines does not exist or is not supported If I close and open ...
0
votes
2answers
47 views

Weird cursor issue

Lets say I have a temp layer made out of selected items from another layer and I am trying to look through 2 attributes in that layer with searchCursor: union_test = "C:/Workspace/Sandbox/...
0
votes
0answers
14 views

ArcMap - make an add-in that will ask for a directory? [closed]

I have a script in python that runs in Arcpy. In this script there are variables for directories. I would like to make something that will take the directory of each user. Example: A user puts ...
1
vote
1answer
47 views

GPSQLExpression - python toolbox

I am relatively new to python and I am trying to build a tool within python toolbox with GPSQLExpression as parameter. I am having trouble with populating its field and value list. Below is part of ...
-1
votes
1answer
23 views

Removing layer from specific data frame using ArcPy gives IndexError?

I work on several maps- each map has different number of data frames (several maps had only 1 or 2 data frames). with this code i try to remove layer "frame" from the third data frame only. I want ...
1
vote
0answers
11 views

Iterating over set of feature classes and spatial join to create only one output? [closed]

I have a feature dataset with 50-some odd feature classes (polygon) that all have fields that I need to spatially join to one feature class (point). So in the end, I only want one object with all of ...
1
vote
1answer
19 views

Selecting a series of grouped layers within a specific extent [closed]

Is there a way to select grouped layers within a specific extent with ArcGIS 10.5? For example I have a constraint mapping, with various thematic layers grouped by interest. I would like to know ...
0
votes
0answers
23 views

Starting ArcMap Python Add-in as service?

Is it possible to start Python add-in as a service which keeps running while in ArcMap? I am designing something using a add-in to receive socket messages from out of ArcMap and do some operations ...
0
votes
0answers
33 views

Why is Append_Management failing on just 2 (out of 9) table columns?

In Arc 10.2 I have a script tool that uses arcpy.Append_management() to transfer .csv data into a freshly truncated feature class table. It works perfectly on all .csv tables except one in which it ...
0
votes
0answers
15 views

Running Script and Export

I created a script that will produce dynamic table from data that is pulled from an access database but when exporting to PDF no updates have been made. Running this script in Arcmap works fine. ...
0
votes
0answers
20 views

Getting attributes from JSON arcpy

I'm trying to get the first attribute element in the JSON list. This data is from the operational layer which I am able to parse through. However, I can't seem to get the attributes from the first ...
1
vote
1answer
33 views

Using SelectLayerByLocation and GetCount to Populate a new Field using Python

I'm attempting to create a script which assesses the intersect between a layer "BldgFootprints" and several polygons "FireBoxMap_1"-"FireBoxMap_44". And from this intersects performs a getCount on a ...
0
votes
0answers
29 views

Field Invalid in Script, Fine in Python Window

So I am trying to write a convenience script as part of a tool. All of the pieces work just fine separately, but when thrown together... not so much. The first sections take a user's input, does a ...
1
vote
1answer
23 views

Receiving ERROR 000732 from ArcPy that raster does not exist or isn't supported? [closed]

I am running this script to perform simple raster algebra on the pycharm interpretor... import arcpy arcpy.env.overwriteOutput = True from arcpy.sa import * # Specify the input raster inRaster = ...
0
votes
0answers
36 views

Feature class to gdb: tips for efficiency?

I am hoping to cut-down my script's run time. It is slowing down when executing arcpy.FeatureClassToGeodatabase_conversion(in_features, out_location): def creategdb(p, out, date, dic): print('...
1
vote
1answer
36 views

Sorting by shape token in ArcPy cursors?

I have a script that uses the sql orderby parameter to sort my arcpy cursors by a user defined field or fields and deletes duplicates, but keeps the duplicate with the highest value. I'd like to be ...
0
votes
1answer
45 views

Turn all fields on in layer properties using ArcPy?

I've been trying to turn all fields of a layer through properties fields I just need to turn them all on import arcpy from arcpy import env import sys import os mxd = arcpy.mapping.MapDocument("...
0
votes
0answers
24 views

Nomenclature grid for GK42 Pulkovo ArcGIS for Desktop

I'm stuck with this problem - I need to write a scripts preferably on ArcPy, that create grids with different scales using Pulkovo 1942 projection with nomenclature labels e.g. for 1:1kk - N-37 and ...