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
30 views

Creating tfb file in Python Toolbox?

What tool does: Simply creates tbf file from raster extent. What is the problem: I ran toolbox in ArcMap 10.5.1 and ArcGIS Pro 2.2.4. When I run it as standalone script it is working just fine. I ...
2
votes
2answers
126 views

Converting none to zero (0) in geodatabase table using ArcPy?

I have an attribute table looks like this How do I convert Nulls into 0? I've tried to set this table non nullable type but got this: while the official doc says this: At least one of them is ...
0
votes
0answers
26 views

Selecting multipatch features in multiple .gml datasets and exporting them as a shapefile

I have hundreds of .gml datasets containing multipatch feature classes that I want to export as shapefiles to a folder. The problem is that none of the List Functions can read them in .gml datasets. ...
0
votes
0answers
26 views

CAD To GeoJSON after publishing it shows the job failed

I have written the code for CAD to GeoJSON. When I ran ArcMap or ArcCatalog it's working fine, after publishing the code it's giving the error. The code is too long. Can you provide the code ArcGIS ...
0
votes
1answer
35 views

arcpy memory error while using ExportCAD_conversion

I try to convert CSV point data to DXF CAD data. CSV file has about 270,000 points. I searched this issue and it is because ArcGIS is 32bit, and Background Processing Tool 64bit software is required ...
0
votes
1answer
39 views

Configuring ArcGIS Desktop to use already installed Python instead of own installation? [duplicate]

Whenever ArcGIS Desktop is installed, it installs its own installation of Python 2.7 plus Numpy. Yet, I already have many different versions of Python installed in my machine and do not want to have ...
0
votes
0answers
28 views

Splitting polygon into smaller rectangular polygons that have user input dimensions (length x width) using ArcPy? [duplicate]

Given any irregularly shaped large polygon, I'd like to be able to subdivide it into as many (full) smaller rectangular polygons as possible (like a grid, but rectangular and with user-specified ...
0
votes
1answer
57 views

Tabulate Area Truncates Field Names in ArcGIS Pro?

I'm trying to use the Tabulate Area tool in ArcGIS Pro (version 2.2.1) to cross tabulate two rasters: one raster of zones (where value = true crop type) and a second raster is a supervised ...
1
vote
1answer
99 views

Converting LAS to TIFF using Arcpy - TIFFs writing out empty

I am using ArcPy to convert large batches of LAS files to GeoTIFF format. It seems like a lot of the data I have acquired from a particular source is giving me the same error: I am able to convert ...
0
votes
0answers
34 views

Using arcpy.ApplySymbologyFromLayer_management to copy symbology from input symbology layer to ArcGIS Pro layers?

I wrote script below to copy symbology from source layer to my all other layers generated in this script. It does generates output but when I add layer to the TOC, I don't see any symbology to any of ...
0
votes
1answer
74 views

ArcGIS Pro error 000732: “Input Layer: Dataset xyz does not exist or is not supported” when using arcpy.SaveToLayerFile_management

Below is the code I wrote in ArcPy in ArcGIS Pro. The layer from "arcpy.MakeFeatureLayer_management" is created (name changes in each iteration as "Layer_%s" %(FIPS)). But "arcpy....
2
votes
1answer
27 views

Understanding backslash in arcpy.SelectLayerByAttribute syntax?

I copied this line from Python code, but I don't understand the \" \" around the word District. arcpy.SelectLayerByAttribute_management(Community_areaFC, "NEW_SELECTION", "\"District\" = ...
1
vote
1answer
39 views

Coding Python about raster calculation for create a toolbox

I want to create a tool box in ArcMap. I wrote this code: # Import system modules import arcpy, os,sys from arcpy import env from arcpy.sa import * # Set input raster InputRaster=arcpy....
0
votes
0answers
50 views

Generating Points for each Shortest Path

Python code is: import arcpy arcpy.FeatureToLine_management("Closestroute", "Featureline", "0.0001 Meters", "ATTRIBUTES") #Generate points along lines for every 1 km arcpy....
0
votes
1answer
63 views

Assigning Name to Each Points

My python code : import arcpy arcpy.FeatureToLine_management("Closestroute", "Featureline", "0.0001 Meters", "ATTRIBUTES") #Generate points along lines for every 1 km arcpy....
0
votes
2answers
66 views

Concatenate fields (double and string) to create address using arcpy

fields: STNUM = double STRDIR = string STRNAME = string STRTYPE = string Tuple and s.format I have tried: arcpy.CalculateField_management (newparcelsUTM, "SiteAddress","{0} {1} {2} {3} ".format('!...
0
votes
1answer
13 views

Empty ShapeLength when running Insert Cursor for Polyline

I'm looking to create a new feature class using only selected data from a source feature class. I can get this to work but the ShapeLength field is 0 when I run this script and therefore the feature ...
0
votes
1answer
101 views

ArcPy module not found in PyCharm? [duplicate]

I have installed PyCharm Edu and am trying to run a python script calling on ArcPy. I get an import arcpy module error: However, when I use the python scripter in ArcGIS Desktop, I see that it is ...
0
votes
2answers
23 views

Displayng attribute text in layout Text element gives error: Error in setting text

I am new in Python scripting. I have a geodatabase with layer Test and this layer has field Name and Text element on layout named TEname. I am trying to show selected feature attribute Name value in ...
1
vote
1answer
72 views

Displaying attribute field value in TextElement gives AttributeError: 'list' object has no attribute 'text'?

I am new in Python scripting. I have a geodatabase with layer Test and this layer has field Name and Text element on layout named TEname. I am trying to show selected feature attribute Name value in ...
1
vote
1answer
39 views

UpdateCursor can't acquire lock, but can acquire lock in TestSchemaLock

import arcpy import os.path arcpy.env.workspace = "C:/Users/melis/Documents/HenryWork.gdb" arcpy.env.overwriteOutput = True buffer = "LS_buffer" landcov = "ForestLC_clip" #create search cursor to ...
1
vote
1answer
52 views

Copy files to a new folder if the file name matches value from a specific field in a feature class

I have this folder with bunch of .jp2 files, and from this folder I need to copy only the files that their name matches the value name from a specific field in a feature class. Right now I can print ...
0
votes
0answers
26 views

Table Query not working in Python

I have a Python script that I've created to run multiple processes, including a query table. There is one table and one feature class as part of the query. I've followed the syntax and inputs ...
0
votes
1answer
58 views

Arcpy Geocoding Script Fails (vague messaging)

Using ArcMap 10.6 to load a Python script that will geocode 25,000 addresses. It looks like it fail during the actual gecoding attempt with an error: ERROR 000010: Geocode addresses failed.Failed to ...
1
vote
0answers
38 views

Copying tables results in duplication of some tables, feature classes and relationship classes

ArcGIS Pro 2.2.3. I have a file geodatabase called "supportSource.gdb" with 3 tables, 2 feature classes and 3 relationship classes. I just want to copy the contents of this file geodatabase to ...
0
votes
0answers
17 views

Buggy intermediate datasets in map algebra

I created a for loop to perform a (simplified here) series of operations over tiles from a larger dataset. My initial code looked like this: ext_template = bingmean_odd totalextent = arcpy.Describe(...
1
vote
1answer
30 views

Conversion of CSV to DBF is getting error message, why?

My code import arcpy, os, shutil, re from arcpy import env arcpy.env.workspace = "R:\GIS_Data\Earthquake_Data\Updates\Eq_updates.mdb" path = r"R:\GIS_Data\Earthquake_Data\Updates" In_path = r"R:\...
1
vote
1answer
23 views

Setting scale for data driven pages

I'm trying to use DDP to produce a map book for a series of works. Each item of work is a feature in a polyline feature class, and a copy of the class is being used to define my DDPs. I already have ...
1
vote
0answers
33 views

Efficiently Searching MXDs for Folder Connection

We are currently trying to restructure some of the companies GIS data. It is located on an internal network drive (no SDEs). For each year, there are 1000+ MXDs with map layouts that still need to be ...
0
votes
0answers
32 views

Write a script to create a new feature class and add the point objects of geometry to that feature class

The coordinates of the vertices representing the street Kochstraße in Erlangen are stored in a text file called Koord_Strasse.csv. Write a script to create a new feature class and add the point ...
-1
votes
1answer
43 views

Selected location extract data into single KMZ file or Single zip file in ArcGISServer - Python Tool GP Service

I am trying to write the GP tool (Python script), To extract the data for selected location into KMZ file, Please check below code it's executing successfully but written the incorrect zip file ...
0
votes
0answers
21 views

Expression labelling to annotation - ArcMap to CAD

I have point feature layer (more than 100). My task is labelling that point and convert annotation (I use ArcMap) then export that to DWG format I use this script to labelling : mxd = arcpy....
1
vote
0answers
19 views

What happens to .dbf file with TableToDBASE?

I have been trying to use TableToDBASE without success. I looked at this help link: http://desktop.arcgis.com/en/arcmap/10.3/tools/conversion-toolbox/table-to-dbase.htm. The code runs fine but it does ...
1
vote
1answer
36 views

Exporting string and float variables to ASCII file using ArcPy?

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, ...
1
vote
1answer
80 views

Using Field Value as Search Distance Parameter in Select by Location in ArcPy? [closed]

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
23 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 ...
0
votes
1answer
37 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
32 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 ...
0
votes
0answers
38 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
27 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
33 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 ...
2
votes
1answer
138 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
26 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
32 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
226 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 ...
3
votes
1answer
88 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
57 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
37 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
35 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
37 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 ...