Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [arcpy]

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

6
votes
0answers
46 views

Python Script Performance as an ArcGIS Tool Versus Stand-Alone

Has anyone studied the difference in running a Python script in ArcToolbox versus as a stand-alone script? I had to write a quick-and-dirty script to convert a set of RGB images to single band by ...
5
votes
0answers
99 views

Authorizing a user logged in via ArcGIS Online/Javascript in a Python server

So, let's say I have this application built via WebAppBuilder, the user is already logged in via a ArcgisOnline organization, but I have a separate python server that does some custom geoprocessing ...
4
votes
0answers
100 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 ...
3
votes
0answers
39 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
40 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
33 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
0answers
506 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
98 views

Numpy Array to ArcGIS GRID gives dimensional error with masked array

I have an 84x73 masked numpy array to load into ArcGIS (version 10.3.1, Windows 8.1). To overcome the fact that Masked Numpy arrays cannot be saved to .npy file as of yet, I am saving my array from ...
3
votes
0answers
64 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
142 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
126 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
275 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
907 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
485 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
431 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
44 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
26 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
17 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
34 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
37 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 ...
2
votes
0answers
93 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
58 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
47 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
37 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
36 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
161 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 ...
2
votes
0answers
70 views

add points in existing profile graph with labels of its heights

I have created profiles at multiple locations with lines. Now I want to add points to that graph, how do I do that? Any suggestions? Here is the script import arcpy import os import matplotlib....
2
votes
0answers
54 views

Adding script tool to ModelBuilder in ArcMap?

I have create a script and want to add it to the model I have provided. The code is: import sys, string, os import arcpy import numpy Table = arcpy.GetParameterAsText(0) Field1 = arcpy....
2
votes
0answers
49 views

Copying/Inserting features AND user-defined Attributes as input to existing feature class in SDE using ArcPy?

import os, arcpy, zipfile, glob # INPUT ZIP FILE infile = arcpy.GetParameterAsText(0) path = "D:\Database_Connections" NAME = arcpy.GetParameterAsText(1) CODE = arcpy.GetParameterAsText(2) SOURCE = ...
2
votes
0answers
286 views

Automating topology error fixing with ArcPy?

I have a web application where folks upload a zipped up file geodatabase, I unzip it and manipulate the feature classes and then transfer them using insert cursors to an SDE database. I am wondering ...
2
votes
0answers
91 views

UpdateCursor doesn't give error until the next iteration ('NoneType' object is not iterable)

I have a string field within a GDB that does not accept all string values, giving a "The row contains a bad value" error. I have fixed the issue with InsertCursor (prompts user for new value), but can'...
2
votes
0answers
62 views

TableView has no workspacePath in ArcPy?

One of my colleagues is running a script which includes the following Python in ArcMap... oTble = arcpy.mapping.TableView(tbleName) Workspace = oTble.workspacePath print "oTble: '{}'".format(oTble) ...
2
votes
0answers
129 views

Summing numeric attributes of field during Spatial Join using ArcPy?

Just performed a spatial join operation on a polygon layer (made of 500 grids cells) and point layer (1 million points). The aim was to find the sum of a field in the points layer (field AREA) during ...
2
votes
0answers
156 views

arcpy connect to accdb with 64bit background processing

I'm trying to read from a accdb MS Access Database via python in a ArcGIS Toolbox tool. I already established a database connection (via Add OLE DB in ArcCatalog) which I can use in a 32bit python ...
2
votes
0answers
34 views

Arcpy: MXD automatically removing layer whose data source was overwritten

I have a large script that does many things, but at the end it creates a buffer whose output is an existing feature class that is overwritten. That feature class is the data source for a layer that ...
2
votes
0answers
326 views

Unable to run scripts with arcpy using ArcGIS Pro and Pycharm?

I have installed ArcGIS Pro 2.0 which runs Python 3.5.3. I am trying to get started with the Arcpy library using the IDE PyCharm. I started a new project and pointed to the python file of the ArcGIS ...
2
votes
0answers
180 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 ...
2
votes
0answers
110 views

arcpy feature class to feature class error going from enterprise GDB to FGDB

I have a simple python script that was working fine for copying data from an SDE enterprise database connections to a FGDB. import os,sys,arcpy arcpy.env.overwriteOutput=True base_layers=r'Database ...
2
votes
0answers
178 views

RemapRange for Reclassify Error in ArcPy

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 ...
2
votes
0answers
29 views

obtaining the viewer extent of an ArcGIS portal page w/ python widget

I will be hosting various locations of features on an ArcGIS portal page, and want to add a geoprocessing widget (Python toolbox) that will export those features currently seen in the viewer. The ...
2
votes
0answers
131 views

Faster equivalent of arcpy distanceTo method

Unfortunately arcpy distanceTo method is painfully slow. When speed is crucial, I am still using Avenue to work around it, but it is getting harder to transfer ArcView 3 to newer computers. As ...
2
votes
0answers
145 views

Manipulating Pop-ups using ArcPy with ArcGIS Pro?

I am using the ArcPy libary at the moment to manipulate data in layers. It looks like ArcGis Pro allows the user to use "pop-ups" for each layer which allows selected data to be displayed in a pop-...
2
votes
0answers
251 views

arcpy Union_analysis general function failure problem

As part of a longer script, I use this code: import arcpy, os Polygon = r"pathtoashapefile.shp" workspace = r"path_to_a_folder" output = os.path.join(workspace, "test.shp") arcpy.Union_analysis(...
2
votes
0answers
118 views

Problems using REST API to generate Tile Packages from World Topo (For Export)

Using the python script below it seems that I can request the generation of tile packages from an ESRI ArcMap REST service, and then download the resulting tpk file generated by ESRI. But when I try ...
2
votes
0answers
206 views

Using update cursor to update feature class field from another table with incremental date/time query?

I have a feature class called AO15_16 where the field id needs to be updated. The update will contain a unique id based on a query of another table where I am querying issueddate, issuedtime and `...
2
votes
0answers
469 views

Using arcpy.FieldMappings() to load data into tables

I have been tasked with bringing in a dataset from one table with a hard and fast schema into another table with the same. Both tables have very similar fields, but the names and capitalization are ...
2
votes
0answers
41 views

Referencing layer object which was created as result of geoprocessing inside MXD without iterating through TOC?

I am creating a python tool which must be run in and open MXD in ArcMap (10.2, ArcFM). The MXDs we use have a LOT of layers, and often multiple layers from the same datasource. In the script I need to ...
2
votes
0answers
223 views

Breaking single large raster into NumPyArrays using arcpy memory error

I'm trying to run raster calculator on a large raster file using the following approach : http://pro.arcgis.com/en/pro-app/arcpy/functions/rastertonumpyarray-function.htm, but I seem to run into ...