Search icon CANCEL
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

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 2. Creating the First Python Script FREE CHAPTER 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

Adding an item to a web map

Once you have passed the credentials of your GIS or organizational account to the GIS object, you can access the items in your account and add them to a map. First, we can visualize all the items within your organization. To do this, we will import the IPython.display library and then we will use the content.search method to find all items with 'SF' in the description. After we have found all the items that have 'SF' in them, we can loop over each item and display them:

from IPython.display import display
items = gis.content.search('SF')
for item in items:
display(item)

The preceding code is implemented as follows:

Next, we can use a list comprehension to find SF_BusStops and add it to our sf_map object we created earlier:

add_item = [bus_item for bus_item in items if bus_item.title == "SF_BusStops"]
sf_map.add_layer...
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 €18.99/month. Cancel anytime