Questions tagged [arcpy]

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

921 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
1answer
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 ...
4
votes
1answer
93 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 ...
4
votes
0answers
126 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 ...
4
votes
0answers
176 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
1answer
229 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
0answers
85 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
0answers
32 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 ...
3
votes
0answers
103 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
0answers
390 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 ...
3
votes
0answers
354 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 ...
3
votes
0answers
222 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 ...
3
votes
0answers
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 ...
3
votes
0answers
442 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
0answers
560 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 ...
3
votes
0answers
508 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 ...
3
votes
0answers
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 ...
3
votes
0answers
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-->...
3
votes
0answers
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 ...
3
votes
0answers
457 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 ...
3
votes
1answer
177 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&...
3
votes
1answer
742 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 ...
2
votes
2answers
63 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
0answers
22 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 ...
2
votes
0answers
45 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
1answer
35 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
0answers
49 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 ...
2
votes
0answers
38 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 ...
2
votes
0answers
41 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 ...
2
votes
0answers
73 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
0answers
99 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....
2
votes
0answers
32 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 ...
2
votes
0answers
125 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
0answers
282 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 ...
2
votes
0answers
26 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
1answer
409 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 ...
2
votes
0answers
53 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 ...
2
votes
0answers
57 views

ArcPy dissolve field changes output field name pattern

I am using the Dissolve tool to summarize two point feature classes (item in list). The general pattern of the fields within each item are: rankx_dest rankx_length rankx_cost e.g., rank1_dest field. ...
2
votes
0answers
68 views

Python script runtime error - ImportToolbox and run a custom geoprocessing tool

I am very new to Python. I created a simple tool using Model Builder that updates a few columns of data in a SDE feature class. The model runs perfectly within ArcMap 10.5. I need this script to ...
2
votes
0answers
28 views

Transforming descriptive CSV data to known locations in GIS using Python

I have to transfer CSV data that describes a FROM and TO segment into spatial data. The segment descriptions do not follow any logical convention, but rather describe road junctions, places, or road ...
2
votes
0answers
80 views

Variable type for Value Table parameter in Modelbuilder?

I've created a python tool with a multivalue input box (parameter type: GPValueTable). The box is small and will contain long strings. I'm hoping to be able to add values to the input box with ...
2
votes
0answers
156 views

Getting ArcPy Error 00354

Just to get the obvious out of the way, I am very new to python and arcpy. I know almost nothing. That being said, I've inherited a script that is run once a year and I'm now the only one responsible ...
2
votes
0answers
39 views

Print functions for data projection and rename file

I have been struggling with functions in this script as I would like to see the projection in the file and then rename. The problem is that it causes and definitions are not done properly Here is the ...
2
votes
0answers
52 views

Where_Clause expression working for one FeatureClassToFeatureClass_conversion export but not another

I am attempting to export a feature class to both a shapefile and feature class with a where_clause restriction on particular values within particular fields. I have written a function to take dataset ...
2
votes
0answers
103 views

ESRI Geometry Union slower than Built in dissolve which is slower than Shapely

I work with point datasets a lot. We try to keep a running layer of points and update the dataset with new points while removing the old points. So, we do a lot of checking the extents of the new ...
2
votes
0answers
50 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 ...
2
votes
0answers
50 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 ...
2
votes
0answers
125 views

import arcpy in multiprocessing make script to hang indefinitely

I have a simple script to test multiprocessing with arcpy, but the script hang indefinitely. The problem is with the import arcpy statement that seems to be a problem in the child processes. Other ...
2
votes
0answers
63 views

Speed up ArcPy CopyRows_management process on large feature layer?

I am attempting to automate an ArcMap process with Python and I am having difficulty with a particular part of a process taking too long when performed on larger datasets. The process is as follows: ...
2
votes
0answers
530 views

Arcpy 'Append_management' much slower than ArcMap Tool?

Basically I have a script that grabs data from a web service, parses it, stores it in an intermediary local fgdb, then appends that data to the feature class in the enterprise gdb. The portion of the ...
2
votes
0answers
43 views

ArcPy name raster layer

I am using ArcPy to save a TIFF file in a geodatabase file with this code: arcpy.RasterToGeodatabase_conversion(Input_Rasters=r'D:\Projects\GEBCO_2019_Geotiff.tif', Output_Geodatabase=r'D:\Projects\...

1
2 3 4 5
19