Questions tagged [arcpy]

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

714 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
1answer
96 views

Error when clipping multiple rasters

I am trying to clip about 36 rasters by a polygon. However, I am running into an error. It isn't a coding problem with the loop because I receive the same error when I run the function on a single ...
1
vote
1answer
223 views

Getting ERROR 999999 when trying to use arcpy.UploadServiceDefinition_server()?

Here is my code def upload(name, client, working_dir): arcpy.env.overwriteOutput = True arcpy.SignInToPortal('https://www.arcgis.com', username, password) outdir = working_dir + "\\PROJECTS\\" +...
1
vote
0answers
85 views

Changing “Stretch Type” of list of rasters to “Histogram Equalize” with ArcPy?

Goal: To modify a list of rasters using the histogram-equalize stretch-type What is the appropriate tool to use to change the stretch type of a list of rasters to histogram equalize with arcpy? ...
1
vote
0answers
128 views

Using Pivot Table in ArcPy?

I’m using a Python script to reproduce the Pivot tool in ArcGIS and when I run the script the output comes with many duplicates and this is an intended feature of the pivot tool. Nonetheless, I’m ...
1
vote
0answers
20 views

Creating domains from specific values in table using ArcPy?

I have an .sde table that I'm trying to extract specific values from and create domains with them. The problem I'm running into is that there are multiple duplicate values in the table (which is fine, ...
1
vote
1answer
38 views

Unable to Update Map Element

I'm trying to update my text elements, but after running script no changes occur and no error are triggered. Running suggested code triggered an error. I need to update my title and date text box. I ...
1
vote
0answers
155 views

ERROR 00735: Layer Name or Table View: Value is required Failed to execute

Im trying to create a script that will created two buffer shapefiles using SelectLayerByAttribute, but same error keeps popping up. This tool runs fine in Modelbuilder, but I want to create a script ...
1
vote
1answer
114 views

ExecuteError: ERROR 000539 while running expression rcexec()

from arcpy import * arcpy.CheckOutExtension('Spatial') arcpy.env.workspace=r'D:\work\USA' #pathway to all rasters in workspace directory rasters = arcpy.ListRasters('*.tif') # Local variables: ...
1
vote
0answers
76 views

Execution Error in Python when calling Clip tool

I have written a simple code in python for clipping. The code is : #Step 1 To clip the Study area import arcpy import os import sys from arcpy import env from arcpy....
1
vote
0answers
49 views

batch georeference based on link file, output raster too big and in wrong place

I have a set of images that I need to georeference. All images have the exact same geographical coverage. I have used the georeferenceing tool bar to create a link file. I then used the script ...
1
vote
0answers
64 views

Different outputs from Clip_management and ExtractByMask

I have a question about clipping a part from a raster according to the extent of a polygon. Should Clip_management and ExtractByMask create the same results if I set the "NO_MAINTAIN_EXTENT" option ...
1
vote
0answers
51 views

Copying/Inserting features AND user-defined Attributes as input to existing feature class in SDE using ArcPy?

import os, arcpy, zipfile, glob # INPUT ZIP FILE infile = arcpy.GetParameterAsText(0) path = "D:\Database_Connections" NAME = arcpy.GetParameterAsText(1) CODE = arcpy.GetParameterAsText(2) SOURCE = ...
1
vote
0answers
29 views

Comparing field definitions in Access DB to GDB using ArcPy?

New to the GIS world, but have a little background with Python. I'm attempting to compare an Access DB to a GDB and update the GDB for specific fields if there is a difference. I've read multiple ...
1
vote
0answers
258 views

Stopping arcpy for loop in cases where outputs match wildcard and get fed back to for loop list

Using a list of the feature classes matching a wildcard, I loop through 12 feature classes with a dataset. For each feature class, I make second list of all unique values within the REGION field, and ...
1
vote
1answer
105 views

How to bring over only 2 fields from the join feature class when using “SpatialJoin_analysis” and set up a merge rule?

I'm trying to understand how to use FieldMap and FieldMappings. I know very little about objects plus I'm finding the explanations on ESRI website not very good and far from comprehensive. All I'm ...
1
vote
0answers
77 views

Cost Distance Path ArcPy Code Failure: Error 000865

I am attempting to run a cost distance analysis where my list of source points (roughly 100 points) corresponds to the same number of destination points. Instead of running the cost distance analysis ...
1
vote
0answers
107 views

UploadServiceDefinition_server to ArcGIS Server not working on IIS

I want to write a web using MVC that uploads a .sd file to my ArcGIS Server using Python (arcpy). In my controller I have: public string upload_sd() { ProcessStartInfo start = ...
1
vote
0answers
54 views

Maintaining point data attributes when creating polylines?

I created a model in ModelBuilder to take a set GPS coordinates (containing latitude, longitude, timestamp, user_id) from different users, create a polyline feature class, and then split the polyline ...
1
vote
0answers
132 views

Looping through data to perform one to many join in ArcPy?

I want to join the attribute tables of two feature classes in ArcGIS and populate the fields from one table to another. This is a one to many join and there are duplicate rows of data in the join ...
1
vote
0answers
110 views

Creating new ArcSDE version with ArcPy?

The following script creates a new version in SDE but generates the following error below. Am I missing an environment? # Name: SDE_CreateVersion # Description: Creates a new SDE version # Import ...
1
vote
0answers
51 views

CreateFeatureclass_management Not Displaying in Map - Null Geometry

I have two feature classes that share a common ID field. I wrote a script to create a new feature class that contains the records in the first FC that are not in the second FC. It works, in that it ...
1
vote
0answers
38 views

Pyscripter crashes with EOFError timed out

I am not sure whether someone ran into similar problem. I've been using PyScripter with Arcpy for the past two years and I have been happy with it most of the time. Yesterday I ran into a kind of ...
1
vote
0answers
91 views

Assign Values to Breaks in Graduated Colors Symbology - ArcGIS Pro

In ArcMap you could assign values to each break within a layer's graduated color symbology using classBreakValues and classBreakLabels (A code sample of this can be seen on this page http://desktop....
1
vote
0answers
34 views

ApplySymbologyFromLayer not including all values in my domain

I am using a combination of ArcMap and ArcPy to stage data for sharing as a hosted Feature Service on AGOL. The data will be used in a data-driven pages type of way, where each feature will be ...
1
vote
0answers
53 views

Converting CAD Annotation to geodatabase feature class using ArcPy?

Is there a way to list through DWG and pick out let's say only the annotations and feed them into a geoprocessing tool? Similar to below in a feature class... for ds in datasets: #Finds ...
1
vote
0answers
57 views

ArcPy Editor commits in batches of a thousand records dropping some records

I am copying data from one database to another using arcpy cursors. This is an Oracle enterprise geodatabase against a versioned dataset. Using Python 2.7 and ArcGIS 10.1. The following code has ...
1
vote
0answers
159 views

Error “StopIteration: iteration not started” when updating row

I get the following error when trying to update the row on a for loop where I have assigned values to the row's attributes: Traceback (most recent call last): File "D:\ArcGIS_Pro_Projects\...
1
vote
0answers
38 views

Generate near tables from one layer to all in mxd

I am looking to create a script where user can choose a layer, then find all the layers within a set distance of it. I have set up a script to iterate through the mxd but I keep getting an error for ...
1
vote
1answer
90 views

Establishing attribute order in table using ArcPy with ArcGIS Pro?

I have the following piece of code hoping to have a table with a set of fields on a specific order: #Removing the fields we do NOT want to show in the output arcpy.MakeFeatureLayer_management(...
1
vote
0answers
80 views

Force network analyst route to follow a certain pattern

I'm using ArcGis 10.4.1 and network analyst. I'm trying to force, network analyst route to follow a certain pattern. I've tried editing network attributes in network dataset properties and changing ...
1
vote
0answers
210 views

Error running ArcHydro tools - can't set locations or arguments correctly?

I am working on trying to do some batch watershed processing. I have watersheds created using ArcHydro, and was trying to run the Longest Flow Path tool in a batch method, on different feature ...
1
vote
0answers
283 views

Python uses arcpy.FeatureSet() with map service, but won't publish as a geoprocessing service?

I have a Python script that consumes a map service (with geometry) and puts it in a FeatureSet. (Ref. the code from this question or this question.) for layer in layer_list: # generate gkey_query ...
1
vote
0answers
69 views

ArcPy .csv to Shapefile Conversion Errors

I have scripted a series 10 files that are run daily in order to generate an interpolation of data. However, I periodically have encountered errors where not all of the .csv data is being translated ...
1
vote
0answers
87 views

Iterate a multistep Map Algebra

I am trying to write my first ArcPy script to iterate a Band Math process with requires a few steps. The uniterated, working script for a single group of bands in one Landsat scene is: #import ...
1
vote
0answers
95 views

Removing GP History xslt

I am trying to run this script to remove GP History from our SDE geodatabase but I receive the following error: Runtime error Traceback (most recent call last): File "", line 39, in File ""...
1
vote
0answers
29 views

How can I add a raster (that is in a geodatabase) to map?

I know how to add a feature class to map in ArcGIS Pro using arcpy: arcpy.MakeFeatureLayer_management(fc_output, 'fl_output') layer = r'D:\ArcGIS_Pro_Projects\Optimity_Alf\Temp\fl.lyrx' arcpy....
1
vote
0answers
216 views

Joining csv table and shapefile via ArcPy?

I want to join the attribute table of a shapefile with an externally created csv table via ArcPy. The format of the columns are: for attribute table: "Variable1" "Variable2" "Variable3" "CATCHID" ...
1
vote
0answers
210 views

Make Query Table error: “The value is not a Raster Layer”?

I'm pretty new in coding and I'm struggling with my MakeQueryTable_managment tool using arcpy. I'm trying to do a query Layer based on a Layer and a table I have both in my gdb. I keep getting this ...
1
vote
0answers
33 views

Explain attribute selection for arcpy.SpatialJoin_analysis

I have exported a ModelBuilder model to python script, but it is failing. I suspect it is the attribute selection that is the problem. This model does a series of Spatial Join tasks one after the ...
1
vote
0answers
181 views

Batch processing Cell Statistics in ArcGIS using Python - ERROR 000864

The Below script is designed to take all raster (.txt ascii rasters) in a specified folder, add them to a list with the file paths, use the file paths stored in the list in the cell statistics tool to ...
1
vote
0answers
124 views

Update Labels Arcpy

I used UpdateLayer(df, update_layer, source_layer, ) function to update my maps to a given standard set of .lyrs I saved in a separate folder. Is there a way to do this with labels as well? Here is ...
1
vote
0answers
62 views

pyqgis Python API work together with arcpy Python API in the same standalone script

I create a simple bat file to create standalone scripts using pyqgis. and that bat work nice . I follow this manual now I want to use and arcpy together in the some script but I don't know how to ...
1
vote
0answers
136 views

Intersect error 000732

I'm trying to do intersect with 2 shapes, but it's not working because it can't read my shapefiles... I don't know why, because when i ran it with my other script, it works perfectly! Traceback (...
1
vote
0answers
52 views

ERROR 000732 - Get raster property

The following code subtract the minimum value of the raster from each cell value. Is there something wrong in it? This error comes with it every time that i run... Traceback (most recent call last)...
1
vote
0answers
38 views

Working with year before 1900 and ArcGIS Space-Time Cube?

I am trying to create a space time cube for 10 years from 1870-1880, but I get this Error: ValueError: year=1873 is before 1900; the datetime strftime() methods require year >= 1900 I tried to ...
1
vote
0answers
121 views

Python Window errors showing when opening up Commands tab in Customize related to Python Add-In?

I'm getting a number of errors in the Python Window on ArcGIS 10.3.1 when going to Customize > Customize Mode... > (Commands Tab) as seen below. The majority of errors are coming from a Python Add-in:...
1
vote
0answers
37 views

ZonalStatistics crashing in python randomly?

I am running Arc 10.5 on Windows 10 and am having issues with the Spatial Analyst tool ZonalStatisticsAsTable that appears to crash my python script for no reason. I have used this script before and ...
1
vote
0answers
56 views

Saving focal statistics in memory using ArcPy?

I'm currently working on a project where I have written a script that is suppose to do several things. one of these is creating a "quick" focal statistics, from which I extract the values to some ...
1
vote
0answers
55 views

Working with python add-in while editing is on

I created a python add-in which makes analyses like spatial join, update cursor and make feature layer. But when editing is open for a layer. I get this error. Line 289, in onClick for rec in ...
1
vote
0answers
149 views

Zoom to group layer using ArcPy

I have a group layer that I have populated with a collection of feature layers. When I right-click on the group layer and select "Zoom to Layer" the view zooms so that I can see the full extents of ...