Stack Exchange Network

Stack Exchange network consists of 174 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.

0
votes
0answers
6 views

Problem to export string and float variables to an ASCII file

I am trying to create a script using arcpy to automate a serie of task in ArcGIS. What I am trying to do is to interpolate rainfall data from a region and then, using hydrological basinshapefiles, ...
0
votes
0answers
12 views

Exception handling in ArcPy? [on hold]

I am trying to add error handling to existing code. All I could come up with is the try-except block at the end. Any suggestions where I could improve the error handling for this existing code which ...
0
votes
1answer
48 views

Arcpy - Using a Field Value as the 'Search Distance' Parameter in Select by Location()

I've been trying to use the select layer by location tool in a loop to select features that are within a specific distance to one feature class for each feature in a different feature class (each ...
0
votes
0answers
8 views

AddRastersToMosaicDataset_management performs slow

I have an enterprise Geodatabase (SQL Server) on my ArcGIS server machine. I perform my computations on several rasters on another machine (80 *.tif s with mean size of 50kb). When I want to add the ...
-1
votes
0answers
20 views

add layers shown in Table of content as a input parameter [on hold]

I want to add layers shown in Table of content as a input parameter to a script which I written in python language.Can anyone help me to do this?
0
votes
1answer
25 views

arcpy - decimal value for labelling

i have field named (depth) in feature class (point) with this spec : float - 5 digits >>> 0.7186 or 0.9695 i create new field named (depth_new) with field calculator : round([depth],1) the ...
0
votes
1answer
18 views

Changing label placement (anchor point) using ArcPy?

arcpy let user automatically turn on the label, use label expression to save our time. is there a way how to change the position of the label like we use to do on label properties like screenshot ...
-2
votes
0answers
15 views

Need code to show the only the label adjacent to the extent indicator [on hold]

Does anyone have a code to show only the label adjacent to the extent indicator in an inset map for a mapbook from page to page? I need to have 20-30 page outlines on the inset map, but only want the ...
-2
votes
0answers
24 views

Using cursors to access data and geometries? [on hold]

I need to write a script that returns and prints the name and OBJECTID number of all river segments (features) of the "fluesse_ER" feature class with less than 100m of length. Use a with statement to ...
0
votes
0answers
30 views

label expression eror - arcpy

I want to use arcpy to turn label on, for all of my layers in current mxd with label expression VBscript I use this script with simple label expression and it works mxd = arcpy.mapping.MapDocument("...
0
votes
1answer
20 views

Checking for raster coverage within polygon feature class using ArcPy?

I'm writing a Python toolbox and would like to build in a check for raster data within the user-supplied area of interest. This piece of code works most of the time: if (str(arcpy....
1
vote
0answers
22 views

Appending polygon features from file geodatabase table to SDE table?

I am facing an issue while appending the feature class to ArcSDE feature class. All the I am trying to append the gdb feature classs data, I can see that the geometry is either changed and some cases ...
1
vote
1answer
19 views

Getting IndexError: list index out of range from arcpy.mapping.ListLayers() in Python Window of ArcMap?

i want to turn on label using arcpy, i use current mxd and my mxd path in my script and my layers also active in the current MXD, but it give me this eror, can somebody help me? here the script i ...
0
votes
1answer
24 views

Getting TypeError: <type 'str'> from arcpy.mapping.ListLayers()?

I want to do simple task, using arcpy to turn on the label, I use this code (I'm googling it and change the path with my own mxd path) but it failed and returns an error. import arcpy mxd = arcpy....
1
vote
1answer
20 views

Renaming layer in multiple maps in ArcGIS Pro with ArcPy?

Running ArcGIS Pro 2.2, I have a layer in ~20 maps that needs it's name changed. I pulled this code together from a bunch of snippets, and have done my best to make sure it's updated appropriately, ...
11
votes
3answers
188 views

Is it necessary to delete a cursor used in a comprehension?

If it is best to open cursors using a with statement to ensure it is deleted, like so: with arcpy.da.UpdateCursor(fc,fields) as cursor: Then, if a cursor is used as the iterable in a comprehension ...
0
votes
0answers
23 views

Arcpy.Describe extremely slow [closed]

I'm trying to open a gdb which contains several feature layers using these few lines: da.Walk(gdbPath, datatype="FeatureClass") - to get the names of all feature layers in the gdb. arcpy.Describe(...
-1
votes
0answers
16 views

Showing Specifice field in Combobox, text box or list box using ArcPy? [closed]

I want to make identity tool when I click the polygon then show me the result specific field in list box , text box or combobox. I need the scripts in python.
3
votes
1answer
48 views

Importing from CSV and changing projection using ArcPy?

I'm attempting to convert CSV files to a group of shapefiles, then re-project them to a different coordinate system. The first conversion works, but I'm having issues with the projection piece. ...
2
votes
1answer
53 views

Prevent script to stop when there is an issue with a .shp file

I am trying to iterate through all my shapefiles to check if they have a coordinate system assigned or not. The script works fine and iterates through most of my .shp files, however some files seem ...
0
votes
1answer
32 views

Selecting points in polygon in a range of time (ArcGIS)

I have: - point GPS for people (time in seconds) - buffer GPS for a car (time in seconds) What I want to do is for each buffer GPS coordinate, I want to find the number of GPS people points inside ...
0
votes
1answer
32 views

Using an SQL Query to skip or run a code in ArcPy/ Python

Using ArcMap 10.4 and Python I am trying to run a code (arcpy.ExportReport) on a bunch of different frequency tables. Which I have completed the only problem is that if I have a table that does not ...
0
votes
0answers
35 views

Implementing if-then-else logic for number of points or area greater than x

I wish to alter this script (see below) that I use in model builder to choose which analysis to run next. I want to make "is state plane" process to run if "number of points (shapefile) is equal to or ...
1
vote
1answer
39 views

Projecting shapefile of point geometries?

I am trying to creating a point shapefile that lies within polygon(a feature layer). By creating point geometry objects and filtering the ones that fall within the polygon(feature layer), I created a ...
0
votes
1answer
35 views

Converting from Boolean to point features using ArcPy?

I used geometry objects and da.searchCursor to check if randomly created points fall within polygon. Now I get True and False of each points that falls within or outside of the polygon. I made a list ...
0
votes
1answer
19 views

Geoprocessing server tool result has no internal record set object for Save

I'm working with the geoprocessing server tool (GenerateOriginDestinationCostMatrix) imported as a toolbox (OriginDestinationCostMatrix) in ArcMap 10.6. Being asynchronous I use the resultID with ...
0
votes
1answer
52 views

Updating attribute table of base shapefile from .csv file?

I am new to python programming. I am trying to create a script that can update attributes in a base shapefile based on a .csv file when changes are made to the .csv file. I also want the script to ...
1
vote
3answers
63 views

Searching for NULL values in feature class table

I am looking for a way which I can search whole my feature class in ArcMap to find if has any NULL values on it. I know how can I do this with "Select By Attribute", but I am looking for a faster way ...
0
votes
1answer
21 views

Adjusting multiple text elements in multiple mxd files?

I am trying to make changes to titles on multiple mxds instead of having to open 1 by 1 but it is only making changes to 1 mxd file, I have even tried to make duplicate copies of the mxd to test but ...
0
votes
0answers
27 views

Updating/modifying Network Dataset roads source in Enterprise Geodatabase (ArcSDE) using ArcPy?

I am trying to create a Python script that automate the update of roads source used in a network dataset stored in a Enterprise Geodatabase (SDE). In short, I want to truncate the roads feature class ...
1
vote
3answers
81 views

Linearly comparing one point to all points within 20' foot area, for every point in dataset using ArcPy?

I have a very large dataset of GPS point that I am trying to write a python script for that will linearly compare one points to the ones around it. Original I was using the ID to determine which point ...
0
votes
1answer
28 views

Populate field with result from a function?

I want to make a new column in every shapefile using for loop and populate that column using a function. #the function def find_folder(fn, k=-2): return os.path.split(fn)[0].split(os.sep)[k] I ...
1
vote
2answers
41 views

Adding shapefile to multiple MXDs using ArcPy?

My ArcMap verison is 10.6. The purpose is to add a wetland shapefile to multiple MXDs. It doesn't work and the error said the addLayer is not defined. My script is below. Does anyone have an idea? ...
1
vote
1answer
26 views

Printing name of each layer in mxd using ArcPy?

My ArcMap verison is 10.2. My goal is to print the name of each layer in a mxd using Arcpy. My script is below. There is no error, but it prints the first layer multiple times instead of all the ...
0
votes
1answer
28 views

ArcMap “Polyline to Raster” output is empty greyscale raster

I have a polyline shapefile of streams that I am attempting to convert to a raster using the "Polyline to Raster" conversion tool. However, rather than outputting a raster with distinct stream pixels, ...
-5
votes
0answers
38 views

Which python library is best to use all GIS tools in python only? [closed]

Which python library is best to use all GIS tools in python only?
1
vote
1answer
32 views

Merging on specific fields

Lets say I have three shapefiles/features I want to merge: 'florida.shp', 'mississipi.shp' and 'louisiana.shp'. They all have 3 standard fields common to all: 'DFIRMID', 'SFX', and 'FIRMPAN'. I want ...
1
vote
2answers
33 views

Altering text elements in multiple mxds?

I am trying to make changes to titles on multiple mxds instead of having to open 1 by 1 but keep getting an error. import arcpy.mapping as mapping, os for root, dirs, files in os.walk(r"F:\Final ...
1
vote
1answer
12 views

Text element name not appearing in ListLayoutElements

As in the title, I have the simple below code: import arcpy arcpy.env.workspace = r"U:" mxd = arcpy.mapping.MapDocument(r"U:RAFT.mxd") layoutlist = arcpy.mapping.ListLayoutElements(mxd, "...
0
votes
0answers
16 views

Use ArcPy to rotate point symbol in layer file

I have a shapefile in a layer file with point features. I want to use ArcPy to rotate the symbols of these points with an angle in a column in the attribute table. I can do this manually under "Layer ...
0
votes
1answer
62 views

Buffering a line

I would like to construct a feature class consisting of every polygon in the landuse shapefile entirely within a 300 Feet buffer of the Road. But I always get error of C:\Road300 does not exist or not ...
1
vote
1answer
59 views

arcpy.da.searchCursor - need to go through all records, but only go through one. What am I missing?

My script supposed to go through all rows in one dataset, fl1: select one row at a time, based on that selection, select spatially from another dataset, fl2 if spatially identical records were found,...
0
votes
3answers
37 views

Making one field/values equal to another field/values

Lets say I have created a new field called "SFX" in a shapefile called "myshape.shp": input = r"C:\files\myshape.shp" arcpy.AddField_management(input, "SFX", "TEXT", field_length=100) There is now ...
0
votes
1answer
26 views

Capturing specific error instead of arcpy.ExecutionError?

How can I specify this script to capture specifically the error 001566, instead of the current general execution error? Error 001566:Failed to create raster dataset. The reason could be: The ...
0
votes
0answers
34 views

Adding field to middle of attribute table using ArcPy? [duplicate]

When executing the add field command in arcpy it always appends the field at the end of an attribute table. Can someone help me write a code where a field can be inserted in the middle of an ...
0
votes
1answer
33 views

Batch Dissolving FC into New FCs based on Field Name using ArcPy?

I am trying to take a FC, export individual FCs based on fields in the original FC, and have the new FCs dissolved. I found a Python script that works and modified it for my use - see below. # ...
0
votes
2answers
40 views

Automating Select by location using ArcPy and where_clause?

I have used the code in Coding python loop to select features of polygon layer than are completely contained in group of 11 layers using ArcPy? to automate select by location analysis using ArcPy. I ...
0
votes
1answer
24 views

Adding Greek letters in existing columns in ArcPy?

Example table: colA colB colC 173743 01 8974 173443 02 8934 173943 05 8924 173243 01 8994 173343 03 8964 I want to pass to the third column: The 3 first numbers from the ...
0
votes
0answers
55 views

Failing to read shapefiles in folder using ArcPy?

I want to use create random point tool on list of shapefiles, but keep failing to list the shape files. My code stops at line (print fcList); and gives me "None" as output. Is it because of the ...
1
vote
1answer
68 views

Looping Eliminate tool in Python?

I am very new at Python,I'm not sure if this is even the appropriate way to do what I want to do, but basically, I'm looking to eliminate all of the small polygons in a feature class that was created ...