Book Image

Programming ArcGIS with Python Cookbook, Second Edition

By : Eric Pimpler
Book Image

Programming ArcGIS with Python Cookbook, Second Edition

By: Eric Pimpler

Overview of this book

The book kicks off with the fundamentals of starting to use Python with ArcGIS, followed by recipes on managing map documents and layers, including how to find and fix broken data links in these files. In the second part of the book, you will learn to create custom geoprocessing tools and how to use the Attribute and Location tools to select specific features. The third part of the book covers topics for advanced users including the REST API, and also teaches you how to use Python with ArcGIS Pro. The book finishes with appendices covering how to automate Python scripts, and the five things that should be at the back of every GIS programmer's mind.
Table of Contents (17 chapters)
16
Index

Converting ArcGIS for Desktop Python code to ArcGIS Pro


As I mentioned earlier in this chapter, there aren't many differences between the Python code you would write for ArcGIS for Desktop and ArcGIS Pro. We've already discussed the primary differences between the two. The versions of Python used are quite different with ArcGIS for Desktop 10.3, which runs Python 2.7 and ArcGIS Pro 1.0, which runs Python 3.4. These two versions of Python are incompatible and there are some tools that you can use when migrating your existing code to ArcGIS Pro.

The first tool that we'll examine is the AnalyzeToolsForPro. This geoprocessing tool can be found in the Management toolbox. This tool analyzes Python scripts and custom geoprocessing tools, and toolboxes for functionalities that are not supported by ArcGIS Pro. This tool will identify any geoprocessing tools and environment settings that are not supported by ArcGIS Pro, the replacement of arcpy.mapping with arcpy.mp, and any unsupported data formats...