SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Downloaden Sie, um offline zu lesen
Week 9 Lecture:
Data and Batch Geoprocessing With
Data and Batch Geoprocessing With
ArcGIS
Introduction to Programming for GIS & Remote Sensing
GEO6938-4172
GEO4938-4166
GEO4938 4166
Reminder
Reminder
This week participate in the discussion forum
This week, participate in the discussion forum
P bl d
Practice problems are posted
Submit the “boxes” lab
Think about your proposed problems, data
needs and goals for your project
needs and goals for your project
Re-cap From Past Lectures
Re cap From Past Lectures
We’ve discussed modularization
We ve discussed modularization
– Subroutines
Functions
– Functions
– Object-orientation
All this leads to one thing:
Code Re-use
Code Re-Use
Code Re Use
The goal is to make life easier for us!
The goal is to make life easier for us!
I
Imports
– Single functions
– Modules
– Classes/objects
– Entire processing frameworks:
• PyGame, and ArcGIS’ Geoprocessing!
Objectives This Week
Objectives This Week
Learn about ArcGIS’ Geoprocessing objects
Learn about ArcGIS Geoprocessing objects
B ld M d l d h
Building Models and integrating with scripts
Interface ArcGIS and other tools using Python
as “glue”
g
What is the ArcGIS Geoprocessing
Framework?
An “ArcObjects” component
R ll j i l bj i h b
– Really just a single object with many, many sub-
components
Allows accessing geoproecessing tools as
native methods
Accessing the Geoprocessor
Object
How do we instantiate the Geoprocessor?
How do we instantiate the Geoprocessor?
import arcgisscripting
gp = arcgisscripting.create()
gp g p g ()
How do we interact with the Geoprocessor?
How do we interact with the Geoprocessor?
gp.clip_analysis(In,Clip,Out) # alias for:
on
gp.Toolbox = “Analysis”
Gp.clip(In,Clip,Out)
tho
p p( , p, )
Pyt
The Geoprocessor Object
The Geoprocessor Object
Uses environment settings to define the
Uses environment settings to define the
operating conditions, input/output, defaults
So Geoprocessing Opens Doors
So Geoprocessing Opens Doors
Besides access to ArcToolbox tools it gives
Besides access to ArcToolbox tools it gives
properties and methods to create and
manipulate datasets directly!
manipulate datasets directly!
S h d l h
See the diagram again to explore that
functionality…
– Cataloguing
– Describing
– Listing
– Editing
Class diagram on steroids
Class diagram on steroids…
The Geoprocessor Acts as
Gateway…
To all of the power of ArcGIS and its tools:
Geoprocessor Programming Model
Reading the Programming Model
Reading the Programming Model
Putting it all together
Putting it all together…
Python gives you full functionality to
Python gives you full functionality to
programming environment
Operating/file system integration
– Operating/file system integration
– Fully extensible
All the logic you can stomach
– All the logic you can stomach
Geoprocessing framework gives you all the
l i A T lb l bili d
tools in ArcToolbox plus ability to create and
edit data directly
… == “Amazing Possibilities”
Cataloguing and Listing Spatial Data
Cataloguing and Listing Spatial Data
One common and critical task:
One common and critical task:
– Batch Processing
W d thi ith G ’ Li t th d
We do this with Geoprocessor’s List methods
– Use for different data types
– List objects for iteration
Batch Processing
Batch Processing
Such a common programming
Initialize Batch
Such a common programming
structure
Sequence of operations
Read Data
– Sequence of operations
– Iterated over list of items
Geoprocessing requires the inputs
Process Data
– Geoprocessing requires the inputs
and outputs be organized
Output Results
Enumerations
Enumerations
Some methods return
Some methods return
enumerations:
List (object) of values
– List (object) of values
without a known count
and of any type
y yp
Objects to be listed can
be restricted by data
be restricted by data
types and name
Parameters
Parameters
Wild cards: We can restrict the objects and datasets to be inserted into the list by
Wild cards: We can restrict the objects and datasets to be inserted into the list by
name using an asterisk:
myPolygonList = gp.ListFeatureClasses(“C*”)
P l Li t Li tF t Cl (“* it *”)
myPolygonList = gp.ListFeatureClasses(“*community*”)
Type filters: Restrict returns by certain type keywords:
myPolygonList = gp.ListFeatureClasses(“C*”,”polygon”)
Input dataset values to restrict by items that are a part of a certain object:
Input dataset values to restrict by items that are a part of a certain object:
myPolygonList = gp.ListFields(table,“C*”,”Integer”)
Type Filters
Type Filters
List methods by default list objects of all types
List methods by default list objects of all types
If f k d h l
If you specify a keyword, you restrict the list
returned to those types
Iterating Through Enumerated
Features
Enumerated features are not Python lists
Enumerated features are not Python lists
S h h h h l l
So we iterate through them using while loops,
not as for item in list: loops.
You test the condition before the loop, then
p,
the loop iterates until the test results in
null/false
Iterating Through Enumerations (cont’d.)
Iterating Through Enumerations (cont d.)
Two methods and no properties for
Two methods and no properties for
enumerations:
– list.reset() : Points to the top of the stack of
objects, makes sure the first element is on top
objects, a es su e t e st e e e t s o top
– list.next() : returns the currently selected
y
value and increments the list index
Iterating Through Enumerations (cont’d.)
Iterating Through Enumerations (cont d.)
Listing Tools and Their Usage
Listing Tools and Their Usage
on
tho
Pyt
Your first batch “Union”
Your first batch Union
Wrap-up
Wrap up
The Geoprocessing framework offers the
The Geoprocessing framework offers the
gateway to ArcGIS’ tools
It also provides functionality for sophisticated
h d
interactions with data
– Batching is the most simple way to interact
Python’s native utility (e.g. string manipulation)
y y ( g g p )
and extensible modules (charts, statistics) can
be married with ArcGIS
In Lab This Week
In Lab This Week
Explore Geoprocessing framework
Explore Geoprocessing framework
– Build simple models/tools
E t t i t
– Export to scripts
– Create batch processes
Supplemental reading:
– http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=What_is_geoprocessing?
– http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=A_whirlwind_tour_of_geoprocessing
– http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=Geoprocessing_tools
– http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=Geoprocessing commands quick refere
p p g p p p g_ _q _
nce_guide

Weitere ähnliche Inhalte

Ähnlich wie 2008-03-04 - Geoprocessing with ArcGIS.pdf

The Art of Database Experiments – PostgresConf Silicon Valley 2018 / San Jose
The Art of Database Experiments – PostgresConf Silicon Valley 2018 / San JoseThe Art of Database Experiments – PostgresConf Silicon Valley 2018 / San Jose
The Art of Database Experiments – PostgresConf Silicon Valley 2018 / San Jose
Nikolay Samokhvalov
 
PPT on Python - illustrating Python for BBA, B.Tech
PPT on Python - illustrating Python for BBA, B.TechPPT on Python - illustrating Python for BBA, B.Tech
PPT on Python - illustrating Python for BBA, B.Tech
ssuser2678ab
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues lists
James Wong
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
Stacksqueueslists
Fraboni Ec
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Tony Nguyen
 

Ähnlich wie 2008-03-04 - Geoprocessing with ArcGIS.pdf (20)

A Workshop on R
A Workshop on RA Workshop on R
A Workshop on R
 
The Art of Database Experiments – PostgresConf Silicon Valley 2018 / San Jose
The Art of Database Experiments – PostgresConf Silicon Valley 2018 / San JoseThe Art of Database Experiments – PostgresConf Silicon Valley 2018 / San Jose
The Art of Database Experiments – PostgresConf Silicon Valley 2018 / San Jose
 
PPT on Python - illustrating Python for BBA, B.Tech
PPT on Python - illustrating Python for BBA, B.TechPPT on Python - illustrating Python for BBA, B.Tech
PPT on Python - illustrating Python for BBA, B.Tech
 
Functional Programming.pptx
Functional Programming.pptxFunctional Programming.pptx
Functional Programming.pptx
 
Python and You Series
Python and You SeriesPython and You Series
Python and You Series
 
Concepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming LanguagesConcepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming Languages
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
00-review.ppt
00-review.ppt00-review.ppt
00-review.ppt
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
Stacksqueueslists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Basic data-structures-v.1.1
Basic data-structures-v.1.1Basic data-structures-v.1.1
Basic data-structures-v.1.1
 
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
 
(7) c sharp introduction_advanvced_features_part_ii
(7) c sharp introduction_advanvced_features_part_ii(7) c sharp introduction_advanvced_features_part_ii
(7) c sharp introduction_advanvced_features_part_ii
 
Java 8
Java 8Java 8
Java 8
 
Week 1 - Data Structures and Algorithms
Week 1 - Data Structures and AlgorithmsWeek 1 - Data Structures and Algorithms
Week 1 - Data Structures and Algorithms
 
SAADATMAND_PYTHON
SAADATMAND_PYTHONSAADATMAND_PYTHON
SAADATMAND_PYTHON
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

2008-03-04 - Geoprocessing with ArcGIS.pdf

  • 1. Week 9 Lecture: Data and Batch Geoprocessing With Data and Batch Geoprocessing With ArcGIS Introduction to Programming for GIS & Remote Sensing GEO6938-4172 GEO4938-4166 GEO4938 4166
  • 2. Reminder Reminder This week participate in the discussion forum This week, participate in the discussion forum P bl d Practice problems are posted Submit the “boxes” lab Think about your proposed problems, data needs and goals for your project needs and goals for your project
  • 3. Re-cap From Past Lectures Re cap From Past Lectures We’ve discussed modularization We ve discussed modularization – Subroutines Functions – Functions – Object-orientation All this leads to one thing: Code Re-use
  • 4. Code Re-Use Code Re Use The goal is to make life easier for us! The goal is to make life easier for us! I Imports – Single functions – Modules – Classes/objects – Entire processing frameworks: • PyGame, and ArcGIS’ Geoprocessing!
  • 5. Objectives This Week Objectives This Week Learn about ArcGIS’ Geoprocessing objects Learn about ArcGIS Geoprocessing objects B ld M d l d h Building Models and integrating with scripts Interface ArcGIS and other tools using Python as “glue” g
  • 6. What is the ArcGIS Geoprocessing Framework? An “ArcObjects” component R ll j i l bj i h b – Really just a single object with many, many sub- components Allows accessing geoproecessing tools as native methods
  • 7. Accessing the Geoprocessor Object How do we instantiate the Geoprocessor? How do we instantiate the Geoprocessor? import arcgisscripting gp = arcgisscripting.create() gp g p g () How do we interact with the Geoprocessor? How do we interact with the Geoprocessor? gp.clip_analysis(In,Clip,Out) # alias for: on gp.Toolbox = “Analysis” Gp.clip(In,Clip,Out) tho p p( , p, ) Pyt
  • 8. The Geoprocessor Object The Geoprocessor Object Uses environment settings to define the Uses environment settings to define the operating conditions, input/output, defaults
  • 9. So Geoprocessing Opens Doors So Geoprocessing Opens Doors Besides access to ArcToolbox tools it gives Besides access to ArcToolbox tools it gives properties and methods to create and manipulate datasets directly! manipulate datasets directly! S h d l h See the diagram again to explore that functionality… – Cataloguing – Describing – Listing – Editing
  • 10. Class diagram on steroids Class diagram on steroids…
  • 11. The Geoprocessor Acts as Gateway… To all of the power of ArcGIS and its tools: Geoprocessor Programming Model
  • 12. Reading the Programming Model Reading the Programming Model
  • 13. Putting it all together Putting it all together… Python gives you full functionality to Python gives you full functionality to programming environment Operating/file system integration – Operating/file system integration – Fully extensible All the logic you can stomach – All the logic you can stomach Geoprocessing framework gives you all the l i A T lb l bili d tools in ArcToolbox plus ability to create and edit data directly … == “Amazing Possibilities”
  • 14. Cataloguing and Listing Spatial Data Cataloguing and Listing Spatial Data One common and critical task: One common and critical task: – Batch Processing W d thi ith G ’ Li t th d We do this with Geoprocessor’s List methods – Use for different data types – List objects for iteration
  • 15. Batch Processing Batch Processing Such a common programming Initialize Batch Such a common programming structure Sequence of operations Read Data – Sequence of operations – Iterated over list of items Geoprocessing requires the inputs Process Data – Geoprocessing requires the inputs and outputs be organized Output Results
  • 16. Enumerations Enumerations Some methods return Some methods return enumerations: List (object) of values – List (object) of values without a known count and of any type y yp Objects to be listed can be restricted by data be restricted by data types and name
  • 17. Parameters Parameters Wild cards: We can restrict the objects and datasets to be inserted into the list by Wild cards: We can restrict the objects and datasets to be inserted into the list by name using an asterisk: myPolygonList = gp.ListFeatureClasses(“C*”) P l Li t Li tF t Cl (“* it *”) myPolygonList = gp.ListFeatureClasses(“*community*”) Type filters: Restrict returns by certain type keywords: myPolygonList = gp.ListFeatureClasses(“C*”,”polygon”) Input dataset values to restrict by items that are a part of a certain object: Input dataset values to restrict by items that are a part of a certain object: myPolygonList = gp.ListFields(table,“C*”,”Integer”)
  • 18. Type Filters Type Filters List methods by default list objects of all types List methods by default list objects of all types If f k d h l If you specify a keyword, you restrict the list returned to those types
  • 19. Iterating Through Enumerated Features Enumerated features are not Python lists Enumerated features are not Python lists S h h h h l l So we iterate through them using while loops, not as for item in list: loops. You test the condition before the loop, then p, the loop iterates until the test results in null/false
  • 20. Iterating Through Enumerations (cont’d.) Iterating Through Enumerations (cont d.) Two methods and no properties for Two methods and no properties for enumerations: – list.reset() : Points to the top of the stack of objects, makes sure the first element is on top objects, a es su e t e st e e e t s o top – list.next() : returns the currently selected y value and increments the list index
  • 21. Iterating Through Enumerations (cont’d.) Iterating Through Enumerations (cont d.)
  • 22. Listing Tools and Their Usage Listing Tools and Their Usage on tho Pyt
  • 23. Your first batch “Union” Your first batch Union
  • 24. Wrap-up Wrap up The Geoprocessing framework offers the The Geoprocessing framework offers the gateway to ArcGIS’ tools It also provides functionality for sophisticated h d interactions with data – Batching is the most simple way to interact Python’s native utility (e.g. string manipulation) y y ( g g p ) and extensible modules (charts, statistics) can be married with ArcGIS
  • 25. In Lab This Week In Lab This Week Explore Geoprocessing framework Explore Geoprocessing framework – Build simple models/tools E t t i t – Export to scripts – Create batch processes Supplemental reading: – http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=What_is_geoprocessing? – http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=A_whirlwind_tour_of_geoprocessing – http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=Geoprocessing_tools – http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=Geoprocessing commands quick refere p p g p p p g_ _q _ nce_guide