Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GEOG 315, Lecture 1

GEOG 315, Lecture 1

alan.kasprak

August 30, 2021
Tweet

More Decks by alan.kasprak

Other Decks in Education

Transcript

  1. A bit about this class (with lots more to follow)…

    In this class, you’ll learn how to automate tasks in GIS with computer code We’ll cover: • Basic programming in Python • Getting Python and ArcGIS to play nicely together • Developing your own toolboxes in ArcGIS • Making maps for the web using open-source, free toolkits This is a timely course, for all the wrong reasons…
  2. Examples of: - web visualization (left) - web mapping (right)

    91-divoc.com (left) coronavirus.Utah.gov (right)
  3. coronavirus.jhu.edu: Perhaps the best known example of web mapping on

    earth at the moment… And made by a first-year PhD student with a bit of experience in programming
  4. If you were in GEOG 310 and I said… 1.

    “Here are 500 polygon shapefiles. Make a single Excel spreadsheet that lists the area of each one.” 3. Can you reproject these 5,000 shapefiles from UTM to Web Mercator, please? 2. Tell me the watershed area of the Animas River, the San Juan River, the Colorado River, Junction Creek, the Dolores River, the San Miguel River, and…actually, just tell me the watershed area of every stream longer than 5 miles in Colorado
  5. In a few months’ time, you’ll probably go with OPTION

    C You can automate most everything in ArcMap/Pro using Python
  6. If you were in GEOG 310 and I said… 1.

    “Here are 500 polygon shapefiles. Make a single Excel spreadsheet that lists the area of each one.” 2. Tell me the watershed area of the Animas River, the San Juan River, the Colorado River, Junction Creek, the Dolores River, the San Miguel River, and…actually, just tell me the watershed area of every stream longer than 5 miles in Colorado 3. Can you reproject these 5,000 shapefiles from UTM to Web Mercator, please? EVERY ONE OF THESE THINGS CAN BE DONE IN 15 MINUTES WITH PYTHON
  7. A widely-used GIS program A widely-used programing language A tiny

    part of ArcGIS that lets you run ArcGIS tasks with Python code
  8. Some Info About Me… Alan Kasprak [email protected] Office Location: Sitter

    Family Hall 2784 [but email me first!] Office Phone: 970.247.6565
  9. Mapping Sand Along the Colorado River in Grand Canyon –

    2009 - 2019 Main channel sand mapped with multibeamsonar Riparian sand mapped with total station Channel margin sand mapped with singlebeam sonar Upland sand mapped with remote sensing/field surveys Multibeam Sonar (Channel Bed) Singlebeam Sonar (Eddies) Total Station (Riparian) Remote Sensing/Field Surveys (Uplands)
  10. "We acknowledge the land that Fort Lewis College is situated

    upon is the ancestral land and territory of the Nuuchiu (Ute) people who were forcibly removed by the United States Government. We also acknowledge that this land is connected to the communal and ceremonial spaces of the Jicarilla Abache (Apache), Pueblos of New Mexico, Hopi Sinom (Hopi), and Diné (Navajo) Nations. It is important to acknowledge this setting because the narratives of the lands in this region have long been told from dominant perspectives, without full recognition of the original land stewards who continue to inhabit and connect with this land. Thank you for your attention and respect in acknowledging this important legacy. "
  11. "We acknowledge the land that Fort Lewis College is situated

    upon is the ancestral land and territory of the Nuuchiu (Ute) people who were forcibly removed by the United States Government. We also acknowledge that this land is connected to the communal and ceremonial spaces of the Jicarilla Abache (Apache), Pueblos of New Mexico, Hopi Sinom (Hopi), and Diné (Navajo) Nations. It is important to acknowledge this setting because the narratives of the lands in this region have long been told from dominant perspectives, without full recognition of the original land stewards who continue to inhabit and connect with this land. Thank you for your attention and respect in acknowledging this important legacy. " There is no lecture next Monday (9/6); 10 am – 12pm ceremony to remove Clocktower panels
  12. This class is an environment of mutual respect. What do

    I mean by this? Mainly, that we’re not in high school anymore, and we’re all adults.
  13. This class is an environment of mutual respect. What do

    I mean by this? Mainly, that we’re not in high school anymore, and we’re all adults. 1. I’m going to treat you as colleagues, not students • I expect that you’ll put forward your best effort throughout the semester • You can expect that I’ll do the same • You can expect to learn from me, and I’ll expect to learn from you • Yes, college grades are important; no, they’re not more important than actually learning the material
  14. This class is an environment of mutual respect. What do

    I mean by this? Mainly, that we’re not in high school anymore, and we’re all adults. 1. I’m going to treat you as colleagues, not students • I expect that you’ll put forward your best effort throughout the semester • You can expect that I’ll do the same • You can expect to learn from me, and I’ll expect to learn from you • Yes, college grades are important; no, they’re not more important than actually learning the material 2. We’ll hold each other accountable • I expect that you’ll come to class each meeting • I won’t waste your time in class • I’ll give you the benefit of the doubt if you tell me you need to miss a class or need extra time on an assignment • You don’t need to tell me why, just know what constitutes a valid reason (see syllabus) • …and let me know well in advance • Likewise, if I need to cancel/reschedule/move class online, I’ll let you know well in advance
  15. This class is an environment of mutual respect. What do

    I mean by this? Mainly, that we’re not in high school anymore, and we’re all adults. 1. I’m going to treat you as colleagues, not students • I expect that you’ll put forward your best effort throughout the semester • You can expect that I’ll do the same • You can expect to learn from me, and I’ll expect to learn from you • Yes, college grades are important; no, they’re not more important than actually learning the material 2. We’ll hold each other accountable • I expect that you’ll come to class each meeting • I won’t waste your time in class • I’ll give you the benefit of the doubt if you tell me you need to miss a class or need extra time on an assignment • You don’t need to tell me why, just know what constitutes a valid reason (see syllabus) • …and let me know well in advance • Likewise, if I need to cancel/reschedule/move class online, I’ll let you know well in advance 3. We’ll be communicative • If you’re struggling/need help with the material, due dates, or are completely overwhelmed, talk to me • In turn, I’ll let you know if I think you could use extra instruction on concepts • There won’t be any surprises at the end of the semester
  16. That’s enough about me though. Introductions: 1. Your name 2.

    What you’re studying at FLC 3. Other GIS classes you’ve taken? 4. Any prior experience writing computer code? I’d like to hear from you! How many of you are here… - Because you have to be? - Because you want to be? - Because you’re actually in the wrong class but you don’t want to just get up and leave
  17. How will this class work? 1 lecture/week, Mondays @ 11:15

    – 12:10 1 lab/week, also Mondays @ 1:25 – 4:30 Week Topic(s) We’ll Cover 1 Introduction to Computers and Jupyter 2 Introduction to Python 3 Control Flow: Looping Over Data, Logic Statements 4 Geoprocessing the Hard Way 5 Big Data Geoprocessing, Made Easy 6 Working with Geometries CSVs 7 Selecting Features 8 Editing and Iterating through Attribute Tables 9 Working with Rasters 10 Making your own Toolboxes 11 Data Vis: Matplotlib and Pandas 12 Web Mapping in Python 13 Web Mapping in Python 14 Web Mapping in R
  18. The reason you’re really here… How will my grade be

    determined? 60% is homework problems - 3ish coding problems per week - Upload them as a .zip folder to Canvas 10% is feedback to your colleagues - 3 substantive posts/week on our class StackOverflow board - Two off weeks per semester – email me! 10% is a final project - A chance for you to showcase your skills - Prompt assigned in our last class meeting 20% is Jupyter Notebooks - 5-ish comprehension files to work through per week - Upload them as a .zip folder to Canvas
  19. The reason you’re really here… How will my grade be

    determined? 60% is homework problems - 3ish coding problems per week - Upload them as a .zip folder to Canvas 10% is feedback to your colleagues - 3 substantive posts/week on our class StackOverflow board - Two off weeks per semester – email me! 10% is a final project - A chance for you to showcase your skills - Prompt assigned in our last class meeting 20% is Jupyter Notebooks - 5-ish comprehension files to work through per week - Upload them as a .zip folder to Canvas
  20. Our Class StackOverflow Board – 3 Posts/Week for Full Credit

    I’ve created a private GEOG 315 Team… Use it! stackoverflow.com/c/flc-geog-315 Questions! If you're having trouble, getting errors, don't know what a function does, ask, and ask some more. Answers! If you know the answer to someone's question, post that! Cool Code! There are many, many ways to do the same thing and get the right answer. Post those if you find a clever hack! Other stuff I haven't even thought about!
  21. But how can I use Python outside the lab time?!

    Option 1: Install ArcPro on your own computer [it comes pre-packaged with Python] It’s not the easiest thing to install, but it’s very doable – and I’m here to help!
  22. But how can I use Python outside the lab time?!

    Option 2: Install VPN and remotely access any lab computer on campus (they’ve all got ArcPro and Python) This is easy to do and will be fine for this class – as long as you’ve got a reliable internet connection.
  23. A disclaimer about this class At times, this class will:

    - be frustrating - be stressful - be a lot of work - just be downright difficult and kind of infuriating
  24. A disclaimer about this class At times, this class will:

    - be frustrating - be stressful - be a lot of work - just be downright difficult and kind of infuriating What I promise you: 1. I will be here to help you (but not hand-hold) 2. If you put in the effort, you will learn a TON of valuable skills and your GIS life will be easier My advice: worry less about your grade in this class and more about actually learning the material
  25. A 5 Minute Introduction to Python… [because you’ll have a

    much longer introduction in lab next week] Python is a programming language Programming language: a vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks. First developed in 1990, Python emphasizes human readability of code (i.e., it’s not just 1’s and 0’s) From Tim Peter’s The Zen of Python
  26. A 5 Minute Introduction to Python… [because you’ll have a

    much longer introduction in lab next week] Python is a programming language Programming language: a vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks. Python is interpreted Interpreted: your code will run as-is. You don’t need to first compile it into an executable file, or program, to run it. As long as Python is installed, you can run code – no matter which OS you’re in.
  27. A 5 Minute Introduction to Python… [because you’ll have a

    much longer introduction in lab] Python is a programming language Programming language: a vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks. Python is object-oriented Object-oriented: python uses objects (or classes) that have certain properties (or attributes) and which do certain things (behaviors) BourneToCode Kidsonthegenius.com
  28. A 5 Minute Introduction to Python… [because you’ll have a

    much longer introduction in lab next week] Python is a programming language Programming language: a vocabulary and set of grammatical rules for instructing a computer or computing device to perform specific tasks. Python is high-level High-level: you can read your code (it’s not 1’s and 0’s), and it can be run on a variety of computers. TechDotMatrix
  29. Cool, but I thought this was GEOG 315, not Computer

    Science 6500. It is. Python is the language we use to talk to ArcGIS so we can automate tasks ArcGIS understands Python through a module called ArcPy Write Python Code ArcGIS Does Things ArcPy
  30. “Run the buffer tool on roads.shp, save the output to

    majorrdsBuffered.shp, use a 100 foot buffer,…” An example of ArcPy in action… You’re all familiar with the buffer tool…right? The code below is Python – but we’re using ArcPy to get ArcPro to understand that Python code You will see (and get familiar with) python examples For lots of geoprocessing tools.