Download - Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation
![Page 1: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/1.jpg)
Overview
Cursors
arcpy.da module
Geometrys
Arrays
SpatialReferences
Licensing and Installation
![Page 2: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/2.jpg)
arcpy.*Cursor functions
![Page 3: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/3.jpg)
SearchCursor Syntax
![Page 4: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/4.jpg)
SearchCursor Example
![Page 5: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/5.jpg)
Update Cursor Syntax
![Page 6: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/6.jpg)
Update cursor example
![Page 8: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/8.jpg)
InsertCursor Example
![Page 9: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/9.jpg)
Insert/Update and Locked data
Can not Insert/Update if data is lockedFeature class or table can be locked if it is:
Part of a map in an MXD that is open in ArcMapPart of a workspace being viewed by ArcCatalog
Best practices include:Exit ArcGIS applications when running scripts that create or modify tables or feature classesDelete cursor objects when you have finished using them …
![Page 10: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/10.jpg)
The Data Access (da) module
arcpy.da.Walk( ) – an ArcGIS-aware version of os.path.walk ( )
New at 10.1
![Page 11: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/11.jpg)
SearchCursor Function and Classarcpy Function
arcpy.da Class
![Page 12: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/12.jpg)
SearchCursor Function and Class Example
262 sec for Function0.66 sec for Class~ 400 times faster in this case
Output:
arcpy.da.SearchCursor Class syntaxSearchCursor (in_table, field_names, {where_clause}, {spatial_reference}, {explode_to_points}, {sql_clause})
arcpy.SearchCursor Function syntaxSearchCursor (dataset, {where_clause}, {spatial_reference}, {fields}, {sort_fields})
![Page 13: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/13.jpg)
The Geometry Class
![Page 14: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/14.jpg)
Geometry Properties
![Page 15: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/15.jpg)
Geometry Methods
… and clipcontainsconvexHullcrossesdifferencedisjointdistanceToequalsgetAreagetLengthgetPartintersectoverlapspositionAlongLineprojectAssymmetricDifferencetouchesunionwithin
![Page 16: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/16.jpg)
Reading geometries
![Page 17: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/17.jpg)
Writing geometries using Python
Problem: We have a text file containing a line identifier andx,y coordinates that we would like to use to createpolylines in an new feature class similar to an existing feature class
Solution:Create a script tool that has two inputs (text file name andtemplate feature class) and one output feature class.The script will - Create a new feature class based on the template feature class- Read the ID and coords for each line from the text file- Use an insert cursor to add each line to the new feature class
![Page 18: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/18.jpg)
Before writing polylines to a feature class …
… need some other background
Polylines are created from an array of points
How is a point created?How is an array points created?
![Page 22: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/22.jpg)
Polyline
![Page 23: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/23.jpg)
Writing geometries using Python
For Update/InsertCursor objects, test your scripts on a copy of the dataset. It is sometimes hard to undo modifications to data!
Input file structure:
![Page 24: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/24.jpg)
Spatial reference and cursors
![Page 25: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/25.jpg)
Creating a spatial reference
![Page 26: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/26.jpg)
Licensing and Installation
![Page 27: Overview Cursors arcpy.da module Geometrys Arrays SpatialReferences Licensing and Installation](https://reader036.vdocuments.net/reader036/viewer/2022081512/56649e745503460f94b74c4c/html5/thumbnails/27.jpg)
Licensing and Installation
Check to see if a license is available
Returns license to license manager
Check out license from license manager
See if requested product is available
Information about installation
Install types that used with GetInstallInfo
Current product license
Legacy … replaced by