Questions tagged [arcpy]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
48 views

arcpy Polyline.within(Polygon) returns False for all lines between pairs of Polygon vertices?

I'm trying to develop a function which will find the longest straight line length that can be drawn within any of the polygons in a feature class. (To keep things simple, I'm only including lines ...
2
votes
1answer
38 views

Exporting layout file from ArcGIS Pro project to *.pagx file using ArcPy?

I'm trying to implement a tool to import *.pagx files exported from ArcGIS Pro to a project, modify text elements and export the altered layouts back to the *.pagx files. It is pretty easy to export ...
0
votes
1answer
23 views

SetNull function problem

I am trying to calculate a sum for a set of raster but before I need to disregard No Data values (that are equal to -9999 for my rasters) by using SetNull function. It gives an error. What could be ...
0
votes
1answer
274 views

Arcpy InsertCursor.insertRow crashes ArcGIS after many (thousands) insertRow calls

I am looping over a quite large feature class (~5million records) While looping using a SearchCursor, I insert new geometries in a FileGeodatabase FeatureClass using arcpy.da.InsertCursor. The ...
1
vote
1answer
39 views

Re-running Calculate Field tool in ArcGIS Pro?

Calculated a field with a little ArcPy function yesterday and now I want to change it. Just realized that the function I defined, once run and the geoprocessing pane is closed, disappears. Is there a ...
0
votes
1answer
33 views

Defining variable for output location based on feature class attribute? [closed]

I'm pretty new to python. I have a feature class of points (Points_Layer) that covers the state and a feature class of municipal boundaries (Municipalities). My script is going to loop through each ...
1
vote
2answers
36 views

Taking substring of one field and using value to field calculate or update cursor another in ArcPy?

I have a field that has values such as DIMP 1234567 N. Eucla Ave/ W. Bonita Ave or DIMP Seg #1234567- Spinnaker Dr. Ventur or DIMP SEG 1234567 PYRITES AND ESMERALDA. I want to extract only the ...
2
votes
1answer
42 views

Raster processing “Tool is not licensed”

I have a piece of python code written that works fine on a small test area but when I blow up the size of the test area I get a "tool is not licensed" error. arcpy.CheckOutExtension("Spatial") ...
1
vote
1answer
47 views

Selecting Deficient Water Mains

ArcGIS Pro 2.4.0 - all extensions I have a dataset showing Water Mains (lines) for an area. I have been tasked with finding water mains that go from a given diameter to a smaller diameter, and back ...
0
votes
1answer
39 views

Creating new .lyr file and retain metadata using ArcPy?

I'm creating a Python Toolbox using ArcGIS 10.5 that ultimately creates a new feature class and .lyr file from the layers in a current .mxd table of contents. I need the new feature class and .lyr ...
2
votes
1answer
127 views

Accessing information about ArcSDE historical markers via arcpy or SQL?

I would like to be able to access the list of historical markers that is presented in the "Change Version" dialog in ArcMap - https://desktop.arcgis.com/en/arcmap/latest/manage-data/geodatabases/...
0
votes
0answers
37 views

ArcGIS Pro - Python Runtime Error at command prompt

I have been following the example of 'Update Real-Time Data with Python' on https://learn.arcgis.com/en/projects/update-real-time-data-with-python/ but get a runtime error when I run the example from ...
4
votes
4answers
2k views

Using Vector Ruggedness Measure (VRM) tool from ArcScripts at latest version of ArcGIS for Desktop?

I need to use the Vector ruggedness measure (VRM) tool available from http://arcscripts.esri.com/details.asp?dbid=15423. However, I am using ArcGIS 10.2 for Desktop and these tools are made for 9.0, 9....
3
votes
1answer
52 views

Storing points from multiple GDBs as object

I often download data that comes in 30 minutes to 1-hour windows and then have to compile that data manually into one feature class, from multiple GDBs. I am trying to iterate through the separate ...
0
votes
1answer
58 views

ArcPy script causes Python crash when run outside of ArcGIS Python window

I have a Python script that will successfully complete when run from the Python window in ArcMap or ArcCatalog, however, when I run as a standalone it will cause python.exe stopped working crash once ...
1
vote
1answer
120 views

Programmatically rematch unmatched addresses using a different composite locator

I have a table of about 1500 addresses that updates and geocodes nightly using task scheduler and a couple of python scripts. The majority of these addresses are in the county for which I work. We ...
-1
votes
0answers
27 views

Using Python Addin to apply Style to Legend?

I created an arcpy script to apply a style to my legend from my style template and it works when using the module within arcmap. But i want to add it as an addin button. import arcpy import Python ...
0
votes
1answer
39 views

Modelbuilder not recognizing table output and throws Error 000732

I am building a tool in ArcGIS Pro Modelbuilder (Pro version 2.2.1) that includes making a drop down list for user input based on the information contained in a domain of a feature class. The three ...
0
votes
1answer
442 views

Script giving error accessing field name?

In the code below, the line 'alias = dict[fld.name]' always throws an exception. I don't see why; printing out fld.name works just fine. Also, the exception message is the field name printing ...
0
votes
0answers
19 views

Changing data source on all layer files in folder using ArcPy?

I have a folder of .lyr files and I want to change the source on all of them from one file geodatabase to a different file geodatabase. Feature dataset and feature class names will remain the same in ...
0
votes
1answer
524 views

Getting data source of Feature Layer object in Python script tool?

I am writing a script tool to update some records. I am wanting to use a feature layer as input, to maintain definition queries, selections, etc. I would like to get the data source of the input ...
2
votes
1answer
630 views

Using List field function for Python script tool?

I am trying to write a simple script for a toolbox, similar to the Addfield_datamanagement toolbox. The script adds a new field to a table of a feature class or a shapefile with attribute tables. So ...
4
votes
1answer
993 views

Select and copy attributes features in ArcMap using Python add-in tool?

I'm trying to add a tool to an add-in toolbar to select features from an existing feature class and copy attributes to another feature class, from point to point. TopoHeight_Field_Name='Comment' def ...
0
votes
0answers
32 views

ERROR 000732 using Con in loop?

I've got this process I'm trying to automate that essentially iterates across a set of rasters, runs a con statement on them to put values from a separate raster wherever the first raster has certain ...
0
votes
0answers
15 views

Listing all domains and their coded values into table via ArcPy?

I am new to Python. I'm trying to gather a list of all of our Domains (we have a lot) and their coded values and export them into a table or a format that can easily be put into a table. I've had luck ...
0
votes
1answer
46 views

Apply symbology based on an algorithm (ArcGIS)

Been battling this problem for a long time now, so hoping someone here can shed light on a possible solution. The problem is that I have 100 points and I want to apply a color palette to the points so ...
2
votes
2answers
140 views

Converting multiple CSVs to shapefiles?

I have a script that I've used to import information in a CSV to a shapefile. What I'd like to do is make it so that this script will run on all CSVs in a specific folder location, creating multiple ...
1
vote
1answer
40 views

Creating an SQL expression and writing/reading it to/from a file

I'm working on a way to take the number for projects that are marked as active in a spreadsheet and put that into a SQL expression that I can use to select from. So far I've got this dirname = os....
5
votes
4answers
872 views

Python toolbox tool objects do not remember instance variables between function calls?

I am developing a Python toolbox, and came across a peculiar behavior: The tool objects does not remember any instance variables between function calls. Consider this code: import arcpy class ...
1
vote
1answer
67 views

Optimizing slow multi cursor approach?

I designed a workflow, that although functional, is very slow and prone to errors. I am sure there is a better approach, but I cannot wrap my head around it. The environment is ArcGIS arcpy (Python 3),...
3
votes
1answer
62 views

Identify layers in an .mxd that are network elements feature types

I need to create new feature classes from all layers in an .mxd, and also create a new .lyr file for each of the newly created feature classes that retains the symbology of the original map layer. The ...
0
votes
0answers
26 views

SelectLayerByAttribute_management not selecting anything

I've read through most of the other similar questions and nothing so far has addressed my issue; most are about syntax. I'm trying to select by attribute from a Feature Layer. But every time, Arc ...
1
vote
3answers
87 views

Copying exact field properties to new layer using ArcPy?

I fear I am missing something fundamental. I can get a list of fields from one layer using ListFields, and look at the properties: fields = arcpy.ListFields(feature_class) # Iterate through the ...
1
vote
3answers
139 views

Going back in for loop at the end of a while loop in ArcPy?

I'm quite novice in Python and ArcPy. I have a river network with Strahler orders (starting from 1). I want to create a new network where the new streams will start from order 1 till the outlet. (so, ...
0
votes
1answer
63 views

Grouping wildfires dates by season and getting sum and count using ArcPy?

I am having some trouble creating a new shapefile and CSV to group wildfires into seasons. What I want to do is to group the wildfires by meteorological season (summer, fall, winter and spring) for ...
1
vote
2answers
33 views

SelectLayerByAttribute_management selects all of type of attribute instead of specific one?

I want to create a tool that allows a user to select all the points within a specific zip code by inputting that zip code. The code below selects ALL of the points with a zip code - which is all of ...
0
votes
1answer
57 views

Looping through two raster folders to perform raster calculation gives ERROR 999998?

Last week I asked Looping through two raster folders to perform raster calculation? about a script to loop through two geodatabases and perform a raster calculation by matching the two rasters up ...
1
vote
2answers
56 views

Using Update Cursor within Search Cursor with ArcGIS Pro?

I am new to using ArcPy/Python and I'm running into problems with a script I'm trying to write. I'm using IDLE Python 3.6.8 ArcGIS Pro 2.4.0 Here is what I'm trying to do - I have 2 feature classes: ...
13
votes
5answers
13k views

Setting up PyCharm to reference ArcPy?

How would I setup PyCharm to recognize import arcpy? I'd like to use PyCharm to develop and debug geoprocessing tool.
1
vote
1answer
20 views

Using two Python Addin Combo Boxes to choose Folder then Layer

I am trying to create a Python add-in for ArcMap for users to quickly select layer files from within several different folders. This will require 2 combo boxes. User selects the folder from the first ...
2
votes
0answers
23 views

Selecting annotation by color to correct Annotation Class using ArcPy?

I have some municipal data that was converted into a GIS and all of the address numbers were coded as dimensions in the annotation feature class. There is an annotation class for address, but none of ...
1
vote
1answer
33 views

Looping through two raster folders to perform raster calculation gives ERROR 000732?

Last week I asked Looping through two raster folders to perform raster calculation? about a script to loop through two geodatabases and perform a raster calculation by matching the two rasters up ...
1
vote
1answer
44 views

Looping through two raster folders to perform raster calculation?

I have two geodatabases with rasters containing information about "treecover" and "loss". The file names are slightly different but can be matched based on the last 8 characters (the coordinates of ...
0
votes
0answers
27 views

From SQL database to pandas dataframe to numpy array to ESRI Table

End goal: Join data pulled from a SQL database to three different feature classes in a ESRI geodatabase. Efforts: Using PYODBC, I've connected to the database and dumped the data into a Pandas ...
0
votes
1answer
48 views

Calculating Area solar radiation gives ERROR 000732: output raster considered as Input?

I am trying to calculate Area solar radiation for rasters in a list. It seems that the tool allows to create unique rasters for direct, diffuse and direct radiation duration, and calculates ...
0
votes
1answer
26 views

Deleting Picture Element using ArcPy in ArcGIS 10.3 Desktop?

I'm trying to delete a Picture Element from 45 MXDs. This code is a start for me: import arcpy from arcpy import env env.workspace = r"G:\PROJECTS\landuse\gis" for mxdname in arcpy.ListFiles("*.mxd")...
0
votes
0answers
36 views

Downloading ArcGIS Online Feature Service to local Geodatabase using ArcPy? [duplicate]

I want to grab some feature services from ArcGIS Hub and put them on a GDB on my local PC. Here's the code that I've got so far: import arcpy # Set project directory proj_dir = 'C:\\Users\\rhard2\\...
1
vote
1answer
37 views

Subsetting single raster from raster list using ArcPy?

I have a list of rasters, created by arcpy using ListRasters. Rasters are stored in a geodatabase. How can I subset only one raster of the raster list? The goal is to make a new list, but containing ...
2
votes
1answer
57 views

drop list from field to execute SQL request

I'm trying to create a python script that allows a selection attribute based on the name of a field in the attribute table of a layer. I would like to configure my script such a way that permits the ...
0
votes
4answers
935 views

Creating layers for each attribute value via Arcpy script

I'm having some trouble starting this script. Not sure how to start, as I have to create/output layers for each attribute value from a certain column named that has integers. They are all unique ...