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
5 views
Compact_management making spatial index invalid? [on hold]
I am compacting file geodatabases and afterward I am having trouble drawing lines linger than about 12000 feet without getting "Invalid Spatial Index". The Esri documentation does not say anything ...
0
votes
1answer
31 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.
...
1
vote
2answers
24 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....
-1
votes
0answers
54 views
ERROR 001020: Input series error. Input series parameters are not complete?
I am creating graphs using ArcPy and facing this error while I give the input layer from the mxd.
In case, if I give the input from direct shapefile, then graphs are generated.
The code I have ...
0
votes
1answer
14 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 ...
3
votes
1answer
50 views
Performing operations on tool`s startup
I want to perform a selection on tool startup in order to obtain a choice list for parameter derived from selected features. Code kinda works, as I get my choice list with correct values, however it ...
1
vote
2answers
231 views
Using 'if' function to set field value based on various other field values gives ERROR 999999?
I am trying to populate a field with a value from another field in the same row, the condition I have set for this to take place is if a third field is equal to 0. In order to achieve this I have ...
1
vote
1answer
550 views
Running ArcGIS Model tool from Python script?
I've broken a complex task down to a very simple exercise and still can't get it to work... I need to set up a Python Script to Run a Model.
model: "SelectTest"
toolbox: "INTEGRITY_TOOLS.tbx".
...
0
votes
0answers
38 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
...
2
votes
1answer
564 views
Issue with arcpy.MakeFeatureLayer_management in tool
I have created a python toolbox that creates separate layers based on unique field values within a feature layer. For some reason arcpy.MakeFeatureLayer_management will create the layer but will not ...
3
votes
1answer
472 views
Changes not persisting in ArcGIS server from ArcPy script?
I have a ArcPy script (10.2) which connects to an ArcGIS server (10.0) versioned geodatabase, via an .sde connection file in the Database connections directory through direct connect on a Microsoft ...
7
votes
0answers
466 views
Automating creation of ServiceDefinition from Python script tool of ArcPy without broken project data source? [closed]
Summary:
I can create a ServiceDefinition through ArcCatalog or ArcMap, but when I try to generate the ServiceDefinition through python, it does not copy the /data folder with it, thus the script ...
-1
votes
1answer
731 views
Setting up parameters in Python Toolbox tools? [on hold]
I used ModelBuilder to build a model and I exported it to python.
How can I define parameters for Python script in Python properties?
Can you explain about data type in script properties?
1
vote
0answers
16 views
ArcGIS Python Add-In Extension - how to make it 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
33 views
Collections.DefaultDict(list) : Why is my data 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
3answers
911 views
Python script for calculating the area of a polygon
I am looking for a python code for this polygon. I need to calculate the area inside this polygon and I am new to programming. (Very new). Can anybody assist me with this? I have to use a python ...
1
vote
1answer
23 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 ...
3
votes
0answers
44 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 ...
1
vote
1answer
28 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
15 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
19 views
GIS Shapefile to CAD dwg using arcpy [on hold]
I'm trying to convert a ArcGIS shapefile to CAD dwg format using arcpy
But having trouble with my code
Anyone done anything similar ?
0
votes
2answers
45 views
Specifying Resource Field For Labeling in ArcPy?
How do I specify which field acts as resource for labeling a layer using ArcPy?
Following code is some settings that I am doing on a stand alone ArcPy snippet and as you can see I added layer....
0
votes
1answer
17 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 ...
1
vote
1answer
38 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 ...
0
votes
1answer
58 views
Importing CSV to shapefiles using loop? [on hold]
EDIT - Code now runs correctly. I wasn't able to properly indent "arcpy.AddField_management" here for some reason; move it two spaces to the right if you use this code.
I'm adapting this code to ...
0
votes
0answers
26 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
1answer
23 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 ...
2
votes
1answer
197 views
Make Feature Layer from Query Layer yields an ArcPy error?
My project starts from a MXD containing Query Layers. I have to prepare the data in this "MasterMXD" for use in an offline application. Working with ArcMap 10.2.1 for this project. My Python script ...
0
votes
0answers
18 views
Updating field in attribute table based on values in another field [on hold]
I am working in Visual Studio to create script tools that will run in ArcGIS Pro.
I am trying to populate a newly created field (Field2) in an attribute table based on the values from another field (...
0
votes
1answer
36 views
error on arcpy.FeatureSet() load from feature service: cannot open table for load
I am trying to pull data from a feature service into a feature set, and the following was working perfect:
fsURL = baseURL + query
fs = arcpy.FeatureSet()
fs.load(fsURL)
but all of a sudden, this ...
0
votes
0answers
12 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
184 views
Arcpy Error 010423 when using Zonal Statistics to Table in a tool
I want to include Zonal Statistics to Table to my tool. But if I do I get the following error:
Traceback (most recent call last):
File "C:\Users\xyz\Desktop\test.py", line 16, in <module>
...
1
vote
1answer
29 views
Dissolving points produced by GeneratePointsAlongLines_management tool in ArcPy?
The tool Generate Point Along lines generates points equal to the number of adjacent touching lines. For example, for 3 lines emerging from a point, the number of points generated would be 3.
How do ...
2
votes
0answers
29 views
Check Geometry - Bad Envelope
I have a polygon feature which returns Bad envelope when run through the Check Geometry tool.
According to the help:
Bad envelope : The envelope does not match the coordinate extent of
the ...
1
vote
1answer
21 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 ...
0
votes
0answers
9 views
Creation of multiple Referenced Mosaic Datasets with different names and coordinate systems
I am trying to create multiple Referenced Mosaic Datasets with different names and coordinate systems based on 1 source mosaic dataset.
My code is as follows:
# test referenced mosaic dataset ...
6
votes
3answers
2k views
Using arcpy.ExportMetadata_conversion?
I don't know if it is a bug or my lack of python skills, but I keep getting 'ERROR 000816 The tool is not valid' in my python script when I call ExportMetadata_conversion
Initially, I was attempting ...
2
votes
1answer
58 views
XML Document points to wrong location after using arcpy.BatchProject()
I'm trying to reproject a number of shapefiles representing contours from NAD_83_Albers to NAD_83_UTM_Zone_9N using arcpy.BatchProject(), but I have to use python/regex to preserve a particular file ...
12
votes
1answer
4k views
Creating table containing all filenames (and possibly metadata) in File Geodatabase?
I need to create a metadata-table for all files in a File Geodatabase.
Is it possible to automatically be updated with new filenames, and possibly even metadata (as created in the ArcGIS metadata ...
0
votes
1answer
26 views
MetadataImporter_conversion lags on first iteration of a loop [on hold]
I have a Python script that is looping through a list of feature classes stored in a config file. It is exporting the metadata for each feature class using the methodology in the answer posted to ...
1
vote
1answer
283 views
Using Python to create xml metadata files for different file types
I have a folder with 3 subfolder, each having a different type of data. Folder_A and Folder_B have standard shapefiles (about 3 shapefiles in each folder). Folder_C has .tif grid files (about 100). I ...
0
votes
1answer
426 views
TypeError: unhashable type: 'dict' when using shapefile with arcpy_metadata module
I am having an issue with the arcpy_metadata module. I have a simple shapefile I am trying to load into the MetadataEditor:
import arcpy, os, sys,env
import arcpy_metadata as md
myfeatures = "C:/...
2
votes
1answer
38 views
Editing shapefile Item Description > Summary in ArcPy?
Is there a way to edit a shapefile's Item Description > Summary in ArcPy?
I can right click on the shapefile in catalog, select Item Description, then click edit... but I want to automate this in ...
0
votes
0answers
13 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 ...
0
votes
0answers
19 views
Selecting layer by attribute in Python Toolbox of ArcPy?
I have this code where te input parameters are a shapefile [param0] and a string list [param1]. The second parameter is a list because I want that user select it.
class Tool(object):
def __init__(...
10
votes
5answers
10k views
Setting up PyCharm to reference ArcPy?
How would I setup PyCharm to recognize import ArcPy?
I'd like to use PyCharm to develop and debug geoprocessing tool.
1
vote
2answers
1k views
Setting up ArcMap to debug scripts in PyCharm?
I'm wondering whether anyone succeeded at setting up ArcMap to debug python scripts in PyCharm. I've tried several times to configure both, but failed.
2
votes
2answers
51 views
Locking stand alone ArcGIS Tool?
I have written a number of standalone Tools for ArcMap.
These tools are all .py files and are run outside of ArcMap. At the moment it has only been me running these tools, but I have been asked to ...
1
vote
1answer
40 views
Is Geometry object intersect faster than Intersect_analysis in ArcPy?
I have a script attempting to identify Many-to-Many matches between two different parcel layers. It is an iterative process, during which I dissolve the selected polygons in layers A and B, intersect ...
0
votes
1answer
44 views
arcpy.AddGeometryAttributes_management throws error: error in executing tool
I am trying to add XY extents to point and line features using the arcpy.AddGeometryAttributes_management tool, but it throws an error:
RuntimeError Traceback (most ...