Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ArcPy and ArcGIS

You're reading from   ArcPy and ArcGIS Automating ArcGIS for Desktop and ArcGIS Online with Python

Arrow left icon
Product type Paperback
Published in Jun 2017
Publisher Packt
ISBN-13 9781787282513
Length 272 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Silas Toms Silas Toms
Author Profile Icon Silas Toms
Silas Toms
Dara OBeirne Dara OBeirne
Author Profile Icon Dara OBeirne
Dara OBeirne
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Introduction to Python for ArcGIS FREE CHAPTER 2. Creating the First Python Script 3. ArcPy Cursors - Search, Insert, and Update 4. ArcPy Geometry Objects and Cursors 5. Creating a Script Tool 6. The arcpy.mapping Module 7. Advanced Analysis Topics 8. Introduction to ArcGIS Online 9. ArcPy and ArcGIS Online 10. ArcREST Python Package 11. ArcPy and ArcGIS Pro 12. ArcGIS API for Python

Integrated Development Environments (IDEs)

The Python interpreter contains everything that is needed to execute a Python script or to test Python code by interacting with the Python interpreter. However, writing scripts requires a text editor. There are usually at least two included simple text editors on a Windows machine (Notepad and WordPad), and they would work in an emergency to edit a script or even write a whole script.

Unfortunately, they are very simple, and do not allow the user functionality that would make it easier to write multiple scripts or very long scripts. To bridge the gap, a series of programs, collectively known as Integrated Development Environments (IDEs), have been developed. IDEs exist for all programming languages, and include functions such as variable listing, code assist, and more, which makes them ideal for crafting programming scripts. We will review a few of them later to assess their usefulness for writing Python scripts. The following three discussed are all free and well-established within different Python communities.

IDLE

Python includes an IDE when it is installed. To start it in Windows 7, go to the Start menu, and find the ArcGIS folder within the Programs menu. Then find the Python folder; IDLE will be one of the choices within that folder. Select it to start IDLE.

IDLE contains an interactive interpreter (that is, the famous triple chevron), and the ability to run whole Python scripts. It is also written using Python's built-in GUI module called Tkinter, so it has the advantage of being written using the same language that it executes.

IDLE is a passable IDE, which is useful if no other programs can be installed on the machine. It is also very useful for rapid testing of code snippets. While it is not my IDE of choice, I find myself using IDLE almost daily.

PythonWin

PythonWin includes an Interactive Window where the user can directly interact with the Python interpreter. Scripts can also be opened within PythonWin, and it includes a set of tiling commands in the Windows menu, which allows the user to organize the display of all open scripts and the Interactive Window. It is very popular for users of ArcPy and ArcGIS, but it has been eclipsed in use by the full-fledged IDEs described as follows.

Atom, Notepad++, and Sublime Text

Some text editors have full-fledged code editing capabilities, making them ideal IDEs. While Sublime Text is commercial, it is a powerful program, which allows for easy code editing across multiple operating systems. Similarly, Notepad++ for Windows is a powerful text editor that works well for editing code. Atom, available at https://atom.io/, is a product of the GitHub development team, and offers multiple powerful language options such as code completion and error highlighting.

All three of these advanced text editors recognize Python keywords and code structure, and will make it easy to indent code according to the rules of Python. I use them all, often interchangeably, and have no strong opinion about which one is better, though I prefer Atom and Sublime Text, as these can be used in multiple operating systems, while Notepad++ is only available for Windows. They are powerful IDEs, which are available for download from online sources.

IDE summary

There are many other IDEs, both commercial and free, available for coding in Python. In the end, each GIS analyst must choose the tool that makes them feel productive and comfortable. This may change as programming becomes a bigger part of their daily work flow. Be sure to test out a few different IDEs to find one that is easy to use and intuitive.

You have been reading a chapter from
ArcPy and ArcGIS - Second Edition
Published in: Jun 2017
Publisher: Packt
ISBN-13: 9781787282513
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image