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

Coding differences between ArcGIS for Desktop and ArcGIS Pro


In this section, we'll discuss some of the differences between Python code written in ArcGIS for Desktop and ArcGIS Pro. Fortunately, there aren't many differences.

ArcPy supports a variety of modules, including the data access, mapping, spatial analyst, network analyst, and time modules. As you have already learned, to use these modules, you must first import them into your script. For most of these modules, the way that you import them will be the same regardless of whether you're using ArcGIS for Desktop or ArcGIS Pro. However, there are some differences when importing the ArcPy mapping module.

In the ArcGIS Pro Python environment, you'll need to use the following syntax to import the mapping module. The use of a two-character reference to the mapping module is in line with how all the other modules are imported:

import arcpy.mp

This differs from how you reference the ArcPy mapping module in ArcGIS for Desktop, as seen in this code...