Helion


Szczegóły ebooka

Python for ArcGIS Pro

Python for ArcGIS Pro


Integrating Python into your day-to-day ArcGIS work is highly recommended when dealing with large amounts of geospatial data. Python for ArcGIS Pro aims to help you get your work done faster, with greater repeatability and higher confidence in your results.

Starting from programming basics and building in complexity, two experienced ArcGIS professionals-turned-Python programmers teach you how to incorporate scripting at each step: automating the production of maps for print, managing data between ArcGIS Pro and ArcGIS Online, creating custom script tools for sharing, and then running data analysis and visualization on top of the ArcGIS geospatial library, all using Python.

You'll use ArcGIS Pro Notebooks to explore and analyze geospatial data, and write data engineering scripts to manage ongoing data processing and data transfers. This exercise-based book also includes three rich real-world case studies, giving you an opportunity to apply and extend the concepts you studied earlier.

Irrespective of your expertise level with Esri software or the Python language, you'll benefit from this book's hands-on approach, which takes you through the major uses of Python for ArcGIS Pro to boost your ArcGIS productivity.

  • Preface
    • Who this book is for
    • What this book covers
    • To get the most out of this book
    • Get in touch
  • Introduction to Python Modules for ArcGIS Pro
  • Introduction to Python for GIS
    • Python: Built different
      • Python versions
      • ArcGIS Python versions
      • What is Python?
        • Where is it installed?
        • Python interpreter
        • What is a Python script?
        • Executables included
        • How to call the executable
        • IDLE development environment
        • Windows file path issues
        • The operating system and Python system modules
    • The basics of programming
      • Variables
        • Variable formatting rules
        • Assigned to vs is equal to (value comparison)
      • Data types
        • Checking the data type
        • Strings
        • Integers
        • Floating numbers
        • Conversion between strings, integers, and floats
      • Data structures or containers
        • Tuples
        • Lists
        • Sets
        • Dictionaries
      • Iteration
        • For loops
        • While loops
        • Counters and enumerators
      • Conditionals
        • If versus else
      • Zero-based indexing
        • Data extraction using index position
        • Data extraction using reverse index position
      • Functions
        • Components of a function
        • Namespaces
        • Function examples
      • Classes
    • Installing and importing modules
      • Using pip
      • Installing modules that are not in PyPI
        • The setup.py file
        • Wheel files
      • Installing in virtual environments
      • Importing modules
        • Three ways to import
        • Importing custom code
        • The site-packages folder
    • Basic style tips for writing scripts
      • Indentation
      • Using print statements
      • Structuring a script
    • Summary
  • Basics of ArcPy
    • Checking your ArcPy install
      • Using the correct Python IDLE Shell
      • Using the Python IDLE Shell
      • The Python window in ArcGIS Pro
    • ArcPy environment settings
    • ArcPy tools: Geoprocessing using ArcPy
    • Built-in ArcPy functions
      • The Describe function
      • List functions
        • The wildcard parameter
        • Combining wildcard and feature type parameters
    • Introduction to ArcPy modules
      • Spatial Analyst module
    • Summary
  • ArcGIS API for Python
    • What is the ArcGIS API for Python?
      • ArcGIS API modules
      • What does it do and why use it?
    • The Python Package Manager
      • Python environments
      • How to create a new virtual environment
    • ArcGIS Pro Notebooks
      • Creating a Notebook in ArcGIS Pro
        • Creating your first Notebook
        • ArcGIS Notebook structure
        • Keyboard shortcuts
      • Connecting to ArcGIS Online or ArcGIS Enterprise
        • Anonymous users
        • ArcGIS Pro connection
        • Built-in users
      • Creating a Notebook
    • Using the gis module to manage your GIS
      • Searching for data, users, or groups
        • Searching for public data as an anonymous user
        • Searching for data when connected to your organization
        • Managing users
    • Summary
  • Applying Python Modules to Common GIS Tasks
  • The Data Access Module and Cursors
    • Walking through a directory to find data
      • arcpy.da.Walk
      • arcpy.da.Walk exercise
        • Unzipping files using os.walk
        • Copying shapefiles to feature classes using arcpy.da.Walk
    • Cursors
      • Search cursor
        • Accessing the geometry of a feature class
        • Using a search cursor with a data dictionary as a lookup value
      • Update cursor
      • Insert cursor
    • Summary
  • Publishing to ArcGIS Online
    • Using ContentManager for publishing and organizing data
      • Publishing data
        • Adding data from a CSV
        • Adding and publishing tips
      • Organizing data and managing groups and users
        • Organizing data into a folder
        • Accessing and managing groups
    • Using the features module to work with feature layers
      • Querying feature layers
      • Editing features
      • Appending features
    • Using the mapping module to visualize your data
    • Summary
  • ArcToolbox Script Tools
    • Introduction to script tools
    • How to create a script tool
      • Script tool General settings
      • Script tool Parameters tab
      • Script tool Validation
      • Writing messages
    • Exercise: Turning scripts into tools
      • Exporting a Notebook to a script in ArcGIS Pro 2.8
      • Copying and pasting cells to a script in ArcGIS Pro 2.7
      • Modifying a script to accept user input in the script tool
      • Creating your script tool in ArcGIS Pro
      • Running and testing the script tool
      • Updating the script tool to take census geography files
      • Testing input parameters
      • Adding custom messages
      • Testing the finished script tool
        • Testing SQL with Contra Costa Tract data
        • Testing the script with California county geography
        • Testing the script with a space in the area name
    • Summary
  • Automated Map Production
    • Referencing projects and maps within projects
    • Updating and fixing data sources
      • Fixing broken links
    • Working with layers
      • Adding, moving, and removing layers
      • Layer symbology
    • Layouts
      • Layers
      • Layout elements
        • Legend
        • North arrow, scale bar, and text
      • Exporting layouts
    • Summary
  • Geospatial Data Analysis
  • Pandas, Data Frames, and Vector Data
    • Introduction to Pandas
      • Pandas DataFrames
      • Pandas Series
      • Spatially Enabled DataFrames
      • Installing Pandas
      • Getting data into (and out of) a Pandas DataFrame
        • Reading data from a file
        • Writing data to a file
    • Exercise: From GeoJSON to CSV to SHP using Pandas
      • Normalizing the nested JSON data
      • Joining data frames
      • Dropping columns
      • Creating a CSV
      • Creating a Spatially Enabled DataFrame from a DataFrame
      • Dropping NaN values using dropna
      • Querying the data frame
      • Publishing the data to ArcGIS Online
      • Converting an ArcGIS Online layer to a DataFrame
      • Indexing and slicing DataFrame rows and columns
    • Summary
  • Raster Analysis with Python
    • Raster data objects
      • Creating a new blank raster
      • Reading and copying raster properties
      • Creating a raster object from an existing raster
      • Saving a raster
      • Accessing the raster properties
        • Accessing raster and cell value properties
        • Geographic properties
    • ArcPy Raster tools
      • The Spatial Analyst toolset and the sa module
        • Generating a raster object
        • Statistical raster creation tool
        • Conditionals
        • The Hillshade tool
        • The Conditional tool
      • Map Algebra
        • Shorthand operators for Map Algebra
    • Using arcgis.raster
      • Working with imagery layers
        • Plotting a histogram
      • Working with raster layers
    • Summary
  • Geospatial Data Processing with NumPy
    • Introduction to NumPy
      • Advantages of NumPy arrays
      • NumPy arrays versus Python lists
      • Importing NumPy
    • Basics of NumPy for rasters
      • Creating an array
      • Reading a raster into an array
      • Array properties
        • Size
        • Shape
        • Data type
      • Accessing specific elements
      • Accessing a subset of the array
      • Slicing a raster
      • Concatenating arrays
      • Creating a raster from a NumPy array
      • Mathematical operations with NumPy
      • Array queries
    • Exercise: Statistical analysis of raster data using NumPy
      • Creating charts from NumPy arrays using Matplotlib
    • Summary
  • Case Studies
  • Case Study: ArcGIS Online Administration and Data Management
    • Case study: Administering your ArcGIS Online account
      • Creating users
      • Assigning licenses and credits
      • Creating reports for item usage
      • Reassigning user data
        • Transferring data to a different user and creating a new folder
        • Transferring data to a different user with an existing folder
    • Case study: Downloading and renaming attachments
    • Summary
  • Case Study: Advanced Map Automation
    • Case study introduction
    • Setting up a layout for map automation
      • Source text element
      • Inset map frame
      • DetailsHeader and DetailsBox text elements
      • Legend element
      • Legend Item elements
      • Scale bar and north arrow elements
        • Scale bar
        • North arrow
      • Title text element
        • Map Frame element
    • Creating and adding data to your map
    • Working with legend and text elements in the layout
    • Changing the map view and exporting
    • Summary
  • Case Study: Predicting Crop Yields
    • Case study introduction
      • Data and study area
      • Data concepts
    • Downloading datasets
      • World countries
      • Population
      • Rainfall
      • Agricultural land
      • Crop yields
      • Pesticide and fertilizer use
      • Temperature change
    • Cleaning up and combining the data
    • Fitting a random forest model
    • Loading the result into ArcGIS Online
    • Generating an HTML file using ArcGIS API for JavaScript
    • Summary
  • Other Books You May Enjoy
  • Index