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
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 ...
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 ...
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 ...
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 ...
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
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 ...
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 ...
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]....
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
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....
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
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 ...
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
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
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 ...
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
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 ...
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
1answer
14 views

arcpy.sa.SegmentMeanShift() Creates segments with values outside of the range of original raster (stretched?)

I'm using arcpy.sa.SegmentMeanShift() to produce a segmented raster in ArcGIS 10.7.1. The segments in the output raster have values outside the range of values (1 to 248) in the input raster (-22 to ...
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....
0
votes
0answers
34 views

Zonal statistics raster striped in ArcMap

I am using ArcGIS Desktop 10.5. I have a Python program to extract peaks in a DEM Raster. After reclassifying the raster at various contours (e.g., above or below 130 m) and then converting the ...
0
votes
1answer
28 views

Excluding feature classes from list using ArcPy [closed]

I'm new to Python and trying to buffer some feature classes within a list in a Geodatabase. I used the Clip* wildcard to select the files, but I want to exclude three of those files, so I don't use ...
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
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 ...
0
votes
1answer
28 views

How to add a hosted Feature Layer from AGOL to my local ArcGIS Pro through Python?

I`m trying to find a way to add an online layer to my local map, through Python. I know how to grab the layer info, but don't know how to use it. onlinelayer = gis.content.search(mylayer)[0] itemid= ...
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 ...
0
votes
1answer
15 views

ESRI layer does not support “SHOWLABELS”

I am trying to create a script that exports labels to annotation using the tool in ArcPro 2.4. I have created the contour layer, converted it to Layer and that works fine, but I am stuck on the ...
0
votes
1answer
16 views

ArcPy to select by location not showing selected features in attribute table

I have a button where it first calculate no of features in a specific layer and then runs the "are_identical_to" and update "D". After that it checks if the no of counts in two layers is same? If not, ...
0
votes
1answer
25 views

Renaming shapefiles from Cyrillic symbols to Latin ones using ArcPy [closed]

My goal is to rename shapefiles in 2 folders via transliteration using arcpy. That means that I want to replace Cyrillic (Russian) symbols with Latin ones. Here is my code, that doesn't work. What's ...
0
votes
0answers
18 views

Feature Class to Feature Layer in Feature Dataset

I'm trying to find overlapping annotations. The annotations are stored in file gdb, named by their feature and scale (ie Roads_10_A) My technique is to list annotation of a certain scale from a gdb, ...
1
vote
1answer
24 views

arcpy.CheckExtension() Works in ArcMap but not in PyScripter

I've had no trouble with using similar licensing in Python scripts previously, so I'm wondering if a recent upgrade/replacement of my PyScripter environment may have caused it to stop working. I'm ...
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 ...
2
votes
0answers
22 views

Publishing service using service definition file (sd) through the ArcGIS REST API?

The algorithm I have so far is basically this: Create a sddraft from a mxd file (using arcpy.CreateMapSDDraft(). Stage sddraft into a sd file (using arcpy.StageService_server(). Upload sd file to ...
1
vote
0answers
12 views

How to make ApplySymbologyFromLayer_management work on “CURRENT”, on ArcGIS pro?

I can't make the ApplySymbologyFromLayer_management work on ArcGIS Pro by any means. The following code runs smoothly but don't give any results: import arcpy aprx = arcpy.mp.ArcGISProject("CURRENT")...
1
vote
1answer
23 views

Remove unconnected polylines from a shapefile ArcPy

How do you isolate a group of polylines that are not connected to the bigger polyline group. Ideally, I would like to rank all the polyline groups based on how many features there are in each group. ...
1
vote
1answer
39 views

Create point clusters based on grid

I am trying to make a systematic cluster sampling pattern for data collection. The sampling consist of the points placed over the landscape in 6 km span (red). From this major point, I need to create ...
0
votes
0answers
19 views

Calling .net DLL by using ArcPy [duplicate]

I had developed a tool by using C# (ArcObjects) and I want to (import that customized DLL and) call a particular function from that class by using ArcPy. How can I achieve this?
5
votes
2answers
71 views

Automating line adjustment to a point or a series of points in ArcGIS Suite?

There are multiple toolboxes in ArcGIS Suite that deal with geographic transformation and correction, such as Spatial Adjustment, Rubbersheeting, and Snap. I'm not sure how to best use a tool to ...
1
vote
1answer
22 views

Performing IDW for multiple Z field from attribute using ArcPy?

I have data with multiple columns as 1996_1, 1997_1, etc. I need to perform IDW for each column values and save it. I am a beginner with arcpy. Please help! The code is as follows: import arcpy, os ...
1
vote
1answer
23 views

Printing shapefiles and shape type of feature classes and separating them by comma using ArcPy?

import arcpy arcpy.env.workspace = "C:\\ArcGIS\\Data" FCList = arcpy.ListFeatureClasses("") for feature in FCList: print feature This yields me a list of all of my .shp files, but I need it ...
1
vote
2answers
41 views

Merging multiple shapefiles using ArcPy

I have a list of paths of all the shapefiles (around 50) to be merged. All of them are at the same projection and none of them is sized more than 110MB (shp+dbf). The combined size of merge (shp+dbf) ...
0
votes
1answer
37 views

Creating WHERE clause from list using ArcPy

I am creating a new shapefile (a subset of a current shapefile) such that it has all the features whose values in a field ("fclass") is not contained in the field_names list. field_names = ['...
0
votes
2answers
26 views

arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000840: The value is not a Data Element. Failed to execute (Copy)

Check this straightforward code that exports the subset of a shapefile (path_of_shp) using where_clause: where_clause = '"new" = 1' arcpy.MakeFeatureLayer_management(path_of_shp, "feature") arcpy....
0
votes
1answer
24 views

Combobox value increment and update

I have made a custom add-in for my building ID update tool. The objective is: user will write an alphanumeric value in the combobox like 'x100'. When a user selects a bunch of polygons(building) and ...
0
votes
1answer
18 views

Setting Symbol Template for ArcGIS Pro GraduatedSymbolsRenderer from ArcPy

Is it possible to set a Symbol Template for a GraduatedSymbolsRenderer using ArcPy for ArcGIS Pro? The reason I ask is that running the test code below gives an error of: Traceback (most recent call ...
1
vote
0answers
20 views

My UpdateCursor is not working. The attribute table of my new shapefile is not updating [closed]

I am new to arcpy. I am trying to do a few things with a shapefile. First I created a new shapefile with specific dataset that I wanted to work on. So far everything works until the UpdateCursor. When ...
0
votes
0answers
13 views

Inconsistent pixel range clipped 16-bit imagery to 8-bit

I'm attempting to convert 16 clipped/georeferenced imagery to 8-bit using the CopyRaster function in ArcPy but I'm having trouble assigning NODATA values. I have 16-bit imagery that has 3/4 bands (...