Python toolboxes are created entirely using Python in ArcGIS for Desktop and stored as *.pyt files

learn more… | top users | synonyms

1
vote
1answer
42 views

How to add a script tool in a toolbox without the Add Script Wizard?

I have been put on a project where I need to modify and optimize an existing PythonToolbox and associated Toolbar (each button calls a script). I want to add a new script tool in there but the Add ...
3
votes
0answers
28 views

Defining a required output field parameter for an existing or a new field

I need to define a required field parameter, and I'd like it to work with both existing and new fields, i.e. regardless of whether the field already exists. Here is what I have in ...
4
votes
1answer
67 views

How to get fieldnames in a value table depending on the input value

I would like to add a parameter as value table with one of the fields being a value list. The value table consist of 3 columns, namely "table","field","description", whereas "field" is a value list. ...
1
vote
1answer
55 views

Python Script GetParameterAsText?

I am writing a python script to be added to a toolbox and I do not know how to call an existing tool to be a parameter. import geocoder ##geocoding library import csv import arcpy ...
4
votes
1answer
31 views

Getting points digitized in Web AppBuilder geoprocessing widget back over to original coordinate system for calculations?

This is a follow-up question to Having two input feature layers and derived output feature layer in ArcGIS Python Toolbox tool?. The following Python Toolbox tool accepts one or more points from the ...
3
votes
2answers
57 views

Having two input feature layers and derived output feature layer in ArcGIS Python Toolbox tool?

I'm unable to find an example of an ArcGIS Python Toolbox similar to the one I'm trying to get to work. The standalone python script works beautifully. Turning it into a Python Toolbox so I can use ...
1
vote
1answer
36 views

Creating new layer in ArcGIS for Desktop with Python Toolbox?

I would like to create new shapefile layer or memory layer with one point with certain coordinates in ArcGIS 10.2 with Python Toolbox. Which function should I use? I wrote this code: import arcpy ...
1
vote
0answers
70 views

Command works in Console, but not in Python Toolbox

I want to create a memory layer with points in ArcGIS with Python Toolbox. I found an in_memory function. Here is the question: Why this command works in Python Console in ArcGIS, but not in Python ...
0
votes
0answers
22 views

Save update feature class (Python toolbox)

I created a Python Toolbox tool to reorder fields I am trying to save the feature class determine path,any advise? here is acode I'm trying: import arcpy import os class Toolbox(object): def ...
3
votes
1answer
42 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 ...
1
vote
1answer
48 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, ...
1
vote
1answer
33 views

Private functions in Python Toolbox

Is it OK to have private functions in a python toolbox? I know it's possible because I tried. But I don't know if that's OK, I haven't seen anything in the Internet where someone from ESIR is using ...
2
votes
2answers
117 views

ArcPy Calculate Null Values to Zero in Multiple Fields

I have a table that has Null values and I would like to insert a portion in my script to calculate these Null values to 0 in only a few of my columns in my table. Here is my script so far: with ...
0
votes
1answer
50 views

Populating the drop down of GPValueTable

In a Python Toolbox the user has to select a city from a list of 50 world cities. More than one city can be selected. The best UI control for that would be Autocomplete / Autosuggest, but since this ...
1
vote
1answer
66 views

Spatial Join in Python Field Mapping with Multiple Merge Rules

I'm performing a Spatial Join with a polygon (target) and a point (joinFeature)- which has 5 fields in it that I need to "sum". I have written a Spatial Join and (after many long days) gotten the ...
1
vote
1answer
45 views

Graph preview in Python toolbox

I need to create a toolbox in python, which will be used for making graphs. I need the parallel preview window during the graph creation. Half of the screen will be used for settings the parameters ...
2
votes
2answers
107 views

AttributeError: 'Layer' object has no attribute 'listLayers'

I want to use the result of OD cost matrix for my further calculations. However, whne I try to extract the sublayer "lines" it returnes an error AttributeError: 'Layer' object has no attribute ...
8
votes
1answer
179 views

Do ArcGIS Pro tasks support Python Toolbox tools which operate on Map Frames?

Do ArcGIS Pro tasks support Python Toolbox tools which operate on Map Frames? The reason I ask is that I am stuck when trying to do the following: Start ArcGIS Pro 1.1.1 Create a new project - I ...
0
votes
0answers
138 views

Geprocessing Service: ERROR 000816: The tool is not valid. .Pyt file is fine but .tbx has red x's

I have a .pyt Python toolbox which runs fine in ArcMap and then gives the dreaded "ERROR 000816: The tool is not valid" when published as a GP Service. I've dealt with this issue many times before, ...
3
votes
3answers
188 views

Forcing Python Toolbox tool to break loop and do cleanup when user clicks Cancel?

I am writing a Python tool that perform heavy tasks in a loop. When the user clicks "Close" I want to break the loop, perform some cleanup, and then finish. Consider this example tool that counts ...
3
votes
2answers
190 views

Problem creating parameters for a tool

I am still an arcpy newbie, but I think I have a basic understanding of fundamentals including syntax, variables, modules, etc. My question is regarding the usage of parameters while creating a tool. ...
3
votes
3answers
413 views

why is python toolbox script not working standalone in PyScripter?

I am learning Python Toolboxes with PyScripter. I have a test python toolbox that outputs a raster file. It works when run from ArcCatalog. As I understand it, it should also run standalone within ...
2
votes
1answer
62 views

Only Black & White text in Python editor in ArcGIS for Desktop?

When opening IDLE or Pyscripter in ArcGIS by right clicking on a toolbox and Edit... the specified editor opens with the code - BUT all text is only black and white not the context colors of blue, ...
4
votes
1answer
145 views

Setting “Always run in foreground” within ArcPy code?

Is it possible to set the "Always run in foreground" option within ArcPy code? I haven't found anything on this yet? It would be nice to be able to specify within a script, instead of through the ...
2
votes
1answer
93 views

How to properly handle a multi-column value table in an ArcGIS Python toolbox?

I am building a relatively simple python tool for ArcGIS 10.3 which will automate the process of generating summary statistics for multiple raster datasets, for polygons in a polygon dataset, using ...
0
votes
0answers
51 views

Python toolbox - get lat and long from tables

The objective of the python toolbox is to convert a bunch of tables to point feature classes. The user selects the tables (parameter 0 - multivalue). The user selects the output workspace where the ...
1
vote
1answer
57 views

Datatype and filter for a SDE connection parameter in a Python toolbox?

I have a tool in a Python toolbox. As a parameter, I want to let the user select an existing (or possibly create a new) SDE connection. What value for datatype should I use for this? I have tried ...
2
votes
2answers
50 views

Setting Python Toolbox Parameter to None without making current selection value unselectable thereafter?

I'm making a python toolbox and it has an input parameter of type GPFeatureLayer. Let's call it my_param. In updateParameters when my_param.altered, its value is added to a value table. Then I'd ...
0
votes
1answer
168 views

How to set parameter dependencies in ArcGIS python toolboxes

I'm trying to build a python-toolbox where the user selects a layer and then specifies a column in that layer. According to the documentation, that is done via the parameterDependencies attribute of ...
2
votes
1answer
61 views

Disable column of Value Table in Python Toolbox?

Can I disable a column based on another column? Let's say I have a column to choose a field type (Short, String and so on) and a second column to choose the max length of a string. I would like to ...
1
vote
2answers
67 views

How to get and create featureclasses in Python toolboxes?

I'm writing my first python toolbox. I know there's a way to do this in batch processing, but for proof of concept I want to write this pyt tool to call the Clip tool and add the resulting ...
3
votes
1answer
99 views

GeoProcessing Tool Parameter: CoordinateSystem vs SpatialReference

So I'm adding a couple tools to my python toolbox. Most of the time I just used CoordinateSystem and leave good enough alone. Today I tried SpatialReference and noticed the result is the same. The the ...
1
vote
2answers
52 views

how to export fclist and fccount to csv

i am looking for a method by which i can export fc list and fc count into xls or csv. for example i have 3 featureclass in Scratch.gdb. 1.PaLakh 2.PATest1 3.Point i want all 3 of these ...
1
vote
2answers
290 views

How to pass only selected features in python toolbox

I have a feature class in a file geodatabase. I want to select features from the feature class and export their attribute to an excel sheet. I need a python tool in ArcGIS which does this. My problem ...
1
vote
1answer
111 views

How to create an ArcGIS toolbox programmatically?

Is it possible to programmatically create an ArcGIS toolbox? The aim is to write a plugin that works in ArcGIS and have a single source for the tool parameters which is then compiled to an Arc ...
3
votes
1answer
156 views

Downgrading WRF Hydro GIS Pre-Processing Tools 2.2 to work with ArcGIS Desktop 10.0?

I have just come across the WRF Hydro GIS Pre-Processing Tools for the first time. The version I am looking at is 2.2 and its documentation says: The processing workflow for creating WRF-Hydro ...
2
votes
0answers
59 views

Altering input files in a Python toolbox? [closed]

I'm trying to add a temporary field to one of the input feature classes in my Python toolbox. arcpy.AddWarning("Adding field of type " + fieldType.upper() + " to FC " + varFC + " called " + ...
0
votes
2answers
215 views

Getting parameter defined in one tool to another tool in same Python Toolbox?

This is what I am looking for: Create two tools in Python Toolbox: Tool1 and Tool2 (I am able to do that) I want to define a parameter in Tool2 whose value depends on parameter entered by user in ...
2
votes
3answers
600 views

arcpy.mapping.MapDocument(“CURRENT”) fails when running python script in background as tool

The engineers I work with have requested an autosave feature for ArcGIS, so I thought I'd make them a python tool that routinely saves. The script works fine when run in the foreground, but fails when ...
1
vote
1answer
315 views

Select from a list of string variables in a custom Python ArcGIS tool?

I've made a few Python tools for ArcGIS lately and haven't had to use this idea in my tools until now. I am making a looong tool that will deal with 13 different districts worth of data. I want the ...
3
votes
1answer
242 views

Creating a ValueTable with a column that has dependency

I am creating a python tool which looks like the figure below. Input feature: It asks for a input feature class. Valuetable(Lookup tables): It has two columns - one for look up tables and another ...
1
vote
1answer
172 views

How to publish python toolbox with lots of tools in ArcGIS Server 10.3?

I have python toolbox with like 40 tools and I need a quick way to publish the whole toolbox. I found some instructions in the documentation, they state that every tool should be executed and their ...
1
vote
2answers
216 views

Creating tool in Python toolbox to export field list to Excel?

I am creating my first tool in a Python Toolbox (*.pyt) to export a list of fieldnames to Excel. I have the following bits of code: import arcpy class Toolbox(object): def __init__(self): ...
0
votes
1answer
112 views

Creating Python Toolbox (*.pyt)?

I would like to create a new shapefile based on input. My input is DATE parameter. This is my code for input parameter: param = arcpy.Parameter( displayName="TARIKH", name="date_feature", ...
0
votes
0answers
48 views

updateParameter() python toolbox

I can't update parameters in my Python Toolbox and I don't understand why. Someone can help me with this example code? class Tool(object): def __init__(self): self.label = "Tool" ...
2
votes
1answer
49 views

Searching for value in layer without opening MXD file?

As part of the validation for parameters of a Python toolbox, I need to check if the text in parameter #1 is exists in a layer in a MXD file selected as parameter #2. Currently, I use this code in ...
0
votes
0answers
37 views

Select Data in ModelBuilder Error 000622 and 000800

How to build a model takii way to avoid this error? I need to layer the missing tool is created automatically or miss it and extending those layers in MXD are available in gdb ... More specifically, I ...
5
votes
2answers
302 views

Python toolbox tool objects do not remember instance variables between function calls?

I am developing a Python toolbox, and came across a peculiar behavior: The tool objects does not remember any instance variables between function calls. Consider this code: import arcpy class ...
1
vote
1answer
74 views

Multi Input Python Toolbox in Arcgis

I use Python toolbox in arcgis, it is possible to add a multiple input file table? And is possible to filter input files allowed by extension?
0
votes
1answer
150 views

Is there a script to Python for Click to toggle selectable?

I cannot write a script using ArcPy (Click to toggle selectable). To make a layer unavailable for sampling! I just need to create a tool to automate several processes, one of them is the ability to ...