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.

1
vote
1answer
42 views

Deleting row using ArcPy cursor?

I am new to python ArcPy. I am trying to delete identical points in feature class. the code is below: >>> import arcpy >>> fp=r"D:\NOCAS\TEMP\Belgum transistion.gdb\transistion\...
0
votes
0answers
31 views

Connection information provided was for a non-administrative user fails in task scheduler

When attempting to use the arcpy.DisconnectUser function in a script that runs in task scheduler I receive the error 'Connection information provided was for a non-administrative user'. I am able to ...
3
votes
1answer
73 views

Getting field type in ArcPy?

I've got back into Python after a long break. I'm creating a simple data validation script at the moment. I am just trying to return the field type of a field input by the user. I'm using arcpy....
2
votes
1answer
38 views

ArcPy not reading Layer properly? [closed]

I would like to work with selections. For that I start to read the layer from a mxd. I have controlled that the layer count 0 returns the correct name, but the GetCount_management is empty as is the ...
1
vote
1answer
47 views

Select By Attribute Query Using Shape Area

I have a script that assigns a rank to each feature in a feature class based on the sort order of a target field. When I use this script to assign a rank based on shape area, I cannot pull the full ...
-1
votes
1answer
38 views

Running Model in Python

Having a lot of trouble trying to run a model I built in ModelBuilder in Python. What is the proper way to do this? I'm adding the toolbox then running the model. Seems easy enough but I'm getting an ...
0
votes
0answers
21 views

ArcGIS Online Custom Print - Printing Legend

I created a custom print service using ArcPy. It is hosted as GPServer on my test server. The print service uses a JSON configuration file to pull the data from the mxd. The JSON passed from the web ...
0
votes
1answer
28 views

Clipping Raster Mosiac Simultaneously Within Separate ArcPy Scripts?

I have a large raster mosaic dataset that I would like to clip within several scripts simultaneously, but whenever I run two instances of a script simultaneously one always fails with the error: ...
1
vote
1answer
31 views

Enter filenames into attribute table

I have an empty field in every shapefile called "District" and I want to pull the filenames from each of those files into that "District" field. Here is my code so far: import arcpy from arcpy ...
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 ...
2
votes
1answer
30 views

Adding layer to open ArcMap document using ArcPy?

I have created a script. I'm run the script using ArcMap and a layer should be added to the open ArcMap document. I have earlier used MXD.save() witch work fine when I'm running the script outside ...
1
vote
0answers
29 views

ERROR 000338 when appending two datasets into one with arcpy

In an enterprise geodatabase with three datasets I'm trying to append two of the datasets into the third, however I get an error which states that Inputs must be either all Feature Classes, Tables or ...
1
vote
1answer
43 views

How do I interactively select a polygon in ArcMap 10.3 and pass the selected feature to a Python script

I currently have a Python 2.7 script that takes a hard-coded select by attribute arcpy.SelectLayerByAttribute_management("SoilLandscapePolygons_Layer", "NEW_SELECTION", "POLY_ID = 25984) that then ...
1
vote
1answer
22 views

Using Python Lists in Calculate Field Code Block? [closed]

I'm looking for some help in explaining what exactly is occurring with the following code: MaterialLife = "LifeMaterial(!"+Material+"!)" codeblock2 = """def LifeMaterial(mat): material = {"ABS":...
2
votes
2answers
124 views

Calculating multiple fields using ArcPy?

I have found a script that can add multiple fields to my existing shapefefile. Now, I need to add to my existing script so that it will calculate the new fields that have been added. In most cases, ...
0
votes
2answers
43 views

Populate SQL Expression in Toolbox based on hard coded parameter [closed]

I have an ArcGIS toolbox script that applies a user-defined definition query to multiple layers within the current MXD. The only user variable currently required is the definition query itself, which ...
1
vote
1answer
24 views

Trying to add a value in the second row of a table

I am trying to add a specific value to a cell of the second row of a feature-class-table. Doesn't work with my code: #First row rows = arcpy.InsertCursor(tb_value) row = rows.newRow() ...
0
votes
1answer
23 views

ArcPy - Select Layer by Attribute / Delete Selected Layer - SQL

I feel like I've tried so many iterations of this, can anyone assist with how to use ArcPy to selected layer by attribute then delete selected layer? I think my SQL query is incorrect? import arcpy ...
0
votes
1answer
33 views

Is there a way to programmatically access an ArcGIS Pro project's default geodatabase?

In the ArcGIS Pro workflow, one typically creates a project that is set up with its own file geodatabase. Is there a way to refer to this geodatabase generically in a python script? I have been ...
0
votes
1answer
45 views

Problem with if-statement and whereClause format

I have a program which should count the number of a feature class or the length of a feature class depending on the geometry of the input feature class. This part is working. There are two parameter-...
0
votes
1answer
37 views

Add makeFeatureLayer layer to map in ArcGIS Pro using ArcPy

I am making a feature layer and applying an expression to essentially apply a definition query to the source feature class. I then want to add the created feature layer to the map. I am aware of ...
1
vote
1answer
28 views

How to create heat map animation based on point-shapefile with data attribute in ArcGIS?

I want to create an animation of forest fires, using the NASA' MODIS data for the last 11 years. Their shapefile has acquisition data attribute — and it goes day by day all those years. I've already ...
1
vote
2answers
27 views

Clipping Feature by using irregular polygon in ArcObjects?

I want to clip the features based on selected polygon.I have the two layers "suburban" and "lot". I want to clip features of lot layer based on selected polygon from suburban layer. I have tried ...
0
votes
1answer
44 views

Changing version with arcpy

I am looking to change versions of an .sde through Arcpy to then afterwards, run a few geoprocesses on it. I do not want it to automatically update after that. So far I have managed to create a ...
1
vote
0answers
38 views

Reclassify raster conditional on attribute values in R

My raster has nonsensical values (based on combination of multiple rasters in previous steps), with attributes maintained (again, due to combination of rasters in previous steps), see below for sample ...
2
votes
1answer
55 views

NumPyArrayToFeatureClass gives RuntimeError: create table

I've tried to change polygon feautre to point by using tools: FeatureClassToNumPyArray NumPyArrayToFeatureClass. My code as below: import arcpy import numpy as np in_file='C:/ios/...
0
votes
0answers
40 views

Sending parameters to ArcGIS script through web interface

I have written a simple script in ArcGIS environment and I want to run the script through a PHP program. At present, I am trying this within localhost. In my script, I have defined two parameters. My ...
1
vote
0answers
33 views

Raster output symbology differs in tool vs. Python

I have a bunch old DOQQs from the 90's that are projected in NAD27, giving them the black angled collar you see in the image. I am trying to set the collar to null by running SetNull on Value = 0. If ...
0
votes
1answer
41 views

Creating file geodatabase and using it as variable to create file path?

It's been a while since I've done arcpy scripting so it feels kind of new again. I'm working a script that is asking for these 5 parameters: workspace = arcpy.GetParameterAsText(0) RouteLayer = ...
0
votes
1answer
41 views

Creating Python code with ArcMap to export maps in jpg?

I want to export maps that I have created on ArcMap 10.1 with this Python code: mxd = arcpy.mapping.MapDocument("CURRENT") for i in range(1, mxd.dataDrivenPages.pageCount + 1): mxd....
1
vote
1answer
83 views

Calculate percentile value of raster

I want to set null all raster values that fall below the 75th percentile value. E.g. If you classify the raster by quantile method into 4 classes I want to be left with the top 25% percentile. For the ...
2
votes
1answer
90 views

Feature to polygon in multiple folders

I have a few hundred folders, each with a set of shapefiles that are identical across folders (ie each folder has a 'lot.shp'). They are all supposed to be polygon features, but unfortunately many ...
1
vote
1answer
30 views

Limiting feature class parameter to specific geodatabase?

I have a tool that will update the geometry of a feature class based on the geometry of another, using a common identifier. It works great but the way I have it set up, you have to first select the ...
0
votes
1answer
31 views

Error 999998 Saving Raster with Arcpy

To start, I found a similar question posted on stack exchange here, but I am not using the zonal statistics tool, which the answer to that question is based on. With that out of the way, I'm ...
1
vote
2answers
33 views

Copying shapefile to Feature Dataset using ArcPy?

How do I copy a shapefile to a Feature Dataset? Here is is my script. import arcpy import os arcpy.env.workspace = "C:/temp" dataset1 = "C:/SDE.gdb/temp1" arcpy.CopyFeatures_management("scrap....
0
votes
1answer
39 views

arcpy.Rename_management() returning ERROR 999999 and [Errno 13]

I have a function where I am trying to rename a geodatabase, both os.rename and arcpy.Rename_management() work in the Python window but not in the Script when run as a tool through ArcCatalog. ...
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 ...
1
vote
1answer
41 views

If Statements in ArcPy Select Feature SQL Query

I'm trying to select pipes with specific codes. These codes are 8 digits long and I only need to select certain combinations. For example, pipes that have codes with the number 8 in the 7th position ...
4
votes
1answer
59 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 ...
0
votes
1answer
46 views

Select DDPages before exporting

I have script for exporting separate data driven pages (script tool in a toolbox). import arcpy mxd = arcpy.mapping.MapDocument("CURRENT") pageNumbers = [4,7,11] #select pages before exporting ...
0
votes
0answers
49 views

Script sometimes stuck at arcpy.SplitRaster_management

my problem is that my script sometimes stuck then it use arcpy.SplitRaster_management. import arcpy import os #nearly 700 rows of script fclist: [ ...] # some fc rasterlist = [...] # many raster ...
0
votes
1answer
19 views

Projects feature with attachments from one coordinate system to another

I'm trying to projects a feature with attachments from one coordinate system to another without loosing the attachments. I'm using the GeoTagged Photos To Points function to create a point feature ...
2
votes
1answer
54 views

Accessing Home directory of ArcMap using ArcPy?

I want to access to a directory and set that as a arcpy.env.workspace in my Python Script Tool. However, this workspace depends on users so I cannot just use my own folders. Is there a way to access ...
2
votes
1answer
40 views

Why is data from Collections.DefaultDict(list) a string?

While creating a defaultdict(list) containing street names, x and y coordinates, my x and y entries are converted to strings. This prevents me from doing calculations on them. I've been looking around ...
0
votes
1answer
27 views

arcpy.da.SearchCursor storing data in a list with a query

I am currently working with a database that hold street names, x and y coordinates and many more fields. I would like, through a search cursor, to store the x,y coordinates in a separate list for ...
0
votes
1answer
37 views

ArcGIS 10.5 Python script integration to 'script/tool' not outputting data

In ArcGIS 10.5 I have a python script that works well in the python window, however, I am trying to integrate it in a tool, mainly to make use of the arcpy.GetParametersAsText() input feature for the ...
0
votes
0answers
14 views

Using Python / ArcPy to activate feature in one of ArcMap toolbars?

I'm writing a basic python script that will change a definition query and export. That is simple enough, but I would like to also add these arrows that only show up when you manually check a box ...
1
vote
1answer
23 views

Naming exported features from attribute information?

I am new to Python and in the process of learning. As a self test I am trying to export all of the municipalities of a single county feature layer as their own feature layers. I am trying to name each ...
1
vote
1answer
34 views

ArcPy progessor not progressing?

I have a script too that works fine, but the progressor is not counting up at all (staying at "0%") when I run my tool, even though I can confirm it is working - I can see the products of the script ...
0
votes
0answers
19 views

Initiating Edit Session when opening Python Toolbox?

I initially posted a question regarding the use of the GpFeatureRecordSetLayer Parameter in a Python Toolbox I am creating. Original Question: Using GPFeatureRecordSetLayer in Python Toolbox for ...