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

Zooming in to selected features


Creating selection sets in ArcMap is a common task. Selection sets are often created as the result of an attribute or spatial query, but they can also occur when a user manually selects features and sometimes, under some additional circumstances. To better visualize selection sets, users often zoom to the extent of the selected feature. This can be accomplished programmatically with Python in several ways. In this recipe, you will learn how to zoom to all the selected features in a data frame as well as an individual layer.

Getting ready

The DataFrame.zoomToSelectedFeatures property zooms to the extent of all the selected features from all the layers in the data frame. Essentially, it performs the same operation as the Selection | Zoom to Selected Features operation. One difference is that it will zoom to the full extent of all the layers if no features are selected.

Zooming to the extent of selected features in an individual layer requires you to use the Layer...