Top Banner
Python Beyond the Basics …. Ghislain Prince Jeff Bigos
25

Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Jan 13, 2016

Download

Documents

Brittney Potter
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Python Beyond the Basics ….Ghislain Prince

Jeff Bigos

Page 2: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

ComprehensionsComprehensions

CursorsCursors

ModulesModules

GeometryGeometry

Page 3: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Comprehensions

Page 4: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Comprehensions

• List Comprehensions- Loop and filter items from an existing list

- List is returned

Page 5: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Comprehensions

• List Comprehensions- Loop and filter items from an existing list

- List is returned

Page 6: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Comprehensions

• List Comprehensions- Loop and filter items from an existing list

- List is returned

Page 7: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Comprehensions

• List Comprehensions- Loop and filter items from an existing list

- List is returned

Page 8: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Comprehensions

• Dictionary Comprehensions- Loop and filter items from an existing Dictionary

- Dictionary is returned

Page 9: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Comprehensions

• Dictionary Comprehensions- Loop and filter items from an existing Dictionary

- Dictionary is returned

Page 10: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Comprehensions

• Dictionary Comprehensions- Loop and filter items from an existing Dictionary

- Dictionary is returned

Page 11: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Cursors

Page 12: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Cursors

• Two varieties- Arcpy.da cursors (10.1 onwards)

- ‘Classic’ cursors

Type Function

SearchCursor Read-only

UpdateCursor Update or delete rows

InsertCursor Insert rows

Page 13: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Understanding Data access Cursors

• Fields parameter - Index position in fields parameter defines value access

- Provide needed fields

Page 14: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Understanding Data access Cursors

• Fields parameter - Index position in fields parameter defines value access

- Provide needed fields

Page 15: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Understanding Data access Cursors

• Where Clause- Filters the records returned

• Spatial Reference- Project data on the fly

Page 16: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Geometry

Page 17: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.
Page 18: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Creating Geometry

Page 19: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

• List of coordinates- *coords

Creating Geometry

Page 20: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

• Relational:- Is a point within a polygon

- Return Boolean Values

Geometry Operators

Page 21: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

• Contains:

Geometry Operators

• Crosses: • Touches:

• Additional Methods in the documentation

Page 22: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Modules

Page 23: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Modules: Included with python

- urllib: functions and classes for using internet resources- Urlencodings, POST, GET

- json: work with json data- Encoding, decoding

- zipfile: create and extract from zipfiles

- Resources:- Python help: Global Module Index

- Python module of the week

Page 24: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.

Modules: Included with ArcGIS

- numpy: n- dimensional array- Spatial Analyst, arcpy.da conversion functions

- matplotlib: Graphing and Charting- Spatial Statistics visual outputs

- xlrd / xlwt: read and write excel files- Used in the excel toolset

- Resources:- Python help: Global Module Index

- Python module of the week

Page 25: Python Beyond the Basics …. Ghislain Prince Jeff Bigos.