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.

4
votes
0answers
94 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
44 views

ArcPy Memory issue re-using dictionary?

Before I start I should mention that before this I have never worked in Python before. I am trying to process a large fc to fc update, 3 million plus rows with 70 columns. I tried using updatecursor ...
3
votes
0answers
29 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
93 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
61 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
131 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
124 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
266 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
886 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
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
423 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
30 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
29 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
47 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
56 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
35 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
32 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
27 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
118 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
50 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
47 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
248 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
83 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
59 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
114 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
144 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
33 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
300 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
446 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 ...
2
votes
0answers
157 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
108 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
149 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
28 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
130 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
135 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
221 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
109 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
180 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
429 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
40 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
204 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 ...
2
votes
0answers
103 views

Field Mapping in Custom ArcMap Script

I'm writing a script which takes, for its first two parameters, feature classes (or tables). For the third parameter, I want to provide the user with a field mapping option similar to what ArcMap uses ...
2
votes
0answers
259 views

Extract Values to Point “RASTERVALU” rename field

Is it possible to rename the RASTERVALU field on the attributes table, perhaps somewhere in the code? I need to loop thru this command for several raster files due to "Extract MultiValue to Point" ...
2
votes
0answers
195 views

Locking/unlocking layout elements using ArcPy with Esri Production Mapping?

I need to update a text element in a group of MXDs that I manage. That element, however, is locked in the layout using the lock function from the Production Cartography tool. Using python, is there a ...
2
votes
0answers
107 views

How to save raster output in different directory without duplicate in set workspace? Arcpy

I am using the Weighted Overlay tool in Arcpy and I've not had this issue before with other tools. I'm wondering if it's a tool-specific problem. The output I get from the weighted overlay tool saves ...
2
votes
0answers
423 views

Pixel based Regression

I have 80 .tif files, and each pixel value represents NDVI. The whole stack of images is a time-series. I want to run a regression for each pixel using NDVI and time. I have tried to approach this ...
2
votes
0answers
492 views

Classifying data as Natural Breaks using ArcPy?

Is there any chance I can create a simple python script to classify my data as Natural Breaks? I have only created a script for quantile classification, but it is not enough for my work. arrp = ...
2
votes
0answers
41 views

How to export specific DDPs from a set of DDPs?

I have a set of data driven pages and I would like to have a string parameter in the tool that allows me to export specific pages from the set of data driven pages. An example would be if I had a set ...