Questions tagged [arcpy]

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

721 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
126 views

Check for mxd write access with python addin

I'm looking for a way to check for write access to an mxd upon the initiation of a python addin tool. My tool should only be enabled if the user has write access to the mxd. I thought there was a way ...
4
votes
1answer
993 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 ...
3
votes
0answers
67 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 ...
3
votes
0answers
51 views

Comparing tables

Its been years since I last had to code, so please excuse the following. The idea here is that a user inputs their work and it checks for missing expected data. (I've taken out other code that works ...
3
votes
0answers
61 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
71 views

Check Geometry - Bad Envelope

I have a polygon feature which returns Bad envelope when run through the Check Geometry tool. According to the help: Bad envelope : The envelope does not match the coordinate extent of the ...
3
votes
0answers
37 views

Sampling list of rasters in ArcPy?

I've been trying several times to sample (Sample tool from Spatial Analysis ArcGis 10.5.1) a list of rasters to a location sample (also in raster format .tif). Here's the code I've been using, and ...
3
votes
2answers
92 views

Running arcpy.AlterField_management 2,000 times takes too long?

I am trying to replace field names of a table stored in a file geodatabase using a dictionary as a lookup table. My field names got cut off from the Tabulate Area tool (Tabulate Area Truncates Field ...
3
votes
1answer
125 views

Masking LiDAR points to create DEM in ArcGIS Pro with ArcPy?

I have an irregular LiDAR point cloud dataset, so when I try to create a DEM or DSM, the points are connected across the irregular edges of the LiDAR point cloud. I thought that creating a mask ...
3
votes
1answer
59 views

Make Route Events Layer Not Drawing All Routes From Python Toolbox Tool?

I'm working on a python toolbox tool that creates offset points along a polyline via the arcpy.CreateRoutes_lr() tool and arcpy.MakeRouteEventLayer_lr(). The tool simplifies the process by ...
3
votes
0answers
666 views

arcpy.ListFeatureClasses returns empty list

I'm working with SDE connection and want to find if a layer exists on a server. Code sample is: ws = r'Database Connections\Connection to sde-srv.sde' # second option to access connection file, same ...
3
votes
0answers
227 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
1answer
54 views

Performing operations on tool`s startup

I want to perform a selection on tool startup in order to obtain a choice list for parameter derived from selected features. Code kinda works, as I get my choice list with correct values, however it ...
3
votes
0answers
70 views

Transfer real time data from SQL server to ESRI ArcGIS without using PI Integrator?

I am new to GIS. Right now I am working on my senior project in which I have to find the fault in transmission line and show its location on a map using ARCGIS 10.2. I have some readings of voltage ...
3
votes
0answers
162 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
129 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
318 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
478 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 tred in qgis import sys output = sys.path and copy output to arcgis console: import sys for x ...
3
votes
0answers
939 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
506 views

Create Map Tile Package (tpk) progress? arcpy.CreateMapTilePackage_management

I'm using arcpy.CreateMapTilePackage_management to happily create a .tpk - all good. Trouble is this can take a matter of hours, or days for a large complex mxd, once arcpy....
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
1k 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
445 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 ...
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 ...
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
42 views

Raster processing “Tool is not licensed”

I have a piece of python code written that works fine on a small test area but when I blow up the size of the test area I get a "tool is not licensed" error. arcpy.CheckOutExtension("Spatial") ...
2
votes
1answer
40 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 ...
2
votes
0answers
23 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
42 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
1answer
60 views

Delete layer created during Buffer_analysis

I am trying to figure out how to delete the layer that is created during the Buffer_analysis line. I have searched all over the internet and have honestly tried about 100 different methods and cannot ...
2
votes
0answers
33 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
35 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
1answer
49 views

Creating and calling virtual environment to run ArcPy script?

I'm getting a new computer and am trying to set up my virtual environments the right way. In the past, I've just been using PyCharm and running everything through "C:\Python27\ArcGIS10.6" so it's a ...
2
votes
0answers
31 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\...
2
votes
0answers
30 views

Identifying raster max and converting to point using ArcPy?

This is a variant of finding max elevations in a raster and converting them to point containing the max value. I have done this successfully using the full raster (39000x39000), zonal stats, and a CON ...
2
votes
1answer
71 views

Changing min max of Stretched Raster with ArcPy?

I have two rasters r1 & r2: Maximum cell value of r1: 0.9 Maximum cell value of r2: 0.3 Minimum value for both is 0 I am using a color gradient: white - yellow - green - blue - red - black ...
2
votes
2answers
52 views

Opening different XLS spreadsheets as table with ArcPy?

I am trying to write a Python script that uses a xls file with different spreadsheets as input to build features and domains in a geodatabase. This is the data in Sheet1: and this the data in ...
2
votes
0answers
53 views

Creating features from JSON without writing to disk first using ArcPy?

In ArcPy, I want to use JSONToFeatures_conversion, but I'm working with data that I pulled from a web service. I have no need to save the data to disk. So, I thought I could do something like this: ...
2
votes
0answers
58 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,...
2
votes
1answer
58 views

Can arcpy read dynamic text as appeared in ArcMap?

Just wondering if we can read dynamic text in arcpy? For example, assume we have a Text Element called myText which contains a piece of dynamic text Map <dyn type="page" property="index"/>. ...
2
votes
0answers
20 views

arcpy.ArcSDESQLExecute with UPDATE and OUTPUT

Is there a way to get OUTPUT through arcpy.ArcSDESQLExecute? Whatever I do I get only True. When running UPDATE through MS SQL Server Management Studio I get OBJECTID of all updated features (rows): ...
2
votes
0answers
37 views

Removing extra dots when loading Python script

This is probably a silly question, but I'm having a problem whenever I load a Python script in ArcMap where extra dots are loaded with the script (see below) that I must manually delete prior to ...
2
votes
1answer
58 views

Conversion of CSV to DBF is getting error message, why?

My code import arcpy, os, shutil, re from arcpy import env arcpy.env.workspace = "R:\GIS_Data\Earthquake_Data\Updates\Eq_updates.mdb" path = r"R:\GIS_Data\Earthquake_Data\Updates" In_path = r"R:\...
2
votes
0answers
256 views

Using Reclass in Arcpy, Error 010005: Unable to Allocate Memory

I've derived a raster of slopes from a 10 m DEM resampled to 15 m for an area of approximately 20,000 mi^2. I want to use Python to reclassify those slopes into categories according to range, but ...
2
votes
0answers
206 views

Moving Feature Class to Different Feature Dataset within Same File Geodatabase using ArcPy?

I want to progammatically move a feature class into a different feature dataset within the same file geodatabase. I'm wondering if there is a way of doing this without including code to rename and ...
2
votes
0answers
73 views

Map Algebra loop only creating one raster

I'm trying to transform a bunch of rasters in arcpy according to specific functions to create suitability rasters. This portion of the code is supposed to find all the rasters with interpolated ...
2
votes
0answers
67 views

Delete rasters added by script

I have a custom python tool which creates a number of rasters and writes them to C:/Documents/ScriptTool folder as tif files, and also adds them as layers to the active map. At the startup of the ...
2
votes
0answers
49 views

Arcpy Dissolve creating grid that is not produced when run manually via ArcMap

Software: ArcMap 10.5.1, ArcPy I have created 2 python scripts that seeks to create a floodplain polygon from a DEM. py1 is DEM to Polygon while py2 cleans polygon to create final output. In py2 ...
2
votes
0answers
43 views

Simple iterate SetNull in ArcPy not working

For a large number of rasters, I need to define a pixel value less than zero as being Null and output the rasters. However, my simple SetNull loop (below) only processes the first raster in my list as ...
2
votes
0answers
256 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 ...