Questions tagged [arcpy]

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

786 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
140 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
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 ...
3
votes
0answers
86 views

SQL query fails in arcpy, but works in ArcGIS Pro 'select by attributes'

I'm building an SQL query in Python that is used to make a feature layer, but the feature layer returns no features, when it should return 1169 features. The query below works on 95% of the data (...
3
votes
0answers
109 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
1answer
76 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"/>. ...
3
votes
0answers
72 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
92 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
44 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
1answer
72 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
728 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
250 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
57 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
76 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
177 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
130 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
337 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
483 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
951 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
515 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
446 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
0answers
47 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
2answers
71 views

UpdateCursor for field calculation based on unique values

UPDATE TO PREVIOUS QUESTION: I have an address feature class. I want to use an UpdateCursor that focuses on two fields: StreetName and Block_ID. For every instance of a unique StreetName, I want the ...
2
votes
0answers
30 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
37 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
1answer
36 views

Set Windows temp file location

I am running some ArcPy scripts and the tools keep wanting to write to my c:\users\appdata\local\temp location. I have set the scratchworkspace and workspace environment variables of arcpy to a drive ...
2
votes
1answer
26 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
45 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
52 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
87 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
27 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
46 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
61 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
44 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
38 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
65 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
32 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
1answer
87 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
80 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" ...
2
votes
2answers
54 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
56 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
77 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
0answers
22 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
0answers
140 views

Copying tables results in duplication of some tables, feature classes and relationship classes

ArcGIS Pro 2.2.3. I have a file geodatabase called "supportSource.gdb" with 3 tables, 2 feature classes and 3 relationship classes. I just want to copy the contents of this file geodatabase to ...
2
votes
1answer
74 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
476 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
295 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
78 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 ...