Questions tagged [arcpy]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
32 views

Updating layer definition query using ArcPy? [closed]

I'm using ArcPy for some automation and I need to update the layer definition query multiple times while running the same script. I've only been able to find ways to update the layer definition ...
0
votes
0answers
29 views

MakeTableView of Excel spreadsheet tab gives ERROR 000732?

I have a very simple model built using Modelbuilder that takes a tab of an Excel spreadsheet and converts it using Make Table view. This works fine in ModelBuilder. I then export the model to Python ...
1
vote
1answer
22 views

Iterating through table for IDW says parameters are not valid?

I have a table with precipitation data from 5 weather stations and I am trying to iterate through the table to perform IDW on each field (month of precipitation). import arcpy from arcpy import env ...
0
votes
1answer
40 views

Updating z value of geometry using updateCursor?

I am trying to update the Z value of a polygon using update Cursor and it just doesn't work! I have been exploring this site and trying different codes without success. I have a shapefile with ...
0
votes
1answer
48 views

Removing duplicate values within rows using ArcPy?

How can I remove duplicate values within a text field using ArcPy? The following example shows a list of numbers for each row in a featureclass, some with duplicate numbers. I am aware of ...
2
votes
1answer
42 views

Setting up ArcPy virtual environment with Pandas?

Do I need to bounce back and forth between two virtual environments in order to run Pandas and ArcPy in the same script, while ensuring Pandas (or accidental updates to NumPy) doesn't break Arcpy? I'...
2
votes
1answer
46 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 ...
3
votes
0answers
60 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 ...
4
votes
1answer
60 views

Limiting Input Parameter to only File Geodatbase in Python Toolbox?

I've been working with ESRI Python toolboxes for a while but I'm still having difficulties setting an input parameter as a "DEWorkspace" and using the parameter filter to make it so only file ...
2
votes
1answer
32 views

Finding documentation for changes to syntax/parameters of ArcPy tools/functions in ArcGIS Pro? [duplicate]

In a Q&A on this site I recall @KHibma pointing out where in the ArcGIS Pro Help any changes to the syntax (like extra parameters) of a particular tool/function since ArcGIS Pro 1.0.0 could be ...
0
votes
1answer
25 views

Getting RunTime Error: Object: CreateObject cannot create geometry from inputs when trying to add a polyline using an insert cursor

The objective for this code is to take a csv that contains rhino observations and create a polyline shapefile for the data. The shapefile needs to have the paths the rhinos take based on observations (...
0
votes
3answers
55 views

Concatenating list of strings using ArcPy?

My code from Returning strings showing all vertices from all polygons in shapefile using ArcPy? creates is the following: import arcpy fc=r'D:\GIS Data\TOOLS\EV calc in Python\Data.gdb\PolyWGS842' ...
0
votes
0answers
34 views

Getting ERROR 000800 keyword used is not member of list of acceptable keywords from ArcPy?

I'm trying to use arcpy.AddFieldToAnalysisLayer_na using a network analysis layer def fonction(network): in_network_dataset = network out_network_analysis_layer = "Best_Route" impedance_attribute =...
0
votes
1answer
33 views

Automate Selection/Copy Features from Selection

I am new to Python and ArcPy, but I would like to automate this process and/or make my code more efficient here. I am basically selecting a layer by attribute, then copying features from the (selected)...
1
vote
1answer
29 views

Selecting by attributes which have alphabet data using ArcGIS Field Calculator? [closed]

I only want to select values that are entirely alphabetic characters. Select by attributes which I have alphabet data. SELECT ONLY RED INDICATED VALUES
0
votes
1answer
33 views

Exporting multiple shapefiles into FGDB with ArcPy (Python)?

Does anyone have any idea why I am getting the error? I am trying to export multiple shapefiles to a single File Geodatabase. >>> import arcpy >>> arcpy.env.workspace = r"W:/gis/...
3
votes
2answers
83 views

ArcPy Delete Function not working inside for loop?

I'm creating a table and then trying to delete that table inside the same for loop as follows: for fc in fcList: arcpy.GenerateNearTable_analysis(inFile, fc, out_table) arcpy....
0
votes
2answers
33 views

Adding non-nullable field to populated feature class

Having a populated feature class in a geodatabase, a non-nullable field should be added (or a currently nullable field changed to non-nullable). That current field has currently no null values so I ...
0
votes
1answer
21 views

00068 Script Script contains broken project data source: CURRENT

Can't share my script as geoprocesing service. The warning message: 00068 Script Script contains broken project data source: CURRENT Here is the script: # Import arcpy module import arcpy arcpy.env....
-1
votes
2answers
26 views

Attempting to use cursor to filter results by date, then use groups of records to find max value

In my data, I have a table view where I am trying to group same records (PID), then filter records by date (ROW_CREATE_DATE). if the record has the date of 2019-03-05 then find records in the line # ...
0
votes
1answer
44 views

Python- Make use table from a MDB with name changes every week (name+date)

I have been trying to make a script to automate some steps in a process that uses tables from different databases. One of them changes its name every week - name+date eg: "MegaDataBase_16062019.mdb" ...
2
votes
1answer
170 views

Returning strings showing all vertices from all polygons in shapefile using ArcPy?

I want to have a string showing all vertices from all polygons in a shapefile. In my example below my code lists all vertices and the first column shows the polygon they are part of (I only have 2 in ...
0
votes
0answers
38 views

Adding Polygon to shapefile of particular area from Excel?

I have Excel data in which polygon number is given, in correspondence to that there is particular Area given. I have 5000 to these entries. Now in the shape file, we have to edit every polygon and add ...
1
vote
1answer
35 views

Boolean precondition in ModelBuilder not exporting to Python script

I don't know python so I often use ModelBuilder and export to python script. In this case, I have a model (that in itself is made of python scripts that have been exported from models) that works fine ...
0
votes
2answers
47 views

Adding ArcGIS Server feature service to ArcMap data frame using Python? [closed]

There's an external ArcGIS Server that I've been manually going into through ArcCatalog to pull down feature services and save them off as feature classes. I do this twice a month, so I would like to ...
2
votes
1answer
43 views

arcpy.da.NumPyArrayToTable() RuntimeError: Unspecified error

Using arcpy for ArcGIS Desktop 10.7.1... In order to append data from a Pandas data frame to an ArcGIS table, I am attempting to create a temporary in-memory table from the Pandas data frame as ...
2
votes
1answer
135 views

Using ArcPy to insert new data into shapefile without editing it?

I want to insert new data into a empty shapefile. I have an array with the fields values of each row and I use InsertCursor to add these data to my shapefile. When I run the code if the shapefile is ...
1
vote
2answers
50 views

Understanding and using fieldmapping with ArcPy?

I'm having trouble trying to understand how fieldmapping works in ArcPy (I'm kinda new to Python). In the below example, I want to take a shapefile and append it to a feature class. But I want to use ...
1
vote
1answer
57 views

Comparing a polygon layer within the boundary of a polygon

I'm pretty new to ArcPy and Python. In our database, we have a layer containing parcels (polygons) with a neighborhood code and a polygon layer that contains the neighborhood boundary. Within that ...
2
votes
0answers
30 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\...
1
vote
1answer
19 views

Adding multiple feature classes (everything within gdb) to a group layer in ArcGIS Pro - Python

I am currently trying to add all the feature classes contained within a gdb to a group layer in ArcGIS Pro via a script. I have however not managed to add more than one single feature class at a time. ...
3
votes
1answer
45 views

Insert Cursor Not Filling XY Field

I have a table with a set of original XY values and a set of new XY values. I want to create new points of the new xy's using the insert cursor. My code updates the ID and Sp row but not the XY row. ...
-3
votes
1answer
55 views

Excluding certain Tables and Table Columns out of Analysis using ArcPy? [closed]

My code currently follows this format: Create FGDB From local folder, get list of all tables Do TableToGeodatabase_conversion on all tables What I want to do now is exclude certain tables from being ...
1
vote
1answer
24 views

Setting default value for date columns with FeatureClassToNumPyArray in ArcGIS Pro?

I am reading a feature class into a pandas dataframe using: df = DataFrame( arcpy.da.FeatureClassToNumPyArray( in_table=feature_class, field_names=field_list, skip_nulls=...
0
votes
0answers
25 views

Undoing Operation while editing in ArcMap with Python Add-ins?

Using ArcPy Add-ins, I can issue a message, but I don’t understand how to cancel or undo deleting an object. Is it possible? class ControlUniq(object): """Implementation for addin1_addin....
0
votes
1answer
37 views

Getting Con statement in ArcPy to work?

I have a script in Python that includes a series of Spatial Analyst tools. I need to reclassify a raster and have tried using Remap which fails and have also tried a Con statement. The Con statement ...
1
vote
2answers
37 views

Use ArcPy for finding value throughout all fields and export to new layer

I need to find a way to find a specific value in the attribute table and then export all rows with said value to a new feature class. Below is the code that I have managed to come up with (using ...
2
votes
0answers
29 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 ...
0
votes
1answer
53 views

Using ArcPy in Python class

I am trying to create a tool that creates dimension lines but I am getting error. Runtime error Traceback (most recent call last): File "<string>", line 1, in <module> File "<...
0
votes
0answers
23 views

RuntimeError: Objects in this class cannot be updated outside an edit session

I recieved this error: RuntimeError: Objects in this class cannot be updated outside an edit session while runnng this code: # import modules import arcpy import random from arcpy import env ...
0
votes
1answer
34 views

Arcpy SDE Connection Getting Invalid Path? [closed]

I literally copied and pasted the file path (r'C:\Users\myName\AppData\Roaming\ESRI\Desktop10.4\ArcCatalog\mydatabase.sde'), but after I run my script, I always get the error saying error 267, the ...
0
votes
0answers
25 views

Checking if feature class is table in FGDB using ArcPy?

I basically want to do something like: if my_fgdb has data type "tables" then do this A similar function I know of is something like .startswith("xx"), so something similar to that like .typeis("...
0
votes
0answers
21 views

Delivering script tool using toolbar vs addin button?

I am having trouble determining how to best deliver my script tool for use in ArcMap 10.7. I can create a toolbar that has my custom script tool in it. That is easy. The trouble is I can't get the ...
1
vote
0answers
25 views

Raster calculator giving different results in ArcPy than in ArcGIS?

I have two rasters representing travelling speed: one for road (with speed values for different types of roads and "0" values where there is no roads) and one for land-cover (with lower values, but no ...
0
votes
0answers
29 views

Don't allow to save edits in the table untill the field will be populated in ArcGIS with pythonaddins

I have a table and some fields there(OBJECTID, UN_ID, for example).Table is not empty. how to prevent an edit session from stopping or saving until the field will be filled. I wrote an extension ...
0
votes
0answers
29 views

Iterating through values in Attribute field and performing selection using ArcPy?

I am using ArcGis Pro 2.4 python window. I have seen suggestions of using "SearchCursor" but am unclear how to utilize this tool in the Where-Clause in my SQL selection statement to select by ...
0
votes
0answers
28 views

How can I create a layer for each unique field item in a shapefile using Arcpy

#Introduction and imports import arcpy, string from arcpy import env #User Inputs: layer, field name, output workspace (optional) strTargetLayer = arcpy.GetParameterAsText(0) strFieldName = arcpy....
1
vote
1answer
32 views

Iterating through 2 different Geodatabases at same time using ArcPy?

I have 2 gdb's; one that contains a polygon feature class of census blocks(cb), and one that contains centroids that may lie within those census blocks. They are organized by state. Ex: FL_cb = ...
0
votes
1answer
35 views

Checking to see if database is there and delete if so using ArcPy?

I am looking for my python code to check for the polycheck.gdb and if it is there delete and create a new one. Also, I would like to set my workspace to that database. Not sure if this is the right ...
2
votes
1answer
26 views

Find gaps in spatial database based on attributes and fill those caps with new features with existing attributes

I have a big line shapefile data (over 2 millions features) showing animal movements. Simplified example: ID    Year    st_time     end_time&...