A site-package created by Esri to expose ArcGIS for Desktop (and ArcGIS Pro) geoprocessing, mapping, etc, to Python.

learn more… | top users | synonyms (8)

2
votes
0answers
38 views

Using Arcpy.UpdateCursor to delete adjacency rows based on a group ID

I have this sample file shown in the picture 1 below. it is a sample data set of a phone survey of drivers. I am trying to find out when those drivers started to drive. My main goal is to build a ...
0
votes
0answers
15 views

Modify symbology on newly created shapefile with arcpy

I'm new to using arcpy and I'm diving into the deep end. Using arcMap 10.2.2, I can create a shapefile thus: # create point shape file for buildings arcpy.CreateFeatureclass_management(myFolder, "...
0
votes
1answer
13 views

Using cursors to summarize per group

I want to summarize fields per Group with python and need help to get unstuck. I'm trying to get the code below to produce a Dictionary of Groups and their total shape areas, like {'Group1':123456, '...
1
vote
1answer
43 views

Assign row object as field name in ArcGIS

Is there a specific way to assign the object that for example row[0] returns in a SearchCursor to a new field name? I mean how to write it in add field syntax, this doesn't work: arcpy....
1
vote
1answer
63 views

Preventing North Arrow from jumping around in ArcPy?

I am using a python script, which opens an mxd, loads a feature class, exports the map to a png. That script produces a few hundreds of maps. After my update to 10.4 (maybe that is a coincidence) the ...
0
votes
3answers
86 views

Shortening code that provides a database description using ArcPy?

I need advice on how to reduce the length of the sample code below. I need to perform the same work on several more datasets. import arcpy, os arcpy.env.workspace = r"\\gis\Env.gdb\Water" datasets =...
-4
votes
1answer
35 views

assigning a label to a variable [closed]

I am getting a traceback error at the for loop (line 9). TypeError: #'NoneType' object is not iterable I was wondering if fcList is empty. I also thought leaving arcpy.ListFeatureClasses() ...
0
votes
1answer
45 views

How to create Circle using X,Y Coordinate and radius by ArcPy? [closed]

I have been given three parameters X and Y coordinates and a distance or the radius of the circle. I will have to draw a circle using ArcPy by these three parameters where the center is the point of X-...
1
vote
2answers
48 views

Running Python script that includes ArcPy functions?

I have to export about 250 layers in one mxd File to maps in ArcGIS 10. I found a script on this site at Exporting each layer in map to separate image using ArcPy?: mxd = arcpy.mapping.MapDocument(...
0
votes
1answer
30 views

Opening Notepad text editor from ArcPy/Python? [duplicate]

Is it possible to use arcpy to open up an editor (like Notepad) to show a simple text file? I'd like to do this in a tool that generates text which is supposed to be copied and pasted into another ...
1
vote
1answer
28 views

How to turn off the visibility of a layer?

I'm making a geoprocessing tool with ArcObjects Java (IBasicGeoprocessingTool) and I need to make a layer not visible. I managed to get this layer as IFeatureLayer and I get an access to the map or ...
1
vote
0answers
39 views

Calculating polygon width ArcGIS 10.4

I am trying to calculate an average width of a large set of polygons. I found the script below researching the topic. The function is: def add_average_width(featureClass, averageWidthField='Width'): ...
1
vote
1answer
21 views

Invalid Input Data Error 000368 Running ArcPy tools in for loop

I am attempting to iterate over all the feature classes in a folder and I'm getting the error 000368. The other solutions in on SE were not helpful to me unfortunately, so I'm posting a separate ...
0
votes
2answers
35 views

Using Arcpy to copy features in a loop to a differing workspace

I've tried to create a script to loop through a folder and then clip the features. This works. My problem is that my new files are created in the same workspace (in my case Data) but I would like to ...
2
votes
3answers
187 views

Splitting a string field that contains time information

I have a text field within a FGBD that contains a date/time and I need only the time as a string. 'yyyymmdd HH:mm:ss' And I need: 'HH:mm:ss' I've tried .rsplit but I'm not using it correctly. I ...
1
vote
1answer
45 views

Invalid Output Workspace error when executing Slope_3d as WPS

I wrote a small toolbox that calculates the slope in degrees of a given .tif file, stores the ouput to a local folder on my computer and generates 2 by 2 tiles. The toolbox works fine, the publishing ...
3
votes
1answer
33 views

Error when running Extract by Mask Script

I am using ArcGIS 10.3 Desktop to write a script tool to, among other things, extract raster data using a mask. I keep getting these errors: ExecuteError: ERROR 000875: Output raster: C:\...
1
vote
2answers
108 views

Get Raster Centroid using Arcpy

Purpose:To take an input raster image and clip its shape to a parcel block. In later stages this model will be applied to a loop. Logic: The Model receives an input raster image and calculates a ...
0
votes
1answer
49 views

Using memory management and error handling to improve performance of ArcPy script? [closed]

I have an ArcPy script that adds new fields and then deletes unnecessary fields from a group of feature classes. I am a novice at ArcGIS and even more so at ArcPy, but have been able to piece together ...
1
vote
0answers
20 views

Why .getOutput(0) is needed after GetCount_management? [duplicate]

parcelCount = int(arcpy.GetCount_management("Parcels_lyr").getOutput(0)) print parcelCount while parcelCount < 200: arcpy.SelectLayerByLocation_management("Parcels_lyr","WITHIN_A_DISTANCE",\ ...
0
votes
1answer
30 views

Toggle Graphic Element inside ArcMap's Layout View using Arcpy

I am trying to toggle unwanted graphic elements inside of ArcMap's layout view before exporting them as a pdf. I have no problem reading the correct graphic element or relocating it to another ...
-1
votes
4answers
81 views

Copying feature from one feature class to another without creating new feature class?

i need to copy a line feature from a line feature class to another existing feature class without creating a new feature class. As copy feature tool creates the copies feature in a new feature class ...
0
votes
2answers
40 views

Choosing data type to use for input as feature class or shapefile in Python script tool using ArcPy?

I am writing a Python script tool within a toolbox with *.tbx extension. I need to make the input parameter flexible (feature class or shape file) , so which data type I should select for this ...
-1
votes
1answer
32 views

Finding common two vertices for two adjacent polygons and drawing line feature connecting them in ArcGIS for Desktop? [on hold]

I need to find the common two vertices between two adjacent polygon and draw a line feature connecting these two common vertices: I have tried the following code but it is not working: polygon1 = ...
0
votes
2answers
28 views

Converting all values in attribute table to zero (0) in shapefile using ArcPy?

I'm looking for a python script using ArcPy that can convert all values in a shapefile's attribute table to a value of 0 as I will then populate with other values from another source. I have ...
1
vote
3answers
38 views

arcpy field mapping for a spatial join: keep only specific columns

I want to perform a spatial join to find the join point (a node in the code below) that is closest to a target point (a consumer in the code below). In the result, I only need certain attributes from ...
0
votes
0answers
35 views

I can't import arcpy to python in arcgis. What do I do?

I'm running ArcGIS 10.3 on Windows 10. I get an error message when I try to import arcpy. I'll include the error message that I print screened. Should I just un-install ArcGIS and reinstall it? or ...
1
vote
1answer
39 views

ArcGIS Calculate Field, Python Shape Expression

Using ArcGIS 10.1 and Python 2.7- I am trying to write an expression that calculates the mid point of a line. I've tried many different expressions, but I continue to get syntax errors. #An example ...
0
votes
0answers
33 views

Set Script Tool Parameter to Accept Either Input or Output

I've created a script tool that has an optional output parameter of an Excel Workbook. If it's populated, the script will add a new worksheet. However, every time the tool is run, ArcGIS is somehow ...
0
votes
1answer
33 views

Can't get new rows added with Arcpy / InsertCursor

I'm not getting any errors but can't seem to get these rows added. Everything else in the script works fine. I only dabble with Python occasionally so please forgive me for missing anything obvious ...
1
vote
1answer
15 views

Arcpy MakeFeatureLayer_management issue using SQL condition

I have a lines shapefile. I made a small code to select some of its elements and turn them into a standalone layer. The code is like this: arcpy.env.workspace = r"C:\MyDirectory\Mygdb.gdb" network = ...
1
vote
0answers
60 views

Using file opened by GUI in python?

I have these lines of code: import tkFileDialog, arcpy, arcpy.da, numpy as np, Tkinter import arcpy.mapping as mapping fc = tkFileDialog.askopenfilename(filetypes=[('shapefiles','*.shp')],title='...
1
vote
2answers
41 views

Problem looping and summing rasters using ArcGIS 10.3 and Python Script

I need a python script that seeks to cycle through a number of viewpoints, deriving an AGL raster in each case (using arcpy.Viewshed_3d) and progressively summing the AGL rasters into a single ...
0
votes
1answer
36 views

Parsing error SyntaxError: EOL while scanning string literal (line 5)

I want to create a number of featureclass using a template featureclass import arcpy from arcpy import env env.workspace = "C:\new_docs\BIO-FILES\GIS_prog\Lesson1" arcpy.CreateFeatures_management('C:...
1
vote
1answer
22 views

lyr replaceDataSource not reflecting

The changes I made to the MXD with ArcPy is not reflecting the changes in ArcMap. arcpy.env.workspace= "C:\Users\UserID\Desktop" mxdlocation=os.path.join(arcpy.env.workspace,mxdname) mxdloc = ...
0
votes
0answers
24 views

ArcGIS 10.3.x Python tool script - Automatically adding multivalue output feature class to display

I am developing a Python tool script in ArcGIS 10.3.x that is meant to be later published as a geoprocessing service. The tool script produces two output feature classes that I would like to ...
1
vote
2answers
54 views

Iterate over multiple shapefiles, changing year from “2014” to “2015” in file name

I have about 50 shapefiles I would like to change each of their file names which contains "2014" to "2015". I would like to use a python script but have not been able to figure out how to do it. I ...
1
vote
1answer
148 views

Arcpy.da.SearchCursor() help when attribute doesn't exist

I'm updating text elements off of an arcpy.da.SearchCursor script and needed to construct the script to return a response for when the attribute does NOT exist. Here is the snippet of the code THAT ...
0
votes
1answer
60 views

Python new packages installation with ArcGIS interpreter?

I would like to introduce some functions derived from scipyin my code. Since I also need arcpy, I use the Interpreter installed inside ArcGIS, whose directory is: (C:\Python27\ArcGIS10.3\python.exe). ...
1
vote
1answer
47 views

Appending Feature Class from Geodatbase to another using ArcPy?

I'm trying to write a python script to load feature class from an existing geodatabase to a new one, here is my script: import arcpy from arcpy import env import os import traceback #Set up ...
0
votes
0answers
24 views

Pixel based 10 year NDVI time series

I would to do pixel based 10 year NDVI time series analysis using MODIS data. I’ve 3 seasons in a year. Should I average all values in the study area per season?
0
votes
1answer
39 views

Finding field with maximum value and field name using ArcPy cursor?

I was wondering if an equivalent of summary statistics exists for finding such statistics across fields rather than records in a table. For example, of several fields, I wanted to find which one has ...
2
votes
1answer
52 views

How to set a python code to trigger on any update on a feature class

For example, when I have a geometry change on a point, I would like to update the X and Y fields to the new current location, I understand how to make the code, but not where do I set or put it to be ...
2
votes
3answers
111 views

ArcPy find points that are paired in time and space

I have a shapefile that that is time stamped and tracks two animals. I would like to create a field that denotes "together" based on proximity and location. And example of the data is: time ...
-1
votes
1answer
44 views

Trying to copy all feature classes from one folder to another folder using python but it failed to run

try: arcpy.env.workspace = "C:/WCGIS/Geog485/Lesson1" fcList = arcpy.ListFeatureClasses() for featureClass in fcList: arcpy.CopyFeatures_management(featureClass, "C:/WCGIS/Geog485/Lesson2/...
1
vote
0answers
18 views

Dataset C:\msurya\teritory.sd does not exist or is not supported Failed to execute (UploadServiceDefinition)

I am trying to execute the pythonscript code for the automation of a mapservice. While execution tempdraft.sddraft, and updatedDraft.sddraft files are automatically generated but .SD file has not ...
0
votes
0answers
54 views

Data Driven pages to PDF Python

I am trying to get a script to export each selected data driven page to a pdf. Basically I want each page of the data driven pages in its own PDF. I tried using the method from this page https://blogs....
2
votes
0answers
19 views

How to export specific DDPs from a set of DDPs?

I have a set of data driven pages and I would like to have a string parameter in the tool that allows me to export specific pages from the set of data driven pages. An example would be if I had a set ...
1
vote
2answers
27 views

Where are Service Area Layers? How to delete them?

Using arcpy I can make a service area layer in Network Analyst like this: outSAResultObject = arcpy.na.MakeServiceAreaLayer(inNetworkDataset, outNALayerName, ...
0
votes
1answer
53 views

Unable to calculate field correctly using ArcPy

I am attempted to calculate a field in a feature class ("Feat_Class_1", by using the count of selected features within another feature class ("Feat_Class_2") as a numerator, while using the value of a ...