Questions tagged [arcpy]
A site-package created by Esri to expose ArcGIS Desktop (ArcMap and ArcGIS Pro) geoprocessing, mapping, etc, to Python.
10,577
questions
1
vote
1
answer
50
views
What's wrong with my SQL? Invalid Expression
I'm just trying to make it where the user types what county they want and the script selects those features.
import arcpy
County = arcpy.GetParameterAsText(0)
arcpy.env.workspace = (GDB path)
...
1
vote
1
answer
841
views
Running ArcPy on PyScripter with ArcGIS Pro
Having PyScripter 4.0.0.6 x64 installed with ArcGIS Pro 2.5 I have set the
I have add/set the arcgispro-py3-clone to Python Path like below
but I am still getting this error message
Traceback (most ...
0
votes
1
answer
215
views
ArcPy scripts input/output [closed]
I have an ArcPy script, which I use with ArcGIS Pro. I use one feature class as input_feature, do some calculations and write results in another feature class (output_feature).
Is it possible to use ...
2
votes
0
answers
291
views
Disconnect users who are creating locks on specific feature classes
I have a nightly Python script which updates some domains in a geodatabase. The domain owner is "AMIS". In addition to the AMIS schema in the geodatabase, there are other schemas. In order ...
1
vote
1
answer
178
views
PackageMap script failed to execute in IDLE but runs in ArcMap Python window?
This runs in the ArcGIS Python window but not from the IDLE command prompt.
import arcpy
import os
from arcpy import env
env.overwriteOutput = True
arcpy.env.workspace = "D:/Production/...
4
votes
2
answers
499
views
Error: 'list' object has no attribute 'segmentAlongLine'
I am trying to trim each polyline in a shapefile down to the first 15 feet of each line. The segmentAlongLine method was suggested to me, but this code is getting the AttributeError: 'list' object has ...
0
votes
2
answers
264
views
ArcPy exporting maps to PNG problem - raster DEM does not show up in exported map file
I sm using ArcGIS Desktop (ArcMap) 10.8.1 and PyCharm 2020.3.3.
I'm trying to use a simple script to loop through a folder and export a PNG file for each MXD in the folder. The script works fine, and ...
1
vote
1
answer
297
views
ArcMap 10.6; ERROR 000539: Error running expression: rcexec()
While running a tool box (connectivity index) I am receiving an error at the end; ERROR 000539: Error running expression: rcexec()!.
Can anyone help me with it?
1
vote
1
answer
298
views
Moving points 5 feet "downstream" along polyline using ArcPy
I've got a bunch of points that currently sit at the origins of a bunch of different lines. I need to move every single point 5 feet "downstream". I'm using ArcMap without an advanced ...
2
votes
1
answer
201
views
Remove a Row in an attribute table using UpdateCursor?
I'm trying to create a piece of code to remove rows where the field "State_Name" equals Hawaii or Alaska from my shapefile's attribute table. I've tried two different codes and they both ...
1
vote
1
answer
130
views
Moving Python script 10.3 to Pro. How do I know the script ran in Pro and not 10.3?
I have inherited a Python script that mosaics many files in 10.3. I normally run using IDLE outside 10.3.
I don't code at all but am trying to learn so I can move the code to ArcGIS Pro to ensure we ...
1
vote
1
answer
189
views
Using Python or ArcPy to extract usable shapefile data from several hundred MXD files
I have several hundred (potentially more) old MXD files which were made to show grass areas to be cut along city roads. The employee before me opted to do these one by one and rather than create ...
0
votes
1
answer
323
views
Clipping multiple shapefiles using ArcPy
I am fairly new to Python.
I created a folder with 4999 bufferfiles. Specifically, there 5km radius buffer circles, and I am trying to use the clip function with the already made bufferfiles to clip ...
1
vote
2
answers
88
views
ArcPy.da.SearchCursor not cursor-ing
I am using ArcMap 10.8.1.
I have shapefiles that are a series of overlapping polygons of drone imagery footprints. I want to loop through each shapefile, and for every shapefile loop through and ...
1
vote
0
answers
146
views
Loop through folder and join pairs of files with the same prefix
I have two sets of shapefiles that I would like to join based on a similar field. They are all stored in a path folder which is stored as the variable "steps".
One group of shapefiles are ...
1
vote
1
answer
162
views
What is the field_map_name in findFieldMapIndex ()?
I am using ArcPy with ArcGIS Pro and FieldMappings.
FieldMappings are fiddly and I'm struggling to understand a specific function.
I need to replace an 'old' fieldMap with a 'new' fieldMap. FieldMaps ...
0
votes
0
answers
106
views
Set a workspace inside a multiprocessing function inside a toolbox in ArcGIS Pro
I am trying to set a workspace inside a multiprocessing function of an ArcGIS Pro toolbox.
It works perfectly in standalone script, but when I use it in a toolbox I get this error message:
...
1
vote
2
answers
159
views
Outputting bookmarks in TXT file from ArcMap using ArcPy
The only output format permitted by the ArcMap bookmark manager (v10.7) is an "ArcGIS place file (*.dat)" which is not entirely human-readable when opened in a text editor.
What is the file ...
1
vote
1
answer
187
views
Dynamically update index layer for Data Driven Pages using ArcPy/Python
Is there a way to dynamically pull in a new index layer for a data driven page in ArcMap?
Scenario: I have an MXD which will be my template. I am trying to update the index layer dynamically in Python....
0
votes
1
answer
47
views
Exporting 3 layers together as JPEG using Data Driven Pages
I'm trying to use data driven pages to export JPEGs of features that share a common attribute.
E.g. I have two point layers, "beach" and "light". And a polyline that connects them, ...
0
votes
1
answer
2k
views
Python script to import CSV data to a geodatabase
I am trying to import CSV data into an existing geodatabase in ArcMap. I want to import to the existing geodatabase fields to ensure my CSV data satisfies whatever rules are set up in the geodatabase.
...
1
vote
1
answer
302
views
Select layer by location in ArcPy ERROR 000368 [duplicate]
I am trying to create a scrip that create a list of all features in my GDB, then select objects that intersect with a user given shapefile, and finally copy selected features to a new location. After ...
1
vote
2
answers
100
views
Split contents of dBase text field into words at " ", "-" or "_", capitalise first letters, and replace " " with "_"
A shapefile field has text with words separated by blanks " ", dashes "-" and underscores "_". I want to standardise the words to capitalise each word, and then replace ...
0
votes
1
answer
39
views
Adding representation rule by object's attribute value in ArcPy
I want to add a representation rule for each object in a FeatureClass with ArcPy.
I have 3 rules (B, F, T) as seen in the picture below:
I know there is a command for it
representation = "...
3
votes
1
answer
324
views
Using ArcPy to get point from a cursor for input in arcpy.PolyLine()
I am using ArcGIS Desktop 10.8 Basic. I do not have access to a Standard or Advanced license for this.
I want to use a point from a search cursor as an input for the arcpy.PolyLine() method. A second ...
2
votes
2
answers
695
views
Getting CSV export to have different delimiter using ArcGIS Pro
ArcGIS Pro, using Table to Table tool, I want to export to CSV. But one of my fields is a description field that often has commas in the content. When that is exported to CSV that uses commas as ...
0
votes
0
answers
54
views
Modifying string in python snippet with an object
I am using arcpy to reproject a multidimensional raster, and I extracted the following snippet by running the tool in ArcGIS pro. This is the snippet:
arcpy.management.ProjectRaster(input_file_path, ...
0
votes
1
answer
44
views
Drawing complete graph in ArcMap
I want to draw a complete graph for these points with coordinates.
In an ArcMap environment, can a complete graph be drawn with points?
3
votes
1
answer
1k
views
Cannot find cloned python arcgispro-py3 environment with conda env list
I am trying to clone my python environment that comes with ArcGIS Pro (arcgispro-py3 located in C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3) to a location I can access (I do not have ...
0
votes
0
answers
146
views
TableToTable (CSV to GDB) with WKT column
I have a CSV file with a WKT column with LINESTRINGS as geometry.
How do I setup the call to TableToTable() in order to directly "transform" that WKT column to a shape/geometry column (while ...
0
votes
1
answer
86
views
arcpy.FieldMappings renames input fields internally
I'm trying to make use of Field mappings to merge many datasets into a new one... as per the manual.
...
print (type(idealFieldList)) # class 'list'
# let's prune the fluff
...
1
vote
2
answers
744
views
Using ArcPy UpdateCursor to Update a field
In my data I have one field (L1_SOILTYP) and a new field I created (SoilClass). I am trying to use update cursor to assign classification values (1-17) based on the values found in the L1_SOILTYP ...
0
votes
1
answer
160
views
Resampling multiple images in ArcPy
I'm to resampling about 30 raster images to different resolution (2, 3, 4, 5 meters) using the ArcPy. I wrote the code but its giving result for one image.
Here is the code:
import arcpy, os
arcpy....
1
vote
0
answers
97
views
Arcpy SpatialJoin performed in_memory not returning any rows
Background: I am writing a tool to automatically project a layer (vector or raster) in ArcGIS Pro to its appropriate UTM zone.
Approach: The entire UTM zone grid is stored in a geojson string inside ...
0
votes
0
answers
111
views
Modify blob representation field data with ArcPy
I want to modify the data stored in the "Override" blob type field in ArcGIS 10.7 with ArcPy.
When I use the search cursor, it finds nothing:
data = row.getValue("Override")
if ...
5
votes
1
answer
244
views
Unable to process batch buffer using ArcPy
I'm trying to buffer multiples files at once using ArcGIS. My code looks correct until the last line where it returns error related to buffer tool. I've used this code.
import arcpy
import os
from ...
1
vote
0
answers
34
views
Process 100 of feature classes through script and fc name to end of each output
I have about 100 tiled 'area of interest' polygons in a geodatabase that need to be processed through my script. My script has been tested on individual tiles & works great. I need advice how to ...
1
vote
2
answers
63
views
Adding variable number of layers with associated buffer distances with ArcPy for ArcGIS Pro
I am using ArcGIS Pro 2.7.2
I am not an experienced python programmer. My goal is that the user can select a various number of layers in the python tool and specify different buffer distances for each....
1
vote
1
answer
270
views
ArcPy insertRow asking for a sequence of values
I've got code that pulls the center point from a layer, and places it in a new feature class as part of a more complex analytical process.
I'm trying to get the centroid written to an in_memory ...
2
votes
0
answers
773
views
UpdateCursor cannot acquire lock if attribute table is opened in ArcGIS Pro
I wrote a script tool for someone to allow them to clean all whitespace errors (leading/trailing spaces, 2+ consecutive white spaces, convert empty strings to nulls), and aside from one issue it works ...
0
votes
1
answer
284
views
Batch clipping all files in folder and then save using ArcPy
I'm trying to use a script to batch clip all files in a folder, then saved with a _clipped.shp at the end of the original, I need a script that is something like this:
arcpy.env.workspace = "E:\\...
4
votes
1
answer
741
views
Setting Halo property of label using ArcPy and CIM
I don't know how to set halo property in Python. I try it by CIM (code below) but I don't know, what line "lc.textSymbol.symbol.haloSymbol" should contain.
Can you advise me how to achieve ...
0
votes
2
answers
47
views
Convert COVID data into data points using ArcGIS Pro
I am trying to create a script that takes Covid-19 data in a CSV file format and put it into a ArcGIS Pro project using ArcPy. Here is my code. However, I am getting an error saying the parameters are ...
1
vote
2
answers
1k
views
Creating a Polyline from a CSV File
I am creating a shapefile based on three columns in my CSV File - Latitude, Longitude, and Laps. For the most part, I understand how to loop through the data and create the many points based on the ...
0
votes
1
answer
146
views
ArcPy RasterUniqueValueColorizer not working correctly
I have a raster layer which consists of unique values 0-4 and I want to color them through ArcPy.
I have tried this:
import arcpy
import os
arcpy.env.overwriteOutput = True
from arcpy.sa import *
#...
1
vote
1
answer
164
views
Getting runtime error from AddFields using ArcPy
I'm add fields via arcpy code as follows;
import arcpy
arcpy.env.workspace = "C:\Users\sheartz\Documents\NBspray_1952.shp"
arcpy.AddField_management(
'NBspray_1952',
[['area_ac', '...
0
votes
1
answer
164
views
How to access and modify properties of one single layer with ArcPy
In General
I have to access and modify a specific property, e.g. data source, of one specific layer with arcpy. I know the name of the mxd-file, the dataframe and the layer. How can I access, for ...
0
votes
0
answers
23
views
Calculating ratio between rows using ArcPy module [duplicate]
I want to calculate the ratio between the rows (i.e., row1/row2, row2/row3 and so on..) of the 'Frequency' column based on the 'Id' column and want to assign the values to a separate column. As ...
1
vote
2
answers
115
views
Extracting value from three different raster for same pixel/position as CSV or tabulated dataset using ArcMap
I have computed Hydrologic Sensitivity Index (HSI) as a raster for a region using slope, Hydraulic conductivity, Depth to the Restrictive Layer and Flow accumulation. All the files are in rasters of ...
0
votes
0
answers
25
views
How print nearest object?
I have point on map. I want found nearest object. Code works perfect. System show 1 occurence. But how get it?
point = arcpy.Point(5285360.478599999, 5310336.491400003)
ptGeometry = arcpy....