Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of...

22
arcpy.Describe and arcpy.List*
  • date post

    22-Dec-2015
  • Category

    Documents

  • view

    241
  • download

    1

Transcript of Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of...

Page 1: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

arcpy.Describe and arcpy.List*

Page 2: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

Describing objects

ArcGIS interacts with a number of types of objects

arcpy.Describe(object) exposes object properties that can be used in Python to control program flow, tool parameter values, etc. of geoprocessing scripts

e.g. Clip all polyline feature classes in a workspace.

Page 3: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

Overview

gp.Describe(object) Describe object

gp.List* Python list of objects

ArcGIS 9.3

ArcGIS 10arcpy.Describe(object)arcpy.List*

Page 4: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

9.2 9.3

Evolution Describe Object Properties

An example of how Python is evolvingwith ArcGIS

Page 5: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

Describing data in 10.x

Page 6: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

Describe Example (feature class)

… if you plan to do multiples in same workspace

Page 7: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

Describe a Feature Class

Page 8: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

Describe a Geodatabase

some are case sensitive, others notarcpy.env.workspace is

Page 9: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

Fields in a Feature Class via Describe

ArcGIS 8.x, 9.x

ArcGIS 10

Page 10: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

Describe a Raster

Page 11: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

List functions

Scripts allow you to iterate through lists

arcpy provides many list functions that create lists of objects

e.g. For each feature class in a given workspace, create a report that shows how many are point, line, and polygon (uses ListFeatureClasses and Describe)

Page 12: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

Lists of Objects in Geoprocessing OMD

Page 13: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

Listing Data

List*: Python List (i.e. returns a Python List)

Know number of * in a Python list

Use a for loop

Page 14: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

ListFeatureClasses([wildCard], [FeatureType])

Page 15: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

ListFeatureClasses examples

Page 16: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

ListFields(pInputValue, [wild card], [FieldType])

Same Field object as each Field object in list thatis returned by Fields propertyof the Describe Object

Page 17: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

ListFields examples

Page 18: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

os.walk(top, topdown=True, onerror=None,

followlinks=False)

Page 19: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

os.walk() simple example

Page 20: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

os.walk() not-so-simple example

Find all Flash videos (SWF) in the entire tree under a given root folderIf the SWF file has the “slide”, and not “group”, as part of its name convert the first frame of the video to a JPG with the name of the SWF

Page 21: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

Dependencies

Python for Windows ExtensionsInterfacing with Windows, Windows applications & librariesExamples @ http://win32com.goermezer.de/content/category/7/87/189/

SWF To Image ActiveX libraryhttps://bytescout.com/download/download_freeware.html

21 of 22

Page 22: Arcpy.Describe and arcpy.List*. Describing objects ArcGIS interacts with a number of types of objects arcpy.Describe(object) exposes object properties.

os.walk() not-so-simple example