Book Image

Programming ArcGIS with Python Cookbook, Second Edition

By : Donald Eric Pimpler, Eric Pimpler
Book Image

Programming ArcGIS with Python Cookbook, Second Edition

By: Donald Eric Pimpler, Eric Pimpler

Overview of this book

Table of Contents (22 chapters)
Programming ArcGIS with Python Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using a ValueTable to provide multivalue input to a tool


Many geoprocessing tools have input parameters that accept more than one value. For example, the multiring buffer tool accepts multiple buffer distances, the delete field tool accepts multiple fields that can be deleted, and there are many other examples. In this recipe, you will learn how to create a ValueTable object that serves as multivalue input to a tool.

Getting ready

There are three ways to specify a multivalue parameter: as a Python list, a string with each value separated by semicolons, or an ArcPy ValueTable object. In this recipe, we're going to take a look at how to specify mutlivalue input parameters by using ValueTable.

How to do it…

Follow these steps to learn how to use a ValueTable to submit multiple values to a tool:

  1. Open IDLE (or your favorite Python development environment) and create a new script called ValueTable.py.

  2. Import arcpy and set the workspace:

    import arcpy
    
    arcpy.env.workspace = r"c:\ArcyBook\data"
  3. Create a...