General information

Last updated: 2022-06-22 18:54:37

Course details

  • Course number: 128.1.0162

  • Time: Sunday 16:10-19:00

  • Place: Building 35, room 403 Building 72, room 249

  • Instructor: Michael Dorman (mailto:dorman@post.bgu.ac.il)

  • Grading:

  • Requirements:

    • Basic knowledge of GIS (e.g., “Intro to GIS” course)

    • Self study

  • Getting help:

Lecture plan

The course lecture plan is given in Table 26.

Table 26 Course lecture plan

Lesson

Topic

Date

01

Preface, Setting up the environment

2022-03-20

02

Python basics

2022-03-27

03

Conditionals and loops

2022-04-03

04

Arrays (numpy)

2022-04-10

05

Tables (pandas)

2022-04-24

06

Table reshaping and joins

2022-05-01

07

Geometries (shapely)

2022-05-08

08

Vector layers (geopandas)

2022-05-15

09

Geometric operations

2022-05-22

10

Rasters (rasterio)

2022-05-29

11

Raster-vector interactions

2022-06-12

12

ArcGIS Pro scripting (arcpy)

2022-06-19

13

2022-06-26

Home assignments

Instructions

  • Assignments should be prepared and submitted individually (not in pairs, etc.)

  • The solution needs to be submitted on Moodle, as a Jupyter notebook (i.e., a single .ipynb file).

  • Specify the following details at the top of the notebook: assignment number, student name, student ID (Fig. 79).

  • Use headings (e.g., ## Question 1 and ## Question 2 in markdown cells) to mark the solution to question 1 and question 2 (Fig. 79).

  • The notebook needs to run without errors, and produce (print) the required outputs, assuming the person who runs the notebook:

    • Has all packages used in the book installed (see Python packages).

    • Runs the notebook from within a directory that contains the data and output sub-directories, with the course sample data and output files (see Sample data).

  • Avoid exporting any files in your code!

  • Make sure your solution is as general as possible. Namely, do not use indices or specific values in your solution, other than the values given in the question text. For example, if the question is “find the largest value in the list x=[4,7,9,2,8,5], the solution x[2] is wrong, because it uses the specific value 2.

  • You can use any function or method in the Python standard library (https://docs.python.org/3/library/) to solve the exercises, even if it is not in the material. However, you can only use third-party Python packages which are covered in the material (see What are we going to learn?); you cannot use any other third-party package in your solution.

  • When the solution requires importing one of the sample data files (see Sample data), use a relative path starting with "data", as in "data/carmel.csv". In other words, assume that the notebook is going to be executed in a a directory which contains a sub-directory named data with all sample data files listed in Table 3.

_images/assignment_example.png

Fig. 79 Structure of .ipynb file for a submitted assignment

Submission dates

The sumbission dates of home assignments are given in Table 27.

Table 27 Assignment submission dates

Assignment

Topic(s)

Date

Home assignment 1

Python basics + Conditionals and loops

2022-05-01

Home assignment 2

Arrays (numpy) + Tables (pandas)

2022-05-15

Home assignment 3

Table reshaping and joins + Geometries (shapely)

2022-05-29

Home assignment 4

Vector layers (geopandas) + Geometric operations

2022-06-12

Home assignment 5

Rasters (rasterio) + Raster-vector interactions

2022-06-26

Working with the virtual image

Step 1: Start the virtual image

  • Go to https://apps.bgu.ac.il/

  • Click “Next”

  • Type your BGU username and password

  • Click on the “Geography” icon

  • Click “Launch”

  • Click on “Open Horizon Client”

  • Select “Open with VMware Horizon Client” if asked

Step 2: Download sample data

  • From the desktop, open the link named “Spatial Data Programming with Python”, and download the sample data (see Sample data) (Fig. 80)

_images/vm_step1.png

Fig. 80 Downloading sample data

  • Again from the desktop, go to “This PC”, then to “Downloads”

  • You should see the file named data which you downloaded

  • Right-click on data, then click Extract to "data\" (Fig. 81)

_images/vm_step2.png

Fig. 81 Extracting to data sub-directory

Step 3: Create output directory

  • Create a directory named output (for exported files)

Step 4: Download the notebook(s)

  • Download any of the notebook files of the course (Fig. 17) you wish to work with

  • If you intend to work on a new blank notebook, then you will be able to create one from within the Jupyter notebook interface (see next step)

Step 5: Start the Jupyter Notebook interface

  • From the desktop, click on “Anaconda Prompt (Miniconda)”

  • In the command line, type juputer notebook and press Enter

  • If asked, choose to open the application with the Edge Browser and click OK

  • You should now be able to work in the Jupyter Notebook interface, in an environment where all packages we learn about are installed and sample data are accessible in the data sub-directory (Fig. 82)

_images/vm_step3.png

Fig. 82 The Jupyter Notebook interface

  • When done, close the browser, terminate the Jupyter Notebook application (by pressing Ctrl+C), then log off from the virtual image (by clicking “Start”→Your user→”Sign Out”) (Fig. 83)

  • Important!!! When logging off the virtual environment, the contents of “Downloads”, including the files you have been working with, are deleted! Make sure you copy them to a USB device, e-mail to yourself, etc., before shutting down.

_images/vm_step4.png

Fig. 83 Signing out of the virtual image