Questions tagged [arcpy]

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

1,051 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6 votes
1 answer
175 views

Searching multiple geodatabases for feature classes and merging the results

I've got some Sea Level Rise data from NOAA (https://coast.noaa.gov/slrdata/) stored in 66 different geodatabases. Each geodatabase represents a state or district and contains a set of feature classes ...
6 votes
1 answer
1k 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 ...
5 votes
0 answers
167 views

Set default values when value is added to value table in Python Toolbox tool

Similar to Set default values for value table in Python Toolbox tool, I'm trying to populate a value table with default values. However for the linked question the value table is populated once an ...
5 votes
0 answers
194 views

Check for mxd write access with python addin

I'm looking for a way to check for writing access to an mxd upon the initiation of a python AddIn tool. My tool should only be enabled if the user has writing access to the mxd. I thought there was a ...
4 votes
0 answers
427 views

Using ArcGIS workspace defined as version in ArcPy?

I am trying to define my workspace as the current version that I am connected to. The Python tool that I am running utilizes the arcpy.da.Editor() function, and I used a workspace variable that is ...
4 votes
1 answer
252 views

Capturing ArcMap Drawing Errors inside of Python script

Is there any way to capture ArcMap Drawing Errors inside of a Python script? Through Python, I would like to iterate through each layer inside of an MXD, make the layer visible, refresh the table of ...
3 votes
0 answers
142 views

Why does arcpy.da.Walk work differently when used with file geodatabase (gdb) and personal geodatabase (mdb)?

Why does arcpy.da.Walk give different output with identical File (GDB) and Personal (MDB) Geodatabases? Example: I am using ArcMap 10.4.1 r'D:\SCRipt\New.mdb' is a copy of r'D:\SCRipt\New.gdb' db =...
3 votes
0 answers
188 views

Refreshing Enterprise geodatabase layers using Python in ArcGIS Pro

Environment: ArcGIS Pro 2.8 with SQL Server Enterprise Geodatabase Background: I'm working with ArcPy, and I've written a script tool that performs a few attribute edits. It does the edits to a ...
3 votes
0 answers
48 views

ArcPy raster Reclassify not covering all cells in raster

I am trying to use Reclassify on 240 rasters using ArcPy within the Python window in ArcMap 10.7. My original raster has continuous decimal probabilities ranging from 0 to 1, and my goal is to change ...
  • 498
3 votes
0 answers
228 views

ListDatasets() returning empty array on sde workspace

I am trying to get list of datasets within sde connection.This sde connection is already present in ArcMap and all datasets are visible. I am posting snapshot my code. It is returning empty array,...
  • 65
3 votes
0 answers
122 views

Making ArcGIS Python Add-In Extension immediately functional after install?

I have a Python add-in that includes an extension class. The only purpose of this extension is for some buttons in the add-in to be automatically enabled/disabled depending on if there are relevant ...
3 votes
0 answers
407 views

Using RemapRange for Reclassify in ArcPy gives ERRORS 000622 and 000628?

I am trying to reclassify a raster, "Conifer_Focl", which lives in inputData.gdb. The max value for "Conifer_Focl" is 33.217064. I'm looking to reclassify as: I am following the instructions from ...
  • 688
3 votes
0 answers
233 views

Adding layer with ArcObjects from Python script tool?

I would like to load an AFR file into a data frame in a currently open MXD and the IMap.AddLayer function is not working as expected if the data frame in which to load the AFR file is activate. And I ...
  • 89
3 votes
0 answers
134 views

Applying Symbology to layer through ArcPy script and values are getting changed?

I am doing a raster calculation over a hdf file and after that i have to apply symbology on it.When i am applying Symbology to the raster layer through script .its values get changed as compared to ...
  • 489
3 votes
0 answers
480 views

ArcGIS pythonaddins.ProgressDialog inconsistent progress bar drawing

I am trying to use pythonaddins.ProgressDialog in a Python add-in. I am on ArcGIS 10.4. I will need to perform several steps that will take some time. To show how much work is done, I plan to use a ...
3 votes
0 answers
622 views

arcgisscripting.ExecuteError: ERROR 001270: Consolidating the data failed

I am working on PuTTY and trying to create service definition file in server. My Python script is creating .sddraft but I am receiving 'Consolidating the data failed' error when I run stage service ...
  • 573
3 votes
0 answers
519 views

Import processing module from QGIS into Python Window of ArcCatalog

It is possible to import processing module from QGIS and run it in Python Window of ArcCatalog? I tried in QGIS import sys output = sys.path and copy output to ArcGIS Python console: import sys ...
  • 1,531
3 votes
0 answers
1k views

arcpy.Delete_management does not delete the directory

I got a problem with Delete_management when I use the FeatureclassToCoverage_conversion function. I don't know why in the gdb I use (arcpy.env.scratchGDB), while the Delete_management is working, the ...
  • 31
3 votes
0 answers
3k views

How to edit a service definition file (SD) so as to change the Data source (User in oracle)

I am using Oracle 11g ArcGIS 10.2 Considering I have an enterprise geodatabase and I am connected as user1/mypass@myIP/xe I create a map from my table "mylocations" I choose share as service-->...
  • 786
3 votes
0 answers
2k views

Get Unique Field Values Within Python Script Tool

Using ArcGIS 10.2.2 and Python. I have a script that currently counts the number of points (representing crimes) in each zip code area, and writes that value to a new column in the FC that contains ...
  • 782
3 votes
0 answers
469 views

How to extract NetCDF raster values to time enabled shapefiles?

Does anyone know a good way to extract NetCDF raster values to each data point from a time enabled shapefile at the correct time? I have tried using a python script tool and a loop that steps ...
  • 33
3 votes
0 answers
481 views

Different results from Spatial Analyst GP Tool and Python

I am writing a script that has to subtract one raster from another. The rasters I have represent 1) Parking Lots (1 = Parking Lot, 0 = not Parking Lot) and 2) a buffer around the Parking Lot (1 = ...
  • 4,159
3 votes
1 answer
217 views

Python upload to service fails in FME but works in ArcGIS

I have added a shutdown Python script to my FME workbench to publish the TIFFs written as a service. import fme import arcpy AGSconnection = "W:\\Entity\\ABZ\\myfolderpath\\gbepabz-file.name.ags&...
  • 1,876
3 votes
1 answer
948 views

Adding feature class and applying symbology in ArcGIS Pro using ArcPy?

Using an ArcPy script run from a toolbox, I want to import a feature class from a geodatabase into an ArcGIS Pro 2.1.2 map and then symbolise that layer based on a lyrx file stored on disk. Here is a ...
  • 121
2 votes
0 answers
25 views

ArcPy producing wrong slope map using Spatial Analyst with ArcMap

I wrote a Python script which is supposed to produce a slope map with 6 classes each one being from 0-3.99, 4-9.99, 10-15.99, 16-30.99, 31-60.99, 61+ (Although for testing purposes the max is 789.54). ...
  • 45
2 votes
1 answer
31 views

List Feature Classes and use Update Cursor to calculate date values

The basic premise is as follows: look in a folder and find all feature classes (within file GDBs), use a for loop to isolate feature classes one at a time and subsequently isolate date attributes, ...
  • 71
2 votes
0 answers
65 views

Compare two fields in different feature classes using ArcPy

I am trying to make an automation script to evaluate the distance and compare attributes between an incoming layer and another existing layer in the database. I made this script to say: If the ...
2 votes
0 answers
36 views

SelectLayerByAttribute in ArcPy creating copy of layer

I'm trying to use the SelectByAttribute_management tool in ArcPy using : import arcpy arcpy.management.SelectLayerByAttribute("Name_Layer",'NEW_SELECTION') When I write it in the console, ...
  • 21
2 votes
0 answers
28 views

Identify objectID of multiline to connect them in ArcPy

I have two sheets; in each there is a road network, but drawn by different people. Now I want to connect those lines that are intersected by the index sheets as I shown below, but what I found is some ...
2 votes
2 answers
160 views

Compare tables in two different geodatabases

I have two geodatabases, one with February data (Final_Project_2.gdb) which contains 6 feature classes. The second geodatabase has March data, (Clipped.gdb), which also contains 6 feature classes, the ...
  • 21
2 votes
0 answers
20 views

Extract Values to Table: wrong number of pixels

Using ArcGIS Pro and arcpy I am iterating through a shapefile using a SearchCursor to extract the pixel values of a raster for each polygon in the shapefile using the Extract Values to Table (...
  • 21
2 votes
0 answers
124 views

Download data from Portal using ArcPy

I am trying to download a hosted layer from our portal and save to a file geodatabase. Following Using ArcPy to copy a portal feature service to a fgdb feature class: I've tried: from arcgis.gis ...
  • 55.3k
2 votes
0 answers
32 views

Python for finding viable solar parcels close to power line

I am currently working on a project for a solar company and we are interested in finding the closest parcels to a power line. For this project we have a few different shapefiles, parcels (dissolved by ...
  • 21
2 votes
2 answers
146 views

Increasing Sample Size for Symbology with arcpy.mp and CIM

I am closing in on finishing a script for some map production in ArcGIS Pro 2.9 and one of my last steps is to increase the sample size of the layer being symbolized, then apply a color ramp, and ...
2 votes
2 answers
85 views

Trying to use fieldmap to append external featureclass/shapefile to new featureclass using external table for mapping

I am trying to work out a way to populate a series of shape files into a new set of Datasets and feature classes. I have an external table of what the destination feature class field name should be ...
2 votes
0 answers
47 views

Geometry Object geoprecessing fails

Theoretically, ArcPy geometry objects can be used as inputs and / or outputs in geoprocessing tools, just pass arcpy.Geometry() as an argument for outputs. However, I have come across several tools (...
2 votes
1 answer
39 views

Why ExportToTIFF() gets TIFFs without pyramids?

What I want to do is to add layers (which are TIFF files) one by one to the current MXD file, and export the MXD in TIFF format. It lacks pyramids however now with the way I code. Here is my code, ...
2 votes
0 answers
297 views

Batch geocode addresses using a REST API (ArcPy, CSV, Server)

My stand-alone Python script tries to geocode a CSV file of addresses. The script successfully geocodes this CSV file when using the *.loc file for this locator but not the published REST API. ArcGIS ...
  • 91
2 votes
0 answers
130 views

Disconnect users who are creating locks on specific feature classes

I have a nightly Python script which updates some domains in a geodatabase. The domain owner is "AMIS". In addition to the AMIS schema in the geodatabase, there are other schemas. In order ...
  • 21.4k
2 votes
0 answers
434 views

Cannot find cloned python arcgispro-py3 environment with conda env list

I am trying to clone my python environment that comes with ArcGIS Pro (arcgispro-py3 located in C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3) to a location I can access (I do not have ...
  • 688
2 votes
0 answers
71 views

ArcPy not detecting colorizer when layer set to stretched symbology

ArcPy is not detecting a raster layer's "colorizer" type when the layer is set to "Stretch" symbology. The ESRI documentation suggests this should be possible. Am I missing ...
  • 1,039
2 votes
0 answers
179 views

Selecting by location AND attribute using one query

I am using ArcMap 10.8 and ArcGIS Pro 2.7 I have two feature classes: one containing currently uploaded county address points (cad_n) and the other containing updated county address points (d_n). A ...
  • 133
2 votes
0 answers
99 views

Using ArcPy to fit polygons inside another one

I have been trying to solve a bin packing problem using a Python script I found, but when I try to use it I get an error that I don't know how to solve. The code that I'm trying to use is taken from ...
2 votes
0 answers
127 views

Run Python script with arguments or return values in ArcGIS Workflow

I found out how to run Python script in custom Step in ArcGIS Workflows. It is possible if I use Executable Execution Type, as executable to run is called python.exe and argument is path to the script....
  • 1,753
2 votes
0 answers
36 views

Raster algebra (subtract) changes extent of output

I have a tool that calculates volume of a portion of a raster DTM. I first clip a portion of the entire raster then fill it. I then subtract the clipped original from the filled raster. My problem is ...
  • 139
2 votes
0 answers
304 views

Exporting all Map Series pages to PDF with page name as output file name using ArcPy

I am trying to export all of my current map series pages into multiple PDFs with the Page Name as the file name. So, "PAGENAME.pdf"... Currently, the code runs, but no output is given. I ...
2 votes
0 answers
428 views

.exe Packaging for Python files with ArcPy?

I've written a little program that's meant to function as a stand-alone, not as an add-in. I'd like to be able to pack it up as an .exe, rather than ask my users to run the script. It does import ...
  • 105
2 votes
0 answers
29 views

My AddLayer script doesn't work within a model but works well on its own

I'm trying to write a script in order to add a output to display (For some reasons I want add the data using a script) This is my script: import arcpy.mapping as mapping mxd = mapping.MapDocument("...
2 votes
1 answer
725 views

Using two map frames on one layout in ArcGIS Pro with ArcPy

I want to create a map series that exports two different sheets on one page. For example Page 1 would have sheet 1 & 2 and Page 2 would have sheet 3 & 4. I used to do this with python in ...
  • 31
2 votes
0 answers
91 views

Determining raster points inside polygon

I am trying to perform zonal statistics on a input DEM and a polygon shapefile using ArcPy in Python 2.7. I have done this in Python 3, but want to be able to do it using ArcPy tools in Python 2.7. So ...

1
2 3 4 5
22