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
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

Inserting a polyline geometry

To create and insert a polyline-type shape field from a series of points, it's best to use the SHAPE@ keyword. We will also further explore the ArcPy Geometry types, which will be discussed in the next chapter. When working with the SHAPE@ keyword, we have to work with data in ESRI's spatial binary formats, and the data must be written back to the field in the same format using the ArcPy Geometry types.

To create a polyline, there is one requirement, at least two valid points made of two coordinate pairs. When working with the SHAPE@ keyword, there is a methodology to converting the coordinate pairs into an ArcPy Point and then adding it to an ArcPy Array, which is then converted into an ArcPy Polyline to be written back to the shape field:

listOfPoints = [(6002672.58675, 2092447.04362),
               (6003672.58675, 2093447.04362),
               (6004672.58675, 2094447.04362)
               ]
line = 'New Bus Line'
lineID = 12345
busLine...
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