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
0
votes
0answers
10 views

arcpy.MakeFeatureLayer_management (no query) throws a fleeting “application has stopped working”

arcpy.MakeFeatureLayer_management(DRC_joinHZname, "temp_joinlayer") DRC_joinHZname is a perfectly respectable feature the application has worked 50 times before even after latest ArcGIS Pro update
0
votes
1answer
15 views

Get ArcGIS Pro Portal user

I'm trying to get the user I used to login to Portal in ArcGIS Pro, but I can't find how. Is it possible? I manage to fetch the Portal information using arcpy.GetPortalDescription() , but not the ...
0
votes
1answer
34 views

Converting Excel files into geodatabase with ArcPy?

I have several Excel files that contain several sheets. I need to convert these files into one table in gdb. I wrote script that convert the whole sheet in separate table. How can I export a range (f....
0
votes
1answer
24 views

Change path in Anaconda environment to point to ArcGIS Python interpreter on Windows?

I want to have an Anaconda environment that will use the Python interpreter installed with ArcGIS Pro. I am working in Windows. I have been using Anaconda Prompt to configure virtual environments, ...
0
votes
1answer
19 views

ApplySymbologyFromLayer on ArcGIS Pro not working?

I created a python tool on Pro with the following code, and manage to run it without any errors or warnings. However, I do not see any changes on my layer: workspace = "C:\whatever.gdb" arcpy.env....
0
votes
0answers
21 views

Can't send the string output (from a Python tool) to work as a input for a tool in a model (ArcGIS Pro)

I have a model that uses the Feature Class to Feature Class tool. It needs 3 inputs (Input layer, location and output name). My goal is that a user would choose a layer, the model would create a new ...
0
votes
0answers
16 views

Splitting large amount of features using arcpy [on hold]

We are publishing a geoprocessing service that will split a large amount of features in a file geodatabase. The script uses the arcpy.defense.SplitFeatures() method, a ResourceSrf layer or a user ...
1
vote
0answers
22 views

How to match name if layer name contain “\f” [on hold]

One of my layer name is "FullProbeWMS\fullprobewms[Heatmap] Trace Lines" Where I check if this layer is present or not by using below code. for lyr in arcpy.mapping.ListLayers(mxd): if lyr....
1
vote
2answers
19 views

Finding cell width of Raster using ArcPy with ArcGIS Pro?

I've been trying to find the cell size, or height/width/mean, of a cell by utilizing arcpy in the Python Window in ArcGIS Pro version 2.3.3., I run the following code: import arcpy env = arcpy.env ...
0
votes
1answer
24 views

Questions on Area and Perimeter with Python in ArcPro

I was given a file and asked to get an area and perimeter by utilizing the field calculator with python. To get the area I did the following: Area = !shape.area! To get that perimeter did ...
0
votes
2answers
22 views

Setting Symbology for a Feature Class

I'm trying to automate a map, and one of those tasks is to set a specific symbology for a feature class. I create the feature class of Subject and Comps in the code, then add it to the map, then when ...
0
votes
0answers
11 views

arcpy.CreateAddressLocator_geocoding raise ERROR 000046 too many reference data tables for this style

I have an error while trying to automatize the creation of an address locator. Any idea what can be wrong in my code below? I only use 1 data table as reference so why this error? I am using arcpy ...
-2
votes
1answer
27 views

Writing ArcGIS Python Script to calculate percentage of count from range of numbers? [on hold]

I have a field in my layer called ID which gives an unique ID to each polygon. ObjectID ID 1 100 2 101 3 102 This field can only be populated with numbers ...
0
votes
1answer
39 views

ArcMap closing when running ArcPy script?

In the below script the processed file will be added to the table of content in ArcGIS, since my data is too long it cause the program to be closed due to opening too many files, how I can run the ...
0
votes
1answer
26 views

Getting Run time error cannot open 'xxxx' from ArcPy?

I am trying to create a script to add values to a new field in a table based on the text values of another field in the same table. Here is my code: import os import arcpy from arcpy import env ...
0
votes
0answers
25 views

Changing custom parameter of WMS layer in ArcMap or ArcGIS Pro using ArcPy?

In a web mapping application developed with ArcGIS JavaScript API (3.29) I am utilizing a WMS service describing Radar data from https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r-t.cgi . This ...
0
votes
1answer
21 views

Simple UpdateCursor onto new field

I'm trying to use the updateCursor in ArcGIS Pro 2.4 to populate a new field in my table and can't get it to work. Situation is like this: I have a table with many fields. One of those fields is "...
0
votes
0answers
20 views

How do I uncheck a Toolbar button in ArcPy?

I have created a toolbar having 6 button to add/turn on different layers. I want to have a functionality in my toolbar buttons, by which it will enable the user to see which layer is being added/...
0
votes
1answer
19 views

Adding rasters to mosaic dataset from CSV list using ArcPy?

I have a CSV list containing paths to 800 TIFF files that I want to add to a mosaic dataset. So using the Add Rasters to Mosaic Dataset tool, I need to create a loop which changes the input_path ...
1
vote
1answer
37 views

Converting abbreviation street type names to full names using dictionary for Python script tool? [closed]

I have a data table with a column 'STREET_TYPE' which are street types (RD, LN, ST, AVE etc.). I want to make a custom tool in ArcMap's toolbox that will expand these abbreviations to their full names ...
0
votes
1answer
20 views

Setting raster symbology to standard deviations in ArcPy [on hold]

I have an ArcPy routine and I would like to set the symbology of a derived raster to standard deviations, so that I can then reclassify on that basis and convert to polygons. Is this possible? I ...
-1
votes
0answers
19 views

Automation of drawing adjacent triangles sharing same origin point using ArcGIS Desktop? [closed]

I'd like to come up with a script or ArcGIS model to automate the drawing of conjoining triangles coming out of a single X,Y origin point. I am looking to create broadcast antenna coverage polygons ...
0
votes
0answers
7 views

Inserting current filename into Layer Properties => Defintion Query [on hold]

I want my Layer Properties => Defintion Query to look like this: Table.Field like "name of opened mxd" Every time I open a new mxd with this layer added it will grab the active mxd file name and ...
1
vote
1answer
75 views

Inserting values with arcpy.da.InsertCursor()?

Building on Standalone Python script to split a polyline with a point layer, I don't think I am manipulating geometry objects correctly. I am splitting an original line, preserving all the ...
2
votes
1answer
20 views

Clipping two rasters with several polygon features - saving output rasters according to a field name in the polygon layer?

I am an Economists and I am new to GIS. I am using ArcGIS for desktop 10.6. I am trying to clip a raster with several polygon features - saving output rasters according to a field name in the polygon ...
0
votes
0answers
22 views

Undo button undoes last couple of edits instead of last one in ArcMap?

I've made an add-in in ArcPy, using add-in assistant, to update attributes of selected features. It has two buttons to populate either 'U' or 'D' as attribute. The Python code is: import arcpy ...
2
votes
1answer
29 views

Edit script of Python Script Tool using IDLE from ArcGIS Desktop opening three Python Shell windows?

IDLE does not open properly in my ArcGIS Desktop 10.6 (Win 10 64 bit). I set the Geoprocessing Editor with following C:\Python27\ArcGIS10.6\Lib\idlelib\idle.pyw When I right-click a script tool in ...
2
votes
1answer
15 views

Error getting raster symbology property

I get this error when I run my script: Traceback (most recent call last): File "", line 1, in AttributeError: 'Symbology' object has no attribute 'renderer' Script: p = arcpy.mp.ArcGISProject("...
-1
votes
0answers
31 views

Selecting Table Records (with subtypes) by Attribute using Python AddIn?

ESRI ArcGIS Desktop version 10.4.1, a file Geodatabase having Line feature Class "Trench" with two tables "T_DUCT" and "T_SUB_DUCT". Existing "python.esriaddin", creates subtype records of "Trench" ...
0
votes
0answers
20 views

Allocating features in ArcPy stand-alone vs as Tool?

I created an ArcPy stand-alone script which works just fine and has one function. The function returns a polygon shapefile; I call it twice with different parameters and then do a spatial location ...
1
vote
1answer
35 views

Python script tool with multivalue raster input not honouring raster path?

I am creating a custom Python script in ArcGIS that takes a rasters as a multivalue input and have run into a problem which I don't think is a duplicate (having scoured SE for many hours) My problem ...
0
votes
2answers
39 views

Deleting several features from shapefile using ArcPy? [closed]

I recently started working with ArcMap and Python. I try to delete several objects from my shapefile in ArcMap. I would like to select for example the line which are too close together. I don't want ...
0
votes
0answers
40 views

Determining if Raster and Polygon intersect using ArcPy?

I have a folder of rasters (.tif) and I want to determine which rasters intersect a polygon. The rasters are single band with a value of "1" while the rest of the extent has a no data value (coloured ...
0
votes
1answer
28 views

Specifying output location of iterated Intersect tool results using ArcPy?

I have created a code that iterates through a geodatabase, intersecting each feature with a road network. I am not sure how to make it so the intersected features are output into a new geodatabase. ...
0
votes
1answer
18 views

Attribute Error when trying to run a script with Zonal Statistics

When I run my script I get the following attribute error: Traceback (most recent call last): HouseGradeBasementElev.tbx#HouseGradeBasementElev.py", line 31, in <module> AttributeError: '...
1
vote
1answer
32 views

Executing Fill in ArcPy gives ERROR 999999?

I am having trouble using Fill in arcpy as part of a tool. It works fine as a script, but when I create a tool, it fails. To localize the problem I modified the Help stand-alone script associated with ...
0
votes
1answer
21 views

Exporting the attribute tables of rasters in ArcPy

Like the title suggests I have this script that worked once before to export the attribute tables of some rasters as CSV files. However when I run this script again, I get an error: Runtime error ...
3
votes
1answer
64 views

Defining fields to keep and deleting all other fields in feature class using ArcPy?

I am trying to write a script to read a feature class, list all fields and keep only specic ones. I.e. drop all remaining columns. I guess that pseudo code should be: allFields = create list of all ...
2
votes
2answers
43 views

Making New Feature Class with Midpoint of Line Feature using ArcGIS Desktop?

I have a problem with creating a new shapefile ( for Points) with a midpoints from Line shapefile. I cannot use FeatureVerticesTo Points_management because I only have access to Basic and Standard ...
1
vote
1answer
33 views

Labels not loading using Arcpy

Has anyone every had any issues with ArcGIS not loading the labels that are set via ArcPy? I've only inserted the code that labels two created layers that are made earlier in the script. # uses the ...
1
vote
0answers
44 views

Field Mappings control doesn't show the Add Input Field in the context menu of a Python Toolbox

I’m trying to build a Python Toolbox which uses a Field Mappings control (GPFieldMapping parameter). For some reason I don’t manage to get the same behaviour of the Field Mappings control as in the ...
1
vote
1answer
58 views

ArcPy reclassify with if statement and cell value

I have a workspace with NDVI rasters and another workspace with greyscale rasters. The rasters have the same name. I want to reclassify the NDVI raster while also using the greyscale values in a ...
-1
votes
0answers
15 views

Create route in ArcGIS based on varying endpoint [duplicate]

I have an OPTICAL FIBER CABLE (OFC) Network of an area along with whole city's road network. The OFC network is present in areas where the customers exist. I want to create a tool which can get create ...
0
votes
1answer
24 views

Export maps with different text using ArcPy

I am new in ArcPy. i want to export month wise map with different title using ArcPy. Maps are exporting correctly but the title remains "January 2018". I used the following code. What is wrong? ...
1
vote
1answer
59 views

Arcpy reclassify with function

I have two rasters, one with NDVI values, and one with greyscale values (=(red band + green band + blue band) / 3). The rasters have the same name. I need to reclassify them in arcpy with the ...
1
vote
0answers
16 views

Re-binning Datasets Using ArcPy? [closed]

I have two datasets that contain tree canopy mortality classifications for aerial photographs. These two datasets were completed about 10 years apart, and therefore have different classification ...
1
vote
2answers
52 views

Using sys.exit(0) in an ArcMap Script Tool?

I'm using a ArcMap script tool to test if a facility is on a list. If it's not on the list, I want to print a statement and exit the script. The script works just fine as a standalone script but it ...
0
votes
0answers
23 views

Showing progress of raster geoprocessing tools with ArcPy? [duplicate]

Background: I am doing DEM resampling for a pretty big raster (341020x341020 cells, ~ 10 GB file size, ~ 433 GB uncompressed size) with arcpy. My Python script (uses 64-bit Geoprocessing) has been ...
0
votes
0answers
34 views

Snap points to nearest polylines within buffer (fast)

This is a working version of snapping any point to nearest polyline within a buffer distance. But, this takes significantly longer as each time it copies the point to a different shape and snaps it. ...
0
votes
1answer
25 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 ...