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
9 views

Addin to Style 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 ...
1
vote
1answer
91 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 ...
2
votes
1answer
112 views

What permissions needed to add an index with a protected version?

Using arcpy and ArcGIS 10.1 SP1 (Build 3143) against an Oracle 11g enterprise geodatabase, I am trying to add an index to an existing attribute in an existing feature class: arcpy.AddIndex_management(...
7
votes
3answers
2k views

Creating fishnet from template feature class using ArcPy?

I can’t use the tool arcpy.CreateFishnet_management because define the parameter “templateExtent” with a shapefile it is not filling automatically the parameters “originCoordinate” and “...
1
vote
1answer
26 views

Text element not updating in arcpy.mapping?

I am trying to get a text element to input an address using the below code. It seems that the code picks up the right elements, is finding the text elements I want to change but isn't able to actually ...
1
vote
1answer
38 views

Iterate a clip over multiple feature classes using Model Builder or ArcPy

I have multiple feature classes (buildings, airport, land, roads etc) that I would like to clip using a Local Authority boundary. I am trying to create a process in model builder or Arcpy that will ...
0
votes
2answers
66 views

Shift in raster in python 3.6

I have a python script for a color anomaly detection study. I am attempting to create two rasters each with three classes: one raster representing a "target" and the other representing "background", ...
0
votes
1answer
21 views

ArcGIS geoprocessing DomainToTable_Management script crashing

I needed to dump all of the domains in my file geodatabase so missing values can be identified. The script runs fine if the domain name has no spaces but, unfortunately this one has many multi-word ...
0
votes
1answer
215 views

Zonal statistics error in arcpy

I'm trying to get the zonal statistics output (mean), do some operations and add to my main archive the output value. I wrote this code, but it's not running, the error message is: Traceback (most ...
0
votes
2answers
43 views

arcpy Polyline.within(Polygon) return 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 ...
0
votes
0answers
6 views

Route Planning Tool for Runners When Given Start Point, End Point, and Distance [on hold]

My orgnization has ArcGIS Enterprise 10.6.1. I also have ArcGIS Pro 2.4.1 and ArcMap 10.5.1. I also have most extentions available such as Network Analyst and Spatial Analyst. I would like to ...
0
votes
1answer
53 views

Get list of editable fields while also adding 'SHAPE@' to the end [closed]

I need to get a list of field names that only includes editable fields and not the geometry field, but then add the geometry field back to the end of the list as SHAPE@ token. I have code that runs ...
1
vote
1answer
47 views

Raster Combining in batch using ArcPy?

I am trying to combine two different raster files using a loop, with the following script. import arcpy import os thectr = 0 ws = arcpy.env.workspace = r'D:\BRB Snow Cover\Sample\TerAqua' ...
1
vote
1answer
103 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 ...
0
votes
1answer
14 views

Arcpy UploadServiceDefinition ignores folders and groups

I am using Esri's guidance for arcpy.UploadServiceDefinition_server (http://desktop.arcgis.com/en/arcmap/10.6/tools/server-toolbox/upload-service-definition.htm) I can successfully upload a service ...
0
votes
0answers
24 views

ERROR 999999: Error executing function. Failed to execute (CADToGeodatabase).What is the issue? [on hold]

import arcpy try: arcpy.env.workspace = "D:\PROJECT DETAILS\Database_Onsite\New File Geodatabase.gdb" Database = arcpy.env.workspace Drawing_Cad_File = "D:\PROJECT DETAILS\Database_Onsite\...
2
votes
2answers
44 views

Drawing shapes like rectangle, polygons on fly using ArcPy in ArcGIS Pro?

I am trying to write a Python script that when imported into a toolbox can be used to draw user defined shapes on fly by clicking mouse points on the screen inside a GIS program. The motto of drawing ...
0
votes
1answer
19 views

Script that works in Python Toolbox not working in Standard Toolbox?

This script does not work in a Standard Toolbox but it works in a Python Toolbox. Do I need to delete all the parameters from the script? import arcpy, os, sys, shutil class Toolbox(object): ...
0
votes
1answer
33 views

Copying feature service to local geodatabase using ArcPy and ArcGIS API for Python?

I am trying to export/copy a feature service to a local geodatabase where I can work on it locally. I have provided the code below. I keep getting an "Object: Error in executing tool" for the last ...
0
votes
0answers
30 views

Using UpdateCursor in the same loop as SearchCursor

I have 2 layers, one with land plots and one with hazard zones. I want to iterate through the layer with land plots and for every plot I want to add 2 (or 3, depending on some variables) fields. Then ...
0
votes
0answers
13 views

Automation of tracing of line until point layer in ArcGIS Desktop? [on hold]

Problem- Water Distribution system Im doing tracing manual work in arcgis since a long time and want to automate it. Can you help me with any trick or python or VB script? Layers available one ...
0
votes
0answers
12 views

Missing area when using tabulate area in ArcPy?

I create a polygon layer including 80 buffer areas (they are not overlapping) and want to get the area of each value of a raster file for each buffer area. I can use the tabulate area to realize this ...
0
votes
0answers
15 views

Updating text elements not working when using APRX path vs “CURRENT”

I am beginner in ArcGIS Pro and I am trying to expand into using python with ArcGIS Pro. I have a working script that will update a specified text element in all layouts in ArcGIS Pro, in my case it's ...
2
votes
1answer
52 views

Getting parameters of Python Toolbox tool to appear in ArcGIS Pro?

I can't get the parameters of my tool to show up in ArcGIS Pro 2.1 Because of my work I can't put my exact code here, but I'll put the skeleton of what I'm doing and hopefully someone can see what I'...
0
votes
2answers
21 views

ArcPy: Select_Analysis Invalid Characters

The following script produces the ERROR 000210: Cannot create output... .shp and ERROR 000354: The name containts invalic characters Failed to execute (Select.). The line with arcpy.Select_analysis ...
0
votes
1answer
44 views

Projecting many raster files in folder and then putting them into ArcGIS Pro project using ArcPy?

I want to project many raster files in a folder (but they appear in the content of my ArcGIS project). Here is the screenshot. These raster files have an unknown coordinate system. When I try to ...
0
votes
1answer
44 views

Multiple selections with a python loop

I am very new to Python and have no idea about how to write a python loop to do selections for ArcGIS. I already finished writing selection codes with different conditions. Is there anyone helping me ...
-1
votes
2answers
67 views

Merge and save results after selections using loop

I want to merge shapefiles after selection inside a loop and then save results to excel files. However, the codes could save the last result to excel files and can not save each merge file. import ...
3
votes
2answers
3k views

Calling variables within ArcPy functions using Calculate Field tool?

I have a defined function (ex. def my_function(x,y)). def my_function(x,y): """algorithm""" my_variable = my_function(filex, filey) How can I call this variable within the code block section of ...
2
votes
1answer
382 views

Using MakeFeatureLayer in ArcPy?

I am trying to add a feature layer to my map document as the output from my python script. The goal is to limit the number of fields in the attribute table to a pre-defined list. I am able to add ...
0
votes
0answers
18 views

Snapping together lines within certain tolerance with ArcPy and Basic level license?

I have a GIS layer of bike lanes I created using an open-source GeoJSON which I converted to a shapefile using ArcPy. The end result looks pretty good, with one exception: there is some small gaps ...
0
votes
0answers
31 views

WindowsError: [Error 32]

I get a windows error when trying to run my tool again in the same arc project. It does run again once I shut down ArcMap and reopen and run the tool. Any Ideas? import arcpy, os, shutil, sys # ...
1
vote
1answer
28 views

Conversion of Landsat ToA reflectance to BoA reflectance with an equation

I am using temporal datasets from Landsat 5, 7 and 8. Since I have many datasets I would like to include the conversion from ToA(top of atmosphere) to BoA(bottom of atmosphere) reflectance into a ...
0
votes
1answer
30 views

Python batch script to delete Attributes

I currently have a script that will select and delete all the values less than 0.1 in a column. The script below works, however it specifies a specific .shp, I want to batch this so it runs through ...
1
vote
1answer
30 views

ArcPy: Create NDVI with Raster Calculation and Map Algebra

My target is to create NDVI Rasters but I'm stuck with python loops, since I'm new to that, so sorry for a maybe basic question. I have 2 folders, one with rasters (tif) with the red band, the other ...
1
vote
0answers
39 views

Writing more than 1000 rows with arcpy.da.InsertCursor? [on hold]

I have a GeoJSON which I'm able to successfully covert to a shapefile via the following process: using arcpy.asShape to find geometry, and inserting this geometry as new fields using cursor insertRow)....
0
votes
1answer
26 views

arcpy.SelectLayerByAttribute_management ExecuteError

This python code works in ArcGIS Pro but Not in ArcMap . I read some issues that mention a get around by making a feature layer. I tried that and I then get an error saying polytest doesn't exist. ...
0
votes
1answer
29 views

Importing ArcPy in PyCharm?

>>> import arcpy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "D:\Program Files (x86)\ArcGIS10.5\Desktop10.5\ArcPy\arcpy\__init__.py", line 22, ...
0
votes
0answers
20 views

Import Arcpy error [duplicate]

I am having an issue with importing arcpy. Initially I thought that it might be that the version of the Anaconda software that I had been running was 64 bit, therefore I changed it to 32 bit to try ...
0
votes
1answer
33 views

Arcpy SDE Connection Getting Invalid Path? [closed]

I literally copied and pasted the file path (r'C:\Users\myName\AppData\Roaming\ESRI\Desktop10.4\ArcCatalog\mydatabase.sde'), but after I run my script, I always get the error saying error 267, the ...
1
vote
0answers
12 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 ...
0
votes
1answer
125 views

ArcPy tool in toolbox crashes ArcGIS Pro

been writing a toolbox to speed up my work and I've run into a strange issue. My start well tool works fine, but my add surveys tool does not and causes ArcGIS Pro 2.1 to crash. I'll post the code ...
1
vote
1answer
57 views

Comparing a polygon layer within the boundary of a polygon

I'm pretty new to ArcPy and Python. In our database, we have a layer containing parcels (polygons) with a neighborhood code and a polygon layer that contains the neighborhood boundary. Within that ...
2
votes
0answers
38 views

Obtaining extents of each data-driven page using ArcPy?

I have a set of index polygons (rectangles) that vary in size and orientation on which data-driven pages are based. I am looking for a method that would give me extents Xmin, Xmax, Ymin, & Ymax ...
1
vote
1answer
110 views

QGIS plugin creation using ArcPy Model in ArcGIS

I have created a ModelBuilder in ArcGIS 10.3 and exported the Python file. Now I want to use that Python file in QGIS plugin. Can that be done?
1
vote
1answer
19 views

Adding multiple feature classes (everything within gdb) to a group layer in ArcGIS Pro - Python

I am currently trying to add all the feature classes contained within a gdb to a group layer in ArcGIS Pro via a script. I have however not managed to add more than one single feature class at a time. ...
1
vote
1answer
23 views

Setting default value for date columns with FeatureClassToNumPyArray in ArcGIS Pro?

I am reading a feature class into a pandas dataframe using: df = DataFrame( arcpy.da.FeatureClassToNumPyArray( in_table=feature_class, field_names=field_list, skip_nulls=...
3
votes
2answers
120 views

Removing values from shapefile with ArcPy?

I have a large shapefile with lots of duplicate records. However, each duplicate record has an accuracy rating. I want to remove all duplicate records with a lower accuracy rating. This would be ...
2
votes
0answers
22 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
0answers
28 views

Creating raster from grid algebra expression using point attribute values?

I have a point shapefile representing groundwater production wells with annual pumpage values distributed over a general area. I'd like to create a raster layer with each cell representing the ...