python: beyond the basics - esri ... python: beyond the basics, 2016 esri federal gis...

Download Python: Beyond the Basics - Esri ... Python: Beyond the Basics, 2016 Esri Federal GIS Conference--Presentation,

If you can't read please download the document

Post on 14-Jul-2020

0 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • Python: Beyond the Basics Carl Eichenberger

    February 24–25, 2016 | Washington, DC

    FedGIS Conference

  • Agenda

    • Perform non-GIS and GIS functions in a script tool • Data Access Module: Cursors • Geometries • Hot spot analysis • Mapping Module

  • Scenario

    Create a script tool that performs an Optimized Hotspot Analysis from values originating from a CSV file, add the results of the hotspot analysis to a MXD, and export the MXD to a PDF. This tool will use core Python functions (from Python CSV module) and GIS functions from the ArcPy site package.

  • Script Workflow

  • Define parameters for script tool

    • Import modules (CSV and arcpy) • arcpy.GetParameterAsText() • Begin with index position 0

  • Create points from CSV file

    • CSV reader object (Python CSV module) - Read coordinates from each row of CSV

    • Working with cursors and geometries - Add coordinates to arcpy.Point() object - arcpy.da.InsertCursor()

    - Create a new row - Add point object into shape field

  • Run Optimized Hot Spot Analysis tool

    Two hot spot analysis options • Hot Spot Analysis (Getis-Ord Gi*) • Optimized Hot Spot Analysis (new at 10.2) Hot spot vs density • Density shows where features are concentrated • Hot spot identifies spatial clusters statistically

  • Modify MXD and export to PDF

    • arcpy.mapping module Inventory map documents

    Update or repair layer data sources

    Update layer symbology

    Update or change layout elements

    Save a map document to a previous version of ArcGIS

    Update map document metadata

    Export map contents

    Create a map book series in PDF

  • Demo Run script tool

  • Resources

    • Accessing data with cursors: http://desktop.arcgis.com/en/desktop/latest/analyze/python/data-access-using- cursors.htm

    • Working with geometries: http://desktop.arcgis.com/en/desktop/latest/analyze/python/reading-geometries.htm

    http://desktop.arcgis.com/en/desktop/latest/analyze/python/writing-geometries.htm • Mapping module: http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-

    mapping/introduction-to-arcpy-mapping.htm • Error Handling: http://desktop.arcgis.com/en/arcmap/latest/analyze/python/error-

    handling-with-python.htm

    http://desktop.arcgis.com/en/desktop/latest/analyze/python/data-access-using-cursors.htm http://desktop.arcgis.com/en/desktop/latest/analyze/python/reading-geometries.htm http://desktop.arcgis.com/en/desktop/latest/analyze/python/writing-geometries.htm http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/introduction-to-arcpy-mapping.htm http://desktop.arcgis.com/en/arcmap/latest/analyze/python/error-handling-with-python.htm

  • Resources

    • Extra info based off of questions

    64-bit Background Geoprocessing (If you are processing lots of data) http://desktop.arcgis.com/en/arcmap/latest/analyze/executing-tools/64bit- background.htm Working with Oracle databases http://cx-oracle.sourceforge.net/index.html

    http://desktop.arcgis.com/en/arcmap/latest/analyze/executing-tools/64bit-background.htm http://cx-oracle.sourceforge.net/index.html

    Python: Beyond the Basics Agenda Scenario Script Workflow Define parameters for script tool Create points from CSV file Run Optimized Hot Spot Analysis tool Modify MXD and export to PDF Demo Resources Resources

View more >