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
1
vote
2answers
36 views

ArcPy Tool Validator error with defined parameter value

I am using ArcMap 10.3.1. I have two parameters for my script tool. The first is the type of product to be created, the second is the scale of the product. Digital Map / No scale required are the ...
0
votes
0answers
16 views

Join fields from multiple shapefile in a folder to one shapefile

I have 39 shapefiles in a folder with each shp having 368 attributes. Every shapefile has the same attribute name (FID, pointid, grid code and 365/366 others; depending on them being leap year). I ...
1
vote
1answer
124 views

ArcPy - List layers and list fields in one code

I am trying to combine ListDataframes, ListLayers and ListFields in one ArcPy code. I can do it one by one (first list layers in one code, and then list fields in second code), but I am trying to do ...
3
votes
2answers
114 views

What is the benefit of the arcpy function GetParameterAsText?

What is the benefit of the arcpy GetParameterAsText function? I know that its purpose is to return parameters as text but what is the real benefit?
1
vote
1answer
45 views

Improving ArcPy script for ArcMap to only return rows of selected polygons instead of all polygons in layer

I am debugging a code provided to me that merges two polygons and alters the fields of "FID1' and "CALC_AREA." I have realized that the current code searches every layer in the map document for ...
0
votes
1answer
31 views

Adding current row in arcpy.SearchCursor to selection

I want to make a code that select all unique values of a field in a attribute table. However, while everything in the code apparently works, I don't know how to add the current row in the Search ...
0
votes
1answer
42 views

ArcPy publish large map throws ERROR 001269: Compressing the service definition failed

I have a .mxd file with more than 1.3 million features that I would like to publish as ArcGIS map service using Python. When I publish the map manually from ArcMap, it works fine and it appears in ...
1
vote
0answers
42 views

Using script parameter validation in ArcPy

I am developing a script to Add, Delete, and Update rows within a table. The script basic function works well using InsertCursor and UpdateCursor. My questions or troubles come when I attempt to use ...
1
vote
1answer
61 views

Creating CON.shp in ArcPy gives ERROR 000732

I am creating bunch of point shapefiles by using watershed boundaries in a loop import arcpy from collections import defaultdict geo_db = 'C:\\CHIA_Routine\\CHIA_Watersheds.gdb' smis_wq_resultsXY = ...
0
votes
1answer
48 views

Loop through input and erase features arcpy.Erase_analysis()

I am attempting to loop through two folders, one of input files (watershed polygons) and erase features (area boundaries) using arcpy.Erase_analysis Here is my current code: in_cover = "G:/Files/...
1
vote
0answers
32 views

Calculate field using a field from another feature class

I have two feature classes, both of them are line features. I'm trying to the traffic count field (AADT) in the Road FC into the Bridges FC based on the distance between the two FCs, this distance ...
1
vote
1answer
75 views

“RuntimeError: Invalid Pointer” error when trying to export raster

I am trying to create an NDVI image from a Landsat 8 tif image, but I'm having trouble figuring out how to export the NDVI image without getting the "Invalid Pointer" error. I'm working with IDLE (...
2
votes
1answer
61 views

Creating a a multiple-polygon shapefile from CSV

ID,X,Y 1,-79.378,42.2 1,-79.34,42.252 1,-79.338,42.206 1,-79.413,42.18 2,-79.637,42.26 2,-79.735,42.262 2,-79.731,42.163 2,-79.619,42.124 This is my CSV File. I need to convert this to a feature ...
-1
votes
1answer
88 views

tkFileDialog.askopenfilename in python addin crashes ArcMap, how to avoid it?

I had tried to create an interactive tool that takes features selected in the active ArcMap view, allows user to pick a file and then attach it to selected features. However, everything ends at ...
1
vote
1answer
50 views

arcpy.Parameter : how to create “The interactive feature input control”?

I am using ArcMap 10.5, but help pages I am referring are the same as in 10.7. I am trying to make a GP tool within Python toolbox with kind of selection input: user selects features in ArcMap ...
0
votes
0answers
31 views

Exporting JPEG after creating a list?

I am utilizing ArcGIS Pro and ArcPy to automate exporting of JPEGs from several counties in Texas. I am querying each county, and attempting to export each. My script works fine when I run it in two ...
0
votes
0answers
24 views

Accessing ArcSDE delta tables through Python?

I would like to access delta tables through ArcPy for a QC script that I am improving. Read-only. How could I output a Python dictionary that contains all the rows that were added/deleted/modified ...
1
vote
1answer
34 views

ERROR 002760: This service definition file was created for a hosted layer and must be uploaded directly to a portal using the portal website or ArcMap

ERROR 002760: This service definition file was created for a hosted layer and must be uploaded directly to a portal using the portal website or ArcMap. Failed to execute (UploadServiceDefinition). I ...
0
votes
1answer
34 views

Applying symbology from style file using ArcPy?

Every guide/tutorial I found explains how to apply symbology to a layer using the "arcpy.ApplySymbologyFromLayer_management". Instead, I do have a style file, and I want to match the fields on the ...
-1
votes
1answer
35 views

Remove selected rows in Geodatabase [closed]

Attempting to delete selected records in a geodatabase. The issue is this geodatabase feature classes stay the same on a weekly basis but the top level geodatabase name changes. My questions are: ...
1
vote
1answer
35 views

Creating copies of feature point geometries based on value in that feature's attributes using ArcGIS Desktop

I want to take a point feature and create copies of the geometries based on a value in the attribute table associated with that point. Let's say you have 3 points; A, B and C. Point A has a value of ...
1
vote
1answer
32 views

ArcPy Insert Cursor giving RuntimeError: Error in InsertRow

When I run the code snippet below, to create a test table, add a field to it, and populate that field with a value in its first row, I get an error: Traceback (most recent call last): File "C:\Temp\...
1
vote
1answer
33 views

Exporting to GeoTIFF from data view with Data Driven Pages and ArcPy

I'm trying to work with ArcGIS Desktop with this problem. I need to export a data to geotiff with specific boundaries which are polygons, so i decided to use Data Driven Pages (DDP). Because there is ...
0
votes
1answer
40 views

Run code on pressing a key in Pythonaddins

I tried making an addin having below code where I want the user to press a predefined key and the "required_code" should run on the selected features. import arcpy import pythonaddins class Key1(...
0
votes
0answers
14 views

What is the intended workflow for making regular updates to a feature layer on ArcGIS Online?

I've been managing a portal on ArcGIS Online now for a while and since it's inception I've probably been doing things in ways that are harder than they need to be. In addition to many static layers I ...
0
votes
0answers
24 views

Python import conflict between arcpy and osgeo's osr

I'm encountering an interesting conflict between arcpy and osgeo's osr. It seems that the order in which the two modules are imported effects arcpy's ability to look into ArcSDE databases. If you ...
1
vote
0answers
14 views

Populating a text field based on another text field using Python parsing in ArcMap field calculator

I am trying to populate a text field 'Subunit' based on another text field 'ACEC_Name'using the python parser in the field calculator (ArcMap). If the ACEC_Name = "Mojave Ground Squirrel" then I want ...
0
votes
1answer
34 views

Euclidean distance raster fails with ArcPy script

I am working on a script tool to create watersheds. Part of my process requires a distance raster from various features that I use in an equation to perform local modifications to my DEM. I have been ...
3
votes
1answer
56 views

Map algebra with loop and SetNull not working

I'm trying to run a loop through a number of rasters while using SetNull but keep receiving an error message. I have worked on these rasters individually using SetNull and it it works, but would need ...
0
votes
1answer
42 views

Converting feature set inputs into feature class or feature layer for Python Script tool

I want to accept feature set as input and convert it into feature layer or feature class so that I can use the input in select by location in the python script, as the select by location don't accept ...
0
votes
1answer
40 views

Creating dictionary of link and its adjacent links (having common vertex) in ArcPy

How do I create a dictionary that has the linkID of a link as key and linkID of touching links as values? I have used this code in ArcPy but it takes a very long time. arcpy.CopyFeatures_management(...
1
vote
1answer
25 views

Add legend with ArcPy over my interpolated map

I have created an interpolated map with arcpy.IDW_ga and I am exporting it to PDF with arcpy.mapping.ExportToPDF. How can I add a legend to the map with ArcPy? In the end, I want to apply the code to ...
1
vote
1answer
56 views

Python setup to run ArcPy scripts

I am trying to set up Python so that I can execute ArcPy scripts outside of ArcMap. I'm new to Python, however I have previously been able to execute Pythons scripts from the cmd prompt (PowerShell), ...
1
vote
1answer
45 views

Creating grid index (fishnet) features with indexing according to columns

I'm working with west to east river features and I need to index a grid using only numbers and accordinly to columns and not lines. The grid index features tool gives me this numerical sequence of ...
0
votes
0answers
24 views

Only uploading group layers instead of single simple layer when using ArcPy

I use the getWebLayerSharingDraft to upload layers online with Python. However, whenever I upload it, the result is always a group layer with a single layer inside. I wonder if it is possible to use ...
3
votes
1answer
171 views

Shapefile disappeared from layout view and its symbology changed after updating data source?

I am trying to update a map based on a pre-built mxd template. However, after everything ran successfully (python code below), the shapefile that was updated did not show up on the map. Its symbology ...
2
votes
0answers
102 views

SQL query fails in arcpy, but works in ArcGIS Pro 'select by attributes' [closed]

I'm building an SQL query in Python that is used to make a feature layer, but the feature layer returns no features, when it should return 1169 features. The query below works on 95% of the data (...
2
votes
2answers
30 views

arcpy.AddMessage does not produce newlines in ArcGIS Pro

I would like to produce additional newlines when using arcpy.AddMessage . I am using arcpy code assigned to a geoprocessing tool and want to have a newline between some messages. This doesn't happen. ...
0
votes
1answer
56 views

ArcPy: Excel to Table Conversion on multiple Excel files in a folder

I am trying to convert all of xls files (including single sheet) a folder into dbf tables in a gdb. Here is my code: import arcpy, os, xlrd arcpy.env.overwriteOutput = True arcpy.env.workspace = "C:...
1
vote
1answer
46 views

Why will arcpy.Project_management not create output?

I have 2 feature datasets in a .gdb (CNMS_Inventory and CNMS_Inventory_Albers). I set the dataset for CNMS_Inventory to 4269(NAD83) when I created it and it contains a feature class called ...
1
vote
1answer
41 views

Pulling/copying specific shapefile from subfolders using ArcPy

I'm trying to copy only line shapefiles from a folder that contains sub-folders and put them all into a new geodatabase. So far, it runs fine and creates the geodatabase, but when I go check, the ...
0
votes
0answers
42 views

Seeking geoprocessing tool for adding vertex at intersection without splitting

I have a polyline shapefile and a polygon shapefile. I need to add vertices to the polylines where they cross polygon boundaries. The polyline length must stay the same, so the Intersect tool doesn't ...
2
votes
1answer
23 views

Removing border that appears in map exported with arcpy.mapping.ExportToPDF?

I am exporting the current mxd map with all the layers that appear but it saves it with a framework around it. How can I get rid of it? It appears as well when I export to other formats. mxd = arcpy....
1
vote
1answer
37 views

Code to return false if two preconditions are false in Modelbuilder

I'm trying to use Calculate Value in Modelbuilder's Arcmap to run a process if one of two booleans preconditions is true. So if both of precondintion are false the process shouldn't run, otherwise it ...
0
votes
1answer
42 views

Do the same as File>>Export Map>>Save as PDF with a Python command in ArcGIS

I have a Python script to apply IDW interpolation over different datasets, so that the results are several rasters in format .aux. How can I save automatically in the Python script what appears in ...
1
vote
2answers
33 views

ArcPy fails to field calculate integer source value to LONG field

I am working on a script that iterates through the records of "feature class A", performs a spatial selection (flow tracing) with each individual "A" record on "feature class B" and then field ...
0
votes
1answer
38 views

Applying field mapping during Merge using ArcPy

I am trying to merge 10 stream feature classes together using arcpy. But I need to limit the number of fields in the output (all feature classes share the same fields). working_dir = r"C:\Projects\...
2
votes
2answers
48 views

Does ArcPy (Standalone) have option like Spatial filter?

I want to get the polyline features intersecting with a polygon geometry and having a particular field values in ArcPy standalone script. There is another link for similar subject but it is not for ...
2
votes
1answer
37 views

Set Windows temp file location

I am running some ArcPy scripts and the tools keep wanting to write to my c:\users\appdata\local\temp location. I have set the scratchworkspace and workspace environment variables of arcpy to a drive ...
1
vote
2answers
34 views

ArcPy update a field based on the value of another field containing wildcard text

I have a file geodatabase feature class (fc). I want to update Field 1 (Colour) with text where Field 2 (Description) contains a certain word. ie. Field 2 contains the string 'the ball is red and ...

1 3 4 5 6 7 178