Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
ArcPy and ArcGIS: Geospatial Analysis with Python

You're reading from   ArcPy and ArcGIS: Geospatial Analysis with Python Use the ArcPy module to automate the analysis and mapping of geospatial data in ArcGIS

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781783988662
Length 224 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (14) Chapters Close

Preface 1. Introduction to Python for ArcGIS FREE CHAPTER 2. Configuring the Python Environment 3. Creating the First Python Script 4. Complex ArcPy Scripts and Generalizing Functions 5. ArcPy Cursors – Search, Insert, and Update 6. Working with ArcPy Geometry Objects 7. Creating a Script Tool 8. Introduction to ArcPy.Mapping 9. More ArcPy.Mapping Techniques 10. Advanced Geometry Object Methods 11. Network Analyst and Spatial Analyst with ArcPy 12. The End of the Beginning Index

Exporting the model and adjusting the script

While modeling analysis in ModelBuilder has its drawbacks, there is one fantastic option built into ModelBuilder; the ability to create a model and then export the model to Python. Along with the ArcGIS help documentation, it is the best way to discover the correct Python syntax to use when writing ArcPy scripts.

Create a folder that can hold the exported scripts next to the SanFrancisco geodatabase (for example, C:\Projects\Scripts). This will hold both the exported scripts that ArcGIS automatically generates, and the versions that we will build from those generated scripts.

Open the model called Chapter3Model1 and click on the Model menu in the upper left. Select Export from the menu, and then select To Python Script. Save the script in the script folder as Chapter3Model1.py.

Note

Note that there is also the option to export the model as a graphic. Creating a graphic of the model is a good way to share what the model is doing with other analysts...

lock icon The rest of the chapter is locked
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