19
Motti Zohar Department of Geography and Environmentla Studies University of Haifa Python and spatial Modeling Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Python and spatial Modeling

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Python and spatial Modeling

Motti Zohar

Department of Geography and Environmentla Studies

University of Haifa

Python and spatial Modeling

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 2: Python and spatial Modeling

Lesson 2: Model builder

and Python

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 3: Python and spatial Modeling

3

Contents

o Why using modeling?

o What is Model Builder?

o Modeling using ArcGIS Desktop >> export to Pyhton

o Modeling using ArcGIS Pro

o Prior to basic scripting – models may assist in the

understanding of the world of python scripts

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 4: Python and spatial Modeling

4

Why using modeling?

o Efficiency

o Distribute and share knowledge and functionalities

o Organization & order

o Process design and Diagram workflows

o Re-use of code

o Structure the GIS analyses

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 5: Python and spatial Modeling

5

Benefits

o Models provide an easy way to interpret visual

representation of the data and workflow

o Models can be reused and shared, and are easy to

modify if necessary

o Models are much more convenient than running

many tools individually

o Models can be useful in project documentation

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 6: Python and spatial Modeling

6

Model Builder

o Models are a series of geoprocessing tools that

facilitate the automation of complex or repetitive

tasks

o Model Builder is a graphical interface that allows

users to easily create models using existing tools and

data

o Requires no programming experience

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 7: Python and spatial Modeling

7

Model builder

A canvas for modeling in which any tool, script or data

can be included in the model by dragging and dropping

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 8: Python and spatial Modeling

8

Modulating a process

Process 1

Process 2

Process 3

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 9: Python and spatial Modeling

9

Model builder and Python

o Efficient way to start making workflows

o Differences between ArcGIS Desktop and ArcGIS Pro

o Importing and exporting code

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 10: Python and spatial Modeling

10

Model builder framework

Tools

Python Window

Search

ModelBuilder

Scripts

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 11: Python and spatial Modeling

11

What is a Model Builder process?

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 12: Python and spatial Modeling

12

Model builder toolbar – ArcGIS Pro

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 13: Python and spatial Modeling

13

Model builder – ArcGIS Desktop

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 14: Python and spatial Modeling

14

Demonstration

The problem:

The city planers are interested to map all buildings that

are completely within the city center and are also

within a distance of 100 meters from streets with a

width of 20 meters.

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 15: Python and spatial Modeling

15

Iterations, utility and logical

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 16: Python and spatial Modeling

16

The importance of using variable & parameters

o Any information used by a tool is a parameter

o Parameters can be hardcoded or set so a user can

enter values

o For example, it is often a good idea to set tool inputs

as parameters to make models more flexible

o It is also useful to make variables for some tool

inputs and expose them as parameters for user input

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 17: Python and spatial Modeling

17

Model Builder usage & tips

o Set default geodatabase!

o Input (vector, raster, tables etc.)

o Parameters variables

o Environmental variables

o Save the model - create a toolbox

o Re-use of the model (modify, add, remove)

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 18: Python and spatial Modeling

18

Links of how to use Model Builder

1. https://www.esri.com/videos/watch?videoid=1817&isLegacy=true

2. https://pro.arcgis.com/en/pro-

app/help/analysis/geoprocessing/modelbuilder/modelbuilder-

tutorial.htm

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa

Page 19: Python and spatial Modeling

19

EXERCISE 2

Python and spatial modeling. The department of Geography and Environmental Studies, University of Haifa