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
1answer
24 views

Using two Python Addin Combo Boxes to choose Folder then Layer

I am trying to create a Python add-in for ArcMap for users to quickly select layer files from within several different folders. This will require 2 combo boxes. User selects the folder from the first ...
1
vote
1answer
10 views

sym.renderer.breakCount value not changing in ArcPy with ArcGIS Pro

Experiencing trouble with ArcGIS Pro 2.3.2 sym.renderer to assign symbology to a layer in a map project using only python. I am automating map creation, and layer creation, symbolization. I am trying ...
1
vote
1answer
114 views

Creating 3D arcpy.Polyline?

Working with ArcGIS Pro 2.2, I have to create a 3D polyline from array of XYZ coordinates. When I try this code snippet : array = arcpy.Array([arcpy.Point(0, 0, 0),arcpy.Point(0, 100, -1000)]) ...
2
votes
1answer
36 views

Listing attributes of arcpy.Describe object in python?

I am trying to create a json structure that will describe a multitude of different arcpy data types (FeatureClass, FeatureDataset, Workspace, etc). I would like the script to be dynamic and give all ...
3
votes
1answer
63 views

Make Route Events Layer Not Drawing All Routes From Python Toolbox Tool?

I'm working on a python toolbox tool that creates offset points along a polyline via the arcpy.CreateRoutes_lr() tool and arcpy.MakeRouteEventLayer_lr(). The tool simplifies the process by ...
1
vote
1answer
23 views

Combining ListDatasets and ListFields to return geodatabase contents to CSV--one script prints attributes and another returns feature class counts

New to Python. I'm trying to combine two scripts I found online that use the ListDatasets and ListFields tools. One loops through all the features of a geodatabase and writes the name of the feature ...
1
vote
1answer
45 views

Using Geometry.distance_to() in ArcGIS API for Python

I'm calculating distances between points in arcpy or ArcGIS API for Python, and am probably doing something wrong. Hopefully, someone can show me what. Take this as an interactive session with ...
0
votes
1answer
50 views

Does ArcGIS API for Python use ArcPy internally?

Today I read a GIS SE user opinion in Using Geometry.distance_to() in ArcGIS API for Python that: it appears that ArcGIS API for Python uses ArcPy internally This surprised me because I do not ...
2
votes
2answers
558 views

Seeking ArcPy dissolve to multipart workaround for when arcpy.Dissolve fails [on hold]

I have an ArcPy script in which I am using arcpy.Dissolve on a single feature class with multiple features to get a single multi-part feature in the output. The script is successful only part of the ...
1
vote
1answer
31 views

Generating list of feature classes from .gdb file using ArcPy Idle script: Error thrown

I'm new to ArcPy and Python and have a very simple question. I'm trying to write a Python script in idle to extract the number of feature class files from a geodatabase. I can do it just fine in the ...
5
votes
1answer
1k views

Getting ArcPy autocomplete to work in IDLE?

I want to write scripts in IDLE, but I love how the built in python window in ArcGIS 10.2 automatically fills in the module names as you start typing them. For example, if I type arcpy.Lis..., the ...
0
votes
1answer
28 views

Exporting the attribute tables of rasters in ArcPy

Like the title suggests I have this script that worked once before to export the attribute tables of some rasters as CSV files. However when I run this script again, I get an error: Runtime error ...
4
votes
3answers
104 views

Automatically assigning attribute to line features

I have a network of railway switches and I need to assign the value of a switch line being left or right automatically. What do I have: A feature class containing a track that looks like this I need ...
0
votes
1answer
52 views

Using input parameters to select layer by attribute

I am trying to create a Python-Toolbox with following Tool: inputFeature: A User has to load a Feature inputField: Then he has to to select a field from the Input Feature inputValue: At the end ...
3
votes
1answer
87 views

Keeping Highest Valued polygon using ArcPy

I have a single polygon feature class that contains large polygons which represent signal strength. Often times these polygons overlap. I dissolve to get multi-part polygons with a value range of 3 ...
0
votes
1answer
39 views

Using Python map function with ArcPy?

Script is simple made for this case. Creating new shapes based on known arguments. My code: import arcpy #variables fc_1 = 'fc_1' fc_2 = 'fc_2' fc_3 = 'fc_3' fc_4 = 'fc_4' war_1 = "highway = 'path'...
0
votes
1answer
25 views

Unable to update time frame on layer in ArcPy?

I'm working on a script to ingest some data, create some data layers with it, and publish that to ArcGIS Server. Most of that is done with no problem, but I got a new requirement today, time-enabling ...
0
votes
0answers
16 views

Bulk modifying field alias names in file geodatabase [duplicate]

I am currently running large batches of modifying field alias names in a single file geodatabase. I am using ArcPy (ArcMap 10.7) AlterField_management function but it is too slow as it runs one at a ...
0
votes
1answer
23 views

Arcpy UploadServiceDefinition ignores folders and groups

I am using Esri's guidance for arcpy.UploadServiceDefinition_server (http://desktop.arcgis.com/en/arcmap/10.6/tools/server-toolbox/upload-service-definition.htm) I can successfully upload a service ...
0
votes
1answer
27 views

SetNull function problem

I am trying to calculate a sum for a set of raster but before I need to disregard No Data values (that are equal to -9999 for my rasters) by using SetNull function. It gives an error. What could be ...
0
votes
2answers
28 views

Getting MemoryError from Fiona when merging large amounts of buffered data (Python)

I am using fiona and shapely together to buffer points and then merge them and write them to a shapefile. For almost all of my datasets, this is working fine. However, I am currently getting a ...
4
votes
1answer
1k views

Multithreading in Arcpy

I am learning multithreading and thinking about using it with Arcpy. The example I am working on doesn't have much practical reasons. However, I don't know why it fails on the line "arcpy.Exists(...
1
vote
1answer
43 views

What is arcpy.cim?

In the help for ArcGIS Pro 2.4's Python CIM access there is "Example 3: Modify layer symbology" which has this code: # Reference a project, map, and layer using arcpy.mp p = arcpy.mp.ArcGISProject('...
1
vote
1answer
31 views

Can't send the string output (from a Python tool) to work as a input for a tool in a model (ArcGIS Pro)

I have a model that uses the Feature Class to Feature Class tool. It needs 3 inputs (Input layer, location and output name). My goal is that a user would choose a layer, the model would create a new ...
0
votes
0answers
17 views

999999 error when executing StageService_Server to create service definition file in ArcGIS Pro

Oh, the dredded 999999 error. I am trying to create a service definition in arcpy for ArcGIS Pro. I succeed in creating a .sddraft but I fail to create a .sd sharing_draft = mlist[0]....
0
votes
1answer
33 views

Undoing Operation while editing in ArcMap with Python Add-ins?

Using ArcPy Add-ins, I can issue a message, but I don’t understand how to cancel or undo deleting an object. Is it possible? class ControlUniq(object): """Implementation for addin1_addin....
4
votes
2answers
108 views

Running arcpy.AlterField_management 2,000 times takes too long?

I am trying to replace field names of a table stored in a file geodatabase using a dictionary as a lookup table. My field names got cut off from the Tabulate Area tool (Tabulate Area Truncates Field ...
1
vote
1answer
37 views

Using Create Random points ignores number of points required in ArcPy

I am trying to generate around 117 random points over patchy forested landscape. As my forested landscape contaisn many polygons (28.000), and I would like to generate specific number of random points,...
0
votes
0answers
28 views

Script to draw lines automatically on specific offset from given Line Layer and attirbute (QGIS, ArcMap, AutoCAD…) [closed]

I couldn't find a way to draw lines automatically from existing layer and attributes. The lines need to be drawn symmetric to the axis on specific distance (it could vary, but in most cases it is 0....
1
vote
1answer
87 views

Selecting line with specific numeric field value using inline variable for arcpy.UpdateCursor()

I'm currently away in a remote field station using Arc 10.0 and having a hard time using an inline variable substitution for a numeric field value. I am trying to use UpdateCursor to select only a ...
1
vote
1answer
25 views

Viewing ArcGIS Pro layer as JSON to illustrate CIM (Cartographic Information Model)

In order to work with the Cartographic Information Model (CIM) from ArcPy with ArcGIS Pro I am interested in viewing the JSON for a particular layer. In a YouTube video from Esri's 2019 Developer ...
0
votes
1answer
31 views

Dataset does not exist or is unsupported SaveLayerToFile

I am trying to save a layer from an MXD to a lyrx file in a geodatabase using ArcGIS Pro. aprx.importDocument(current_document_name) mlist = aprx.listMaps() infra_layers = mlist[0].listLayers() arcpy....
0
votes
1answer
67 views

Calculating the value of a column based on the values of other columns

Please correct my code for calculating the value of a column "New_score" for each value of ID_TRC using the values of 3 other columns called LENGTH, Category, and Score. for each ID_TRC, "if the ...
0
votes
3answers
379 views

trying to find max value in a field and define value as variable

I am new to scripting. I have been searching around on here and other sites, and can't seem to find something quite like what I need. I am trying to find a max value within a field, and store that ...
2
votes
1answer
51 views

Exporting layout file from ArcGIS Pro project to *.pagx file using ArcPy?

I'm trying to implement a tool to import *.pagx files exported from ArcGIS Pro to a project, modify text elements and export the altered layouts back to the *.pagx files. It is pretty easy to export ...
0
votes
0answers
10 views

Adding Label Classes to layer file using ArcPy [closed]

I am looking to color my points differently based on the values in a certain field. I can do this on ArcMap by adding another class, using a SQL Query and coloring the labels differently. How do I ...
0
votes
0answers
8 views

Apply symbology to raster working in Data and Layout view but won't export to jpg correctly

I'm trying to export a series of jpg maps by displaying and symbolizing raster layers one at a time. The Data View and Layout View in ArcMap 10.7 correctly reflect the symbology of the .lyr file I ...
0
votes
1answer
28 views

Checking feature overlap using ArcPy cursors

I have a set of geometries that I want to check whether they touch another geometry. I have created a tuple "tiffs" where I want position 0 when touches is true. tif[0] and tif1 are strings. The ...
2
votes
1answer
26 views

Executing buffer analysis in ArcPy with for loop?

I'm attempting to run the Buffer Analysis tool with a distance of 3 km over multiple shapefiles at the same time. I was given a folder with different types of files and ran a for loop to create a new ...
0
votes
1answer
16 views

Polygon zone fell outside bounds of raster using ArcPy

I'm trying to perform zonal statistics, and get a message that: A polygon zone fell outside the bounds of the raster. It is not possible because the polygon is just a 50-km buffer zone around the ...
1
vote
2answers
252 views

Simpler Method to Map Fields in Spatial Join

I've cobbled together a script, part of which creates field mapping to sum fields in a spatial join. It took 13 lines of codes just to define which fields I want summed in the output. Is there a ...
0
votes
2answers
32 views

Importing ArcPy installed with ArcGIS Pro in PyCharm

I am trying to import arcpy in a script, which is running in a PyCharm environment using the Python 3.6.6 installation that comes bundled with ArcGIS Pro 2.3.2 as the base interpreter. I get the ...
0
votes
1answer
36 views

Printing Raster extents but not showing on console

print("Data {0}, xmin{1}, ymin{2}, xmax{3}, ymax{4}".format(ext.Xmin, ext.Xmax, ext.Ymin, ext.Ymax)) The line of code above is not printing out the extent for each raster in my dataset in the code ...
0
votes
1answer
11 views

Passing drawbox polygon to geoprocessor

I am building an app in the ArcGIS Web AppBuilder. I am trying to pass the geoetry resulting from the drawbox dijit to a geoprocessor. Its an extent. But when I attempt it and log the parameter to ...
0
votes
0answers
30 views

Why are variables not being assigned to Raster by ArcPy? [closed]

import arcpy, sys, os from arcpy import env from arcpy import management as DM from arcpy.sa import * arcpy.env.workspace = r"F:/Fall 2019/GEOG 625/Exam Data/ExamData/MichaelBreidert/Pen/HMB.gdb" ...
0
votes
1answer
36 views

Slicing all values in field using arcpy.da.UpdateCursor

I have a folder with a (3) shapefiles. Each shp. has a field titled "country" with a country name. I've already set my desired workspace correctly and everything else in my script works for what I ...
1
vote
1answer
168 views

Arcpy: Delete rows from joined table

I would like to delete all rows which are joined to a layer from a csv table. Only the joined records which match (keep only matching records) should be deleted. After the records are deleted, the ...
4
votes
1answer
2k views

Sorting shapefile records on attribute to update new rank field using ArcPy?

Basically, I am trying to sort the records within the shapefile based on an attribute(eg: pop) and then add a new field that indicates ranking based on the sort. eg: the record with the highest pop ...
4
votes
3answers
2k views

Selecting top 10 records in attribute table using ArcMap

I am using ModelBuilder in ArcMap 10.2 to try and find a way to select the first 10 records sorted by Category and then by Distance. For example, my table has 100 banks and 100 churches, which is the "...
0
votes
0answers
11 views

Accessing files from GIS Server in Python [closed]

I'm working on a python project that involves obtaining data from the USDA NAIP Imagery GIS server (https://gis.apfo.usda.gov/arcgis/rest/services). I can access the files i need easily enough in ...