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
0answers
9 views

Publishing a web tile layer on ArcGIS Online with python

I have a tiff layer in an ArcGIS Pro project. I would like to publish it on my ArcGIS Online portal, with Arcpy. I try to publish it as a Web Tile Layer, but could be another layer type, if anyone has ...
1
vote
1answer
19 views

ArcPy Select Layer by Attribute for Date and Time

I have a list of trips with a field, "Trip Start Timestamp" thats type is date where it appears on the attribute table as M/D/YYYY HH:MM:SS AM/PM I need group all trips with the same trip start ...
2
votes
1answer
56 views

Why is ArcPy code crashing ArcGIS Pro?

I'm having issues with ArcGIS Pro (AGP) crashing when I run this ArcPy code directly into ArcPro Python window. I previously wrote the three lines separately but I decided to try to copy python code ...
2
votes
0answers
23 views

Where_Clause expression working for one FeatureClassToFeatureClass_conversion export but not another

I am attempting to export a feature class to both a shapefile and feature class with a where_clause restriction on particular values within particular fields. I have written a function to take dataset ...
0
votes
0answers
10 views

Calculating area weighted average slope using ArcPy in Python window [closed]

I am attempting to calculate an area weighted average of slope for multiple polygons in ArcGIS. There are no plugins available to do this and I do not know how to write a code for this in Python. How ...
0
votes
1answer
30 views

Calculate Field - Why does the field populate with the same number, but prints correclty?

Why does the field populate with the same number, but prints correclty? import arcpy import rivers arcpy.env.overwriteOutput = True arcpy.env.workspace = r"C:\Data" import math def sinuosity(shape): ...
-2
votes
0answers
16 views

Problem running outFill = Fill(outDir) in ArcPy script [closed]

import arcpy >>> from arcpy.sa import* >>> outDir=r"data path .tif" >>> thershold = 10000 >>> snapdistance = 100 >>> arcpy.env.workspace=arcpy.env....
0
votes
1answer
18 views

Raster error 'TypeError: Can't multiply sequence by non-int of type 'float' when creating Arcmap script

I am writing an Arcpy script to use in ArcMap (ArcGIS 10.7.1) as a tool to interpolate existing soil points, and make a nutrient recommendation afterwards. However, I'm getting the TypeError: can't ...
0
votes
1answer
22 views

'Fields' variable does not show specified shapefile fields in Arcpy custom script

I'm creating a script in ArcMap (ArcGIS 10.7.1). I have created tool parameters to specify the workspace where the data is stored (Workspace), a shapefile displaying a boundary (Field boundary), a ...
0
votes
1answer
18 views

arcpy.MakeFeatureLayer_management function not creating feature layer in ArcGIS Pro

I'm attempting to run a simple tool script in ArcGIS Pro 2.4 that creates a feature layer from an existing layer. The script creates the feature layer just fine if running the script in PyCharm, as ...
0
votes
1answer
28 views

Append/insert geoprocessing results into an existing feature class

I plan to run a scheduled server job on a feature class in an Oracle 18c/10.7.1 geodatabase. The job would: Truncate the rows in an existing feature class Generate new rows from a geoprocessing tool ...
0
votes
0answers
18 views

How to visualize route layer on ArcPy Jupyter Notebook (ArcGIS)

I tried to visualize the route between two points using ArcPy in a Jupyter notebook. The network module is activated in my Esri account. Even though it visualizes the map I can't see the route on that ...
0
votes
0answers
13 views

Geocoding 'in_memory' using ArcPy

I need to run a geocode, then do some calculations on the results, and then run the geocode again. Since the first geocode result is intermediate data, I tried to use the in_memory directory to speed ...
1
vote
1answer
35 views

Rounding to nearest multiple of pixel resolution using ArcPy

ArcPy can return the pixel resolution: arcpy.GetRasterProperties_management(rasterfile, "CELLSIZEX", "").getOutput(0)) Let's say this returns "3.2808" I wish to be able to take a given input, say "...
1
vote
0answers
15 views

ArcGIS Pro PostgreSQL SSH connection string

I am involved in a project where a SQL Server-base application is being retired and replaced with a PostgreSQL/PostGIS-based tool under development. There is a large amount of cross-checking to be ...
0
votes
0answers
14 views

Attempting to run find closest facility tool in ArcPy and get no output

I try to run the Find Closest Facility tool within python to find nearest hospital around an incident. The code is shown below: tbx = "http://logistics.arcgis.com/arcgis/services;World/ServiceAreas;...
0
votes
1answer
26 views

Exporting webmap into PDF without layout using ArcPy with ArcGIS Pro

I try to export a webmap in using arcpy into a pdf. This works fine, if there is a Layout available using: aprx = arcpy.mp.ConvertWebMapToArcGISProject(webmap, None, None, notes_gdb) aprx....
2
votes
1answer
23 views

Extracting Summary Statistics value with cursor and assigning it to a variable

I am writing a script (to be used in ArcGIS 10.7.1) that uses a Zonal Statistics tool to create an average of a raster that is beneath a grid. I then use the Summary Statistics tool to take the ...
1
vote
1answer
28 views

Framing argument for insert cursor when writing geometries using ArcPy?

I am writing polygon geometries and I have points holding the geometries that represent vertices of the polygon. When I run the code below I get: TypeError: sequence size must match size of the ...
0
votes
1answer
34 views

Rebuilding indexes in file geodatabase using ArcPy

I am trying to automate the rebuild of file geodatabase indexes using ArcPy v10.6, but I encounter an ERROR 000837 The workspace is not the correct workspace type. Question: If arcpy....
0
votes
0answers
26 views

Dissolve work well in my desktop but not in ArcPy [closed]

I want to dissolve in my ArcPy code but code below return nothing in my result shapefile and I try using the dissolve in ArcMap, it works well. I am wondering is it because the data or my code? ...
0
votes
0answers
17 views

arcpy.intersect_analysis returning blank shape file [closed]

Why Intersect_analysis function of arcpy do not work as it should. Take an example of below code written behind the button click. arcpy.Intersect_analysis(inputlyr, namE[3]) ct8 = int(arcpy....
0
votes
0answers
56 views

AttributeError: 'module' object has no attribute 'xxx'

I'm trying to reduce a workflow; wherein I take a polyline file, add points every 1700m and split the polyline at those points. I then use this new split polyline file as an index for data driven ...
-2
votes
0answers
24 views

Why aren't rows being populated when doing insert cursor? [closed]

I created a table in ArcGIS Pro using ArcPy. I was able to create the fields, but when I try to insert values into the rows using the insert cursor it doesn't populate and won't show up in the table. ...
1
vote
1answer
22 views

Specifying grid width and height dimensions with ArcMap custom toolbox parameter

I am using I am writing a script to create a tool (in ArcMap 10.7.1) that involves overlaying an agricultural field with a specific grid size. I need the grid to contain a custom width and height of ...
0
votes
1answer
41 views

Sharing WebMap through Python

I already know how to share a layer, or create a empty webmap (and add layers after its creation) through Python on ArcGIS Pro. However I could not find a way to share a Web Map trough Python. By ...
1
vote
1answer
15 views

List fields in parameters from Fc list in script validation using arcpy in arcgis

I am trying to list fields from a feature class list in script tool validation. First user selects the data frame from the list then FC populates in next box and fields of the FC in next box. I have ...
0
votes
1answer
17 views

Remove layer assertion error

I am using below code to remove any layer if it has zero features in it. mxd = arcpy.mapping.MapDocument("CURRENT") aDF = mxd.activeDataFrame namE = ["No_Work_Done"] if int(arcpy.GetCount_management(...
0
votes
2answers
45 views

ExportToPNG produce empty image

I am using ExportToPNG (in ArcGIS 10.3.1) to produce images from a MXD with WMS data. If I use the interface command ExportMap with the option "1-BIT_MONOCHROME_THRESHOLD" and a threshold at 256, the ...
1
vote
1answer
40 views

Spatial reference data from all layers in MXD

I have a MXD with many group which has many layers. I have tried to get coordinate system data from all layers with the code from Iterating through layers in mxd and describing coordinate system. So ...
1
vote
1answer
21 views

Defining one numeric variable by defining another string variable (via parameter selection)

I'm creating an ArcGIS tool that will allow users to figure out how much nitrogen that a field needs based on interpolated points (Kriging). I will have the following parameters: #numeric variables ...
1
vote
0answers
28 views

Error in ArcPy script building network

I am trying to use the network analysis toolset to build a route. I made the the tool in model builder initially and have tried to edit it to make it a script. When I try to build the network I get ...
1
vote
1answer
20 views

Arcpy Clip Raster not setting clipped out area to NoData

I have an 8 bit raster that I'm clipping using arcpy 10.7 arcpy.Clip_management("inrasPATH","","outrasPATH","PolygonPATH","256","ClippingGeometry","MAINTAIN_EXTENT") However whenever I clip the ...
1
vote
1answer
35 views

Kriging error when writing ArcPy script (ERROR 000622 & ERROR 000628)

I am trying to write an ArcPy script that uses Kriging to interpolate various nutrients in the soil (i.e. nitrogen) using ArcGIS Pro 2.4.0. These nutrients were collected by sampling the soil, so it ...
1
vote
0answers
18 views

arcpy.RemoveAttachments_management doesn't remove all matched attachments

ArcMap 10.5, referred doc: http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/remove-attachments.htm I created a tool for users to attach files to the selected objects in ArcMap. ...
-1
votes
1answer
21 views

ArcPy: Delete field loop with if exception

Am new to ArcPy , am trying to join the same features from different geodatabase but I don't need all of attributes, so want to make a loop to find each feature class and delete the fields I don't ...
0
votes
0answers
17 views

Getting arcpy.GetParameterAsText to provide drop-down list for ArcGIS users [duplicate]

I'm creating an ArcGIS tool that will interpolate (using kriging) nutrient levels from soil test data, and will calculate the total amount of fertilizer per field that a customer will need to buy. ...
2
votes
0answers
35 views

ESRI Geometry Union slower than Built in dissolve which is slower than Shapely

I work with point datasets a lot. We try to keep a running layer of points and update the dataset with new points while removing the old points. So, we do a lot of checking the extents of the new ...
1
vote
1answer
38 views

“Error 999999: Error executing function - Attribute conversion error” when running RegisterWithGeodatabase

I am using ArcPy to run through all of the spatial views in an enterprise GDB, register them with the GDB, and assign domains to the registered view. It runs great for most of the views in the GDB, ...
1
vote
0answers
30 views

Can't run 3D Analyst extension in custom script tool

I have custom python script in which I use 3D Analyst function "Add surface information", it works fine when I run the script through ArcCatalog Python Console, but when I try to run the script as ...
1
vote
1answer
58 views

Longitude, latitude to polygon in ArcPy

I'm working in ArcGIS 10.4.1 and trying to write a script (in Python) for making a polygon shapefile from latitude/longitude. txtFile=arcpy.GetParameterAsText(1) shpOUTpolygon=arcpy....
1
vote
1answer
75 views

Randomly subsetting % of polygons by class/attributes using ArcPy

Referring to this topic How to randomly subset X% of selected points?. I tried in ArcPy and I can't figure out how to change this code to randomly select 50% of the polygons based on the attribute (...
0
votes
0answers
17 views

Joining multiple layers to a dBase table

I am attempting to join my standalone dBase table to all other shapefile layers in my project. I have about 5-6 hundred layers give or take and all of them share the same table format. I want to join ...
1
vote
2answers
32 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
15 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
93 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
104 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
37 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
20 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 know know how to add the current row in the Search Cursor ...
0
votes
1answer
22 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 ...