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)

1
vote
1answer
113 views

Arcpy Calculate Geometry (coordinates)?

Does anyone know if it is possible to Calculate Geometry with Arcpy? I need to replicate the command > Right click field and Calculate Geometry except with Arcpy as I need to integrate this into my ...
3
votes
1answer
61 views

How can I overwrite files in a geodatabase (outside the workspace environment)?

I initially set the workspace environment to a directory and included the option, arcpy.env.overwriteOutput=True, but at some point in my script, I convert a shapefile in that directory to a ...
3
votes
0answers
83 views

Select IDLE 2.7 (not 3.4) as default script tool editor for ArcPy with ArcGIS for Desktop?

I'm trying to set my default editor in ArcMap (10.3) to IDLE 2.7, but despite using the 2.7 path, when I right-click on a script tool and select Edit, it opens IDLE 3.4:
0
votes
1answer
55 views

Arcpy 10.3 add ins [closed]

I am working with arcpy 10.3 and i want to build a add-in. Unfortunately it's not working when i add a button like: import arcpy import pythonaddins class ButtonClass1(object): """Implementation ...
0
votes
2answers
138 views

SetNull() failing with input raster in ArcPy?

In ArcGIS 10.3, I am trying to use SetNull to identify streams in a raster based on an existing flow accumulation raster. The process involves setting all raster cells with flow accumulation value of ...
1
vote
1answer
41 views

How to access script (source) of custom tool stored in tbx?

I have few custom toolboxes, with script tools. I can access individual toolbar by: ToolBar=arcpy.ImportToolbox(toolbar_path) I can access each tool by iterating through ToolBar.__all__ I’d like ...
4
votes
2answers
168 views

Table does not contain OIDs arcpy Error 000339

I have a script I'm working on that takes a SQL table view and performs a Table to Table (arcpy.TableToTable_conversion) If I leave out the Where Clause the Table to Table works flawlessly, however ...
0
votes
1answer
129 views

Having arcpy.da.SearchCursor access only selected row in attribute table?

In ArcMap 10.2, I'm attempting to build a tool that, when run, will iterate through a network of pipes to locate an outfall point. My network is composed of polyline data representing pipe, with input ...
2
votes
1answer
60 views

Updating MXDs with arcpy

I am trying to loop through a bunch of mxds in a folder and make some changes, in this case in particular I am trying to replace a text string. This should change all instances of "9/26/2014" with the ...
1
vote
1answer
83 views

In_memory workspace in geoprocessing services

I have a arcpy python script that runs a process that I publish as a geoprocessing service on ArcGIS Server 10.3.1. The python script uses various input feature classes. These feature classes are ...
1
vote
1answer
57 views

Calculate Field not saving on joined layer

I'm joining a table to a layer file, calculating a field in the layer and then removing the join. The code below runs with no errors, but when I check the field in the attribute table, nothing has ...
3
votes
2answers
138 views

Calculate Field - getting the code value but not the description

If STREETNM value are blank or _ then I want to replace them with the value of ST_DESIG. My code below returned the code value of ST_DESIG but not the description. How can I get the description ...
0
votes
2answers
85 views

Why does script only work if run twice? [closed]

I have a simple script that I'm running as an ArcGIS tool that adds three fields and then calculates the fields based on expressions that derive information from existing fields. I'm struggling to ...
1
vote
0answers
66 views

Adding suite numbers to apartment building? [closed]

I wanted to know if there is an easier way to add apartment suite numbers to an apartment property? An example workflow of what I currently do to add a 400 level apartment building is add one point ...
0
votes
0answers
43 views

Return table names for query layers using arcpy

The dataSource property for layers does not return the name of the tables used in query layers. Instead, it returns something like the following: 'Database Connections\\ConnectionFile.sde\\sde.SDE.%...
0
votes
3answers
126 views

ArcPy Script Tool takes 30min - Ideas to accelerate the (raster) process

I developed an arcpy script tool that takes as input multiple rasters, a criterion to select specific cells from the raster which are then intersected with a point shapefile. At the end a value is ...
3
votes
2answers
45 views

Getting full path of empty sde feature datasets (Children property from arcpy.Describe object won't work))

My goal is to copy all the feature classes in a file geodatabase into an sde geodatabase, skipping those elements which already exist in the output sde gdb. Both geodatabases have the same feature ...
0
votes
0answers
17 views

Code to sift through many rasters and find rasters with errors using python [duplicate]

I would like a code to go through hundreds of rasters and print the names of the rasters that are problematic/don't work. I am trying to use the in cell statistics however I keep coming up with errors ...
1
vote
2answers
97 views

Translating ArcPy Commands to GDAL Equivalents? [closed]

I'm trying to figure out GDAL equivalencies to the following arcpy functions: arcpy.env.overwriteOutput() arcpy.MakeFeatureLayer_management() arcpy.SpatialJoin_analysis() arcpy.da.SearchCursor() ...
0
votes
1answer
28 views

Extract ASCII cells geographcal position

I have a task where I need to locate the geographical coordinates from a series of cells (indexed as row/column numbers) from an ASCII raster. How can I do that in Python or ArcGIS? I know the header ...
3
votes
1answer
50 views

Trying to create different sets of random points through ArcPy yet several of the files are duplicates?

I'm trying to create 50 sets of random point shapefiles in 37 different folders for a total of 1,850 random point shapefiles. However, upon running the script only a handful of sets are actually ...
1
vote
0answers
52 views

How do I edit stretched raster legend labels using arcpy?

I'm trying to edit a stretched raster legend item to only show values instead of the "High : " and "Low : " that are standard. I've created a layer template that doesn't include the high/low in the ...
1
vote
0answers
15 views

Is there a Guide to Translate ArcPy code to GDAL equivalent? [duplicate]

Due to cost-cutting measures I've been asked if I can migrate ArcPy code to a GDAL equivalent. I'm fairly new to GIS, ArcPy, and GDAL. Is there a website or guide which caters to providing ...
5
votes
1answer
59 views

Boolean test for file geodatabase having already been compacted?

We receive many 10.3 file geodatabases (fGDB) from a vendor. One contractual requirement is that the fGDB be compacted. Understandably we quality assure everything that comes in our door. Currently I ...
1
vote
1answer
69 views

Looping arcpy.mapping.updateLayers()?

I've got some problems with the following code, found on this answer to Is there a way to auto-update symbology between .mxds for the same shapefile? (Python?): import arcpy.mapping as mmap mxd = ...
1
vote
0answers
31 views

Installing Python/site packages on LAN server

I'm going to be sharing an ArcGIS script tool with coworkers and I want to store all necessary mxds, gdbs, and script files in one folder on the server so the file paths are absolute. However, the ...
1
vote
1answer
61 views

How does ArcGIS calculate zonal statistics with partially overlapping zones?

I am trying to get zonal statistics in ArcGIS. My zone raster is a world map with zones defined as "provinces (such as the US states)," and the value inputs are temperature data for each "longitude*...
0
votes
2answers
43 views

SpatialJoin_analysis with delimiter

SpatialJoin_analysis is not working with delimiter semicolon (;). It only worked with a comma delimiter (,) arcpy.SpatialJoin_analysis(Unique_Intersections, Streets_Unsplit, ...
1
vote
0answers
32 views

Merged Function doesn't function properly [duplicate]

I am trying to use Python scripts and merged my entry FCs in to the defined GDB. But, the system giving me the error that "ERROR 000735: Input Datasets: Value is required". The following attachments ...
0
votes
1answer
29 views

Unable to change default geodatabse with arcpy.env.workspace

Even after I set the path for the default database with arcpy environment variable, ArcMap does not change the default database directory? At first my arcpy.env.workspace looks like below: >>&...
2
votes
1answer
72 views

Finding problematic rasters in large set of rasters using ArcPy?

Just wondering if anyone knows how to quickly find rasters that cause errors when I attempt to process them in cell statistics (as I am trying to sum them). I have many hundreds of rasters and don't ...
0
votes
1answer
61 views

Merge function doesn't have output for all FCs, It has just first FC

The attached file is my script for merging different FCs as they get dissolve and join by the input FC. I don’t know why the output for merge does not include all FCs. import arcpy, os from arcpy ...
0
votes
1answer
63 views

updating field based on another field with arcpy.da.updateCursor

My code is very simple and it should work, but it doesn't. Perhaps another set of eyes can solve my issue... I created new field (this part works), then look up value of another field and depending on ...
0
votes
1answer
83 views

How to find a datasets spatial reference and apply it to another dataset?

I'm struggling to use the describe function to find the spatial reference of a given shapefile and then apply it to another shapefile which has been copied to a projected folder. I'm relatively new ...
1
vote
2answers
70 views

ArcToolbox Date default to today

In ArcToolbox I have a script (arcpy) that calculates some info plus a date into a database table. The date required to write is often (but not always) the current date, so the tool asks for input of ...
0
votes
0answers
47 views

To get field value from a first table and search it in a second table

I create a script that allow me to display field values from my first table. How can I get value display with print in order to serach it in a second table. If values displayed using print doesn't ...
3
votes
1answer
57 views

Script tool Error - ERROR 000735: Y Field (Latitude): Value is required Failed to execute (ConvertCoordinateNotation)

I've a python code which was working in ArcGIS 10, but now since I've migrated to 10.2.2 didn't work.Basically it's a toolset which runs a python script. The tool allow the user to input coordinates ...
0
votes
1answer
35 views

Shebang line for ArcGIS Desktop [closed]

I'm writing a script to be run on ArcGIS for Desktop, which only runs on Windows machines. Is there any use for a shebang line at its beginning, and if there is then what should it be (e.g. #!C:\...
2
votes
1answer
120 views

Convert 5 digit serial date to mm/dd/yyyy

I have imported a table from Excel that has one field (StartDate) to hold dates. When I imported the table it into ArcMap, the date values in that field changed from DD/MM/YYYY to a 5-digit number, e....
1
vote
0answers
65 views

arcpy symbologyType is always OTHER, but I need UNIQUE_VALUES

I am trying to load a TIF file to the mxd using arcpy, then add a definition file to map colouring. For one layer I have the problem, that the amount of values will always be different, sometimes it ...
1
vote
0answers
42 views

ArcPy Dissolve Statistics Fields - fixed into variable

How can I change this fixed POP column into my variable: field = parameters[1].valueAsText. It says syntax error everytime. StatField = "POP MIN;POP MAX" arcpy.Dissolve_management(in_features, ...
1
vote
2answers
57 views

Append daily rasters to monthly lists in Python Arcpy

I'm trying to go over a folder of geotiff rasters where the last three digits of the raster name is the julian date and I want to append the correct days to monthly lists (Jan-Dec) and then run Cell ...
2
votes
2answers
110 views

ArcPy Field Calculation within Loop

I am writing an ArcPy script that will run from a tool with user inputs. The user will select an input layer and output name/directory. I have my current code below. The tool will then do the ...
1
vote
1answer
51 views

Choosing “method” in Python Toolbox

I am trying to make these two methods variable, so the user could choose which method he wants to use. If the one with 3 classes or with 5. arr = arcpy.da.FeatureClassToNumPyArray(in_features, ...
0
votes
1answer
22 views

Is is possible to use arcpy statement for multiple fields? e.s. arcpy.Intersect_analysis()

I am new in both coding and GIS. Now I am trying something new for me, which is using the for loop to execute some of the arcpy statement. For example, the Intersect_analysis statement. Following is ...
0
votes
2answers
38 views

ArcGIS tells me 'raster' isn't defined

I am trying to get zonal statistics for a set of geographical units for several years and I would like to get the output in one dbf table, where the rows mark the geographical units and each column is ...
1
vote
1answer
42 views

foreground arcpy.mapping.MapDocument(“CURRENT”) in python script in single ArcMap produces createobject errors

I'm running ArcGIS 10.3.1. and desire to list layers in the current mxd. I'm using the "CURRENT" method... arcpy.mapping.MapDocument("CURRENT") ...within a python script tool, accessed via a single ...
0
votes
0answers
64 views

Multi-selection from Combo box in Python AddIn?

Is it possible to select more than one option from a combo box list in python Add ins for ArcGIS 10.x? Here is part of the code: def onFocus(self, focused): if focused: self....
2
votes
2answers
93 views

ArcPy: Excel to Table Conversion and Join Management

I am trying to join an Excel table to a shapefile in ArcPy. My first step is to convert the Excel sheet to a table, but I am receiving an error: #Convert xlsx to table: import os import xlrd import ...
0
votes
1answer
43 views

SelectLayerByLocation keeps giving error 000840: The value is not Boolean

I've seen a lot of questions asked and answered about trouble with the Select Layer By Location tool. Most ask about invalid input errors and the answer generally is to make sure to use layers (as ...