gis4107 day 11 of 50 gis 4107 – visual programming instructor: david viljoen (last name pronounced...

50
GIS4107 Day 1 1 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) [email protected]

Upload: jasper-little

Post on 20-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 1 of 50

GIS 4107 – Visual Programming

Instructor:David Viljoen (Last name pronounced vil-john)

[email protected]

Page 2: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 2 of 50

Day 1 Overview

Value of GIS, this program, and the customization coursesCourse Overview – marks, text, other resourcesHelpful hints to doing wellMy qualifications and role in this courseIntro to SlickrunIntro to version control and TortoiseSVNAbout youAssessment Quiz

Page 3: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 3 of 50

Humans in the World

Page 4: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 4 of 50

Global issues

Human populationEnergy – peak oil, peak natural gas (esp. in North America)

Oceans in crisesSpecies loss (song birds, bees, …)Food – peak phosphorous and other fertilizersGlobal warmingDeforestation

Page 5: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 5 of 50

You are the Transformation generation …

… that must create a sustainable future.

“The significant problems we have cannot be solved at the same level of thinking with which we created them.” - Albert Einstein

“We must be the change we wish to see in the world.” - Ghandi

Page 6: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 6 of 50

Value of GIS in the World

“Our world is changing, presenting many challenges. GIS professionals, working together, will author and share the knowledge that will make a difference. I strongly believe that this collaboration will help us bring peace and prosperity as well as a more sustainable world.”

Jack Dangermond, ESRI President

From “Manage and Shape Our Changing World with GIS”. Read entire article here.

Page 7: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 7 of 50

GIS is used forAgricultureArchaeologyArchitecture, Engineering, and ConstructionAtmosphere, Climate, and WeatherBusiness GISCadastral and Land RecordsCartography and Map ProductionCensus and GeodemographicsClimate ChangeDefense and IntelligenceDisaster Management and Emergency ResponseEcology and ConservationEducationElectric UtilitiesEmergency Medical Services/FireEnvironmental ManagementFacilities ManagementForestry, Wildlife, and Fisheries ManagementGIS Organization, Management, and ImplementationHealth and Human ServicesHomeland SecurityInsuranceLaw Enforcement and Criminal Justice

LogisticsMining and GeosciencesOcean, Coastal, and Marine ResourcesParks and Natural ReservesPetroleumPipeline and Gas UtilitiesPublic WorksRemote Sensing ImagerySpatial Data InfrastructureState and Local GovernmentSurveyingSustainable Development and Humanitarian AffairsTelecommunications and Location-Based ServicesTransportationTribal/Indigenous GIS programsWater ResourcesWater, Wastewater, and Stormwater

List of “tracks” from ESRI International User Conference 2009http://proceedings.esri.com/library/userconf/proc09/index.html

Page 8: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 8 of 50

Examples of how GIS is used …

Example articles from ArcNews from ESRI

Researchers Study Carbon Footprints with GISImpact of Climate Changes on Gray Whale Feeding Grounds Tracked with GISCase Study: GIS Analyzes Deforestation and Its Impacts on Biodiversity in BoliviaGroundwater Quality Mapped in PakistanTraffic Data Visualized Using GISCity Turns to GIS to Model Flooding of Mighty MississippiGIS Helps Document Ravages of Australian FiresDisaster Response and Homeland Security System Uses GISHow Government Fleet Managers Can Lower Costs with ArcLogisticsNorwegian County Maps Biogas Production PotentialU.S. Forest Service Assesses Postfire Threats with GISGIS Is Used to Help Manage Tree MaintenanceFlorida Water Agency Maps Consumption with GISGIS Used to Create Earthquake Soil Liquefaction ModelsGoing Green with GISHow Does a Garden City Grow? With a Hand from GISMobile GIS: ArcPad and GPS Help Assess Health of British Columbia RangelandsAnalyze Hurricanes Using Web GIS

Page 9: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 9 of 50

Value of GIS Program in the world of GIS

Algonquin’s GIS Program will introduce you to many essential aspects of GIS

It will enhance your ability to pursue a career in GIS

The 3 programming courses will increase the number of opportunities available to you and increase your income potential.

Page 10: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 10 of 50

GIS Job Survey from Fall 2007

If you can code, you have access to 84% of jobsIf you can’t, you have access to 46% (or less)

Page 11: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 11 of 50

Course Overview

Page 12: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 12 of 50

Based on Fall 2008 Feedback …

Softcopy (180 days) available for ~$50Hardcopy available for $100 - $130

Page 13: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 13 of 50

Go Slow … in the flow

Page 14: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 14 of 50

My challenge …

Individual average is different for every individual

Page 15: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 15 of 50

Need interaction

Page 16: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 16 of 50

Good to work in pairs …

My goal is ~25% lecture, ~75% coding

Pair programming for exercisesFrom (http://www.daleasberry.com/newsletters/200301/20030101.shtml )

“Two heads are better than one."

Double the productivity 1 + 1 = 4

Quality of the pair solutions is significantly higher.

More likely to see bugs earlier in the process.

Thinking and discussing the problem is more likely to result in a simpler, cleaner solutionMore likely to catch missed requirements.

Page 17: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 17 of 50

Know that you can do it …

Hunt, p. 70

Page 18: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 18 of 50

… but you have to manage your focus

Hunt, p. 209

Page 19: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 19 of 50

Manage focus … reduce context switching

Hunt, p. 227

Page 20: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 20 of 50

YouTube, MSN, etc.

YouTube, MSN, etc. during class reduces :Your learning opportunityYour employment potentialMy willingness to help youYour popularity with fellow students who are trying to be attentive

YouTube, MSN, etc. are not going to help earn you a living.

Lost income + tuition + books + … = $$$$$Get value from your investment in $ and time

Page 21: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 21 of 50

Manage focus … meditation can help.

How to …p. 1p. 2p. 3

Page 22: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 22 of 50

About Me

GIS/Data Management ExpertGeological Survey of Canada(Aug 1991 – Nov 2000; Apr 2002 – Present)

GIS ConsultantESRI Canada – Ottawa (Dec 2000-Mar 2002)Specialized in ArcGIS/ArcObjects and ArcIMS consulting and training

Page 23: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 23 of 50

My Programming Experience

1980: Fortran on Carleton U. Mainframe (slower than my Mac)Programming assignments for engineering course.No display terminal. Used a line printer to write and run programs.

Self-taught …

1986: GW-BASIC on an IBM XT (8 MHz, 640k RAM).

1988: BASIC on MacIntosh Plus (8 MHz, 1 Mbyte RAM)

1989: QuickBASIC on IBM AT clone (16 MHz, 1 Mbyte RAM)

Wrote programs for • Automating Electromagnetic Compatibility testing procedures and plotting HPGL test results.• Raster processing (display, format conversion, localized regression analysis, histograms, scatter

diagrams, etc.) • Recording data from an A/D Converter that I built • Basic GIS processing point-in-polygon, polygon area, etc. for a university course.

Page 24: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 24 of 50

My Programming Experience (cont’d)

1990: VisualBasic 2.0 on IBM 386 (32 MHz, 2 Mbyte RAM)Wrote a program for displaying Ground Probing Radar images and another for computing and displaying semivariograms

1991: AML on Unix Workstation (60 MHz, 64 Mbtye RAM)Self-taught and wrote many programs related to data pre-processing (Arc), map production (ArcPlot) and raster processing (Grid). Worked on Unix workstation for 9 years and developed expertise with csh, sed, grep, uniq, sort, etc. and AWK (!). Cost ~$45,000 (1.3 Gbyte hard drive cost ~$5,000)

2000-2005: ArcObjects on Pentium III (1396 MHz, 1024 Mbyte RAM)Program to plot tens of thousands of Census Tract maps to printer and/or PDF. If Census Tract extent exceeded user defined limits (determined optimal tiling scheme (i.e. tile size and orientation))

DigSym – captures oriented symbols from paper geology maps using Tablet PC

Layer Attributer – updates multiple fields of one or more layers with values from XML file

SatValMod – integrates colour imagery with shaded relief data

2005-…: ASP.NET - C# (~2400 MHz, 2048 Mbyte RAM)On-line application to manage sample collection, analysis, and storage information

Page 25: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 25 of 50

My teaching experience

Algonquin College – built and taught …GIS 8746 - Raster GIS Fundamentals (1998 - 2001) GIS 4207 - GIS Customization I (2002-2007)

GIS 4307 - GIS Customization II (2006-2007)

ESRI Canada – Ottawa Office (Dec 2000-Mar 2002). ESRI certified trainer for …

“Intro to Programming ArcObjects with VBA”, “Intro to ArcIMS”“Customizing ArcIMS with HTML & JavaScript

Page 26: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 26 of 50

My role in GIS4107

Add value to your life …Learning buddy guiding you through programming wonderland

“… learning, critical thinking, creativity, and invention – all those mind expanding skills – are all up to you. You don’t get taught; you have to learn. We tend to look at the teacher/learner relationship the wrong way round: it’s not that the teacher teaches; it’s that the student learns. The learning is always up to you” Hunt, p. 3

Convey value of programming in GISGrads at Home DepotGrads at “best job ever”Earn more $ (if $ motivate you)

Help you learn programming so you can be more effectiveYou learn by doing. Show you non-programming things I have found useful in my career and lifeTreat you with respect

Page 27: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 27 of 50

One of my passions …

A picture of me doing one of the things I love … climbing hills on my bicycle. In this case, the highest climb in the 2003 Tour de France: Col de Galibier 2,645 m (8,678 ft)

Page 28: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 28 of 50

About 2 hrs later, Lance Armstrong catches up … on his way to winning the 50th Critérium du Dauphiné Libéré

June 1003: About two weeks before the start of the 100th Tour de France

Lance …

Page 29: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 29 of 50

Before Intro to Subversion

Intro to SlickRun – quick launch on steriods

Page 30: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 30 of 50

SlickRun

Tired of searching for icons to double-click?Example: Start Word with +Q, then “doc”, then Enter OR just +Q, the “d” if it is only thing in command history beginning with “d”Create your own magic words and synonyms to launch any app, navigate to any folder, browse to any website, etc.

Page 31: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 31 of 50

Intro to Version Control

Have you ever …

Had an application crash and lose ALL of your work

Made changes to a file for the worse and wished you could have recovered an earlier version

Overwritten a newer version of a file by accident

Wanted to selectively integrate file changes made by others

Kept different versions of a file but were not sure what the differences were because you did not keep a log

Page 32: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 32 of 50

Version control overview

= in this PPT

Page 33: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 33 of 50

Binary vs text (unicode) files

Text files • Are binary files used to store written text• Contain ascii (UTF-8) or unicode data only• Can open with text editor (e.g. Notepad)• Examples: txt, ini, xml, csv, etc.

Binary files can be • Application files (e.g. exe, dll, olb, etc• Data / document files (e.g. mdb, xls, doc, etc.)

Page 34: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 34 of 50

Application types

Page 35: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 35 of 50

Command line apps/batch files and PATH

The command processor searches the current path, and path(s) contained in the user and system path environment variablesAccess environment variables via …

My Computer > Properties > Advanced tab > Environment variables

This example doesnot change the useror system path.It changes the path forthis particular commandprocessor session.

Page 36: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 36 of 50

System ports and firewall exceptions

Subversion usesport 3690

Page 37: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 37 of 50

File server

Page 38: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 38 of 50

Version control history

Born out of problems from

File sharingAccess permissionsFile lockingOverwriting

File backup / restore with copy / renameName managementNo history logChanging file dependencies

Page 39: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 39 of 50

Key concepts

= Revision control, version control, code management … Managing of multiple versions of same unit of information (any files)Users have local working copy that can be synchronized/compared/updated to a central repository

Page 40: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 40 of 50

Subversion Architecture

FSFS Repository setup

Page 41: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 41 of 50

TortoiseSVN

Implemented as an Explorer extension accessed through the context menuDoes not require Subversion (svnserve) to be installed on computer.Can create and manage Subversion repositories

Page 42: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 42 of 50

Benefits of Source Control

Backup code outside of your working folder or even on a remote computer disaster recovery

There are internet-based source control service providers

Commit changes to file(s)/folder(s) into the repository with some descriptive text Revert file(s)/folder(s) back to some previous stateReview changes that have been made since last commit (Diff)

For text files – something you can open and edit in Notepad(e.g. code files not Word or Excel documents)

Multiple users can access same files over a network and have their own working copy

Page 43: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 43 of 50

TortoiseSVNA GUI for Subversion integrated into Explorer

Right-click in anyfolder …

Page 44: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 44 of 50

Diff’ing and Blaming with TortoiseSVN

Page 45: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 45 of 50

Working copy

A folder that has a _svn sub-folder that tracks changes to files/folders in the parent folder relative to specific folder in the repositoryCreated by checking out a folder from the repositoryHave an existing “source” folder you want to make a working copy?

Create a “repo” folder in repository to store source folderImport source folder into Subversion repositoryDelete content of source folderCheckout repo folder from Subversion repository into source folder

Page 46: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 46 of 50

Common operations

Refer to references cited on web page, especially “David’s Subversion Guide”

Page 47: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 47 of 50

Version control key concepts

RepositoryA databased stored in standard named folders (e.g. conf, data). and files. Stores the data from user’s folders / files that are under version control. Accessed via client software (e.g. TortoiseSVN)

Working copyFolder containing folders / files under version control. Each working copy folder/subfolder has a special folder (_svn) that keeps version information for each file/folder it contains.

ImportImport folder and any folders/files it contains into repository.

CheckoutCheckout folder and any folders/files from a repository into a working copy folder (has _svn folder)

ExportExports folder and any folders/files from a repository into a folder (not working copy, no _svn)

CommitCommit changes in working copy folders/files to the repository

UpdateUpdate a working copy with latest changes in the repository

DiffShows the differences between working copy and repository (any revision)

RevertReverts the content of the working copy to an earlier version (revision) in the repository

History / LogShows the “commit” messages for the selected working copy folder(s)/file(s)

Delete & RenameDelete/Rename file using repository client (e.g. TortoiseSVN) NOT explorer. This will ensure folders/files are synchronized with the repository

Page 48: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 48 of 50

Page 49: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 49 of 50

A bit about you …

Name

Apart from GIS and programming, what do you enjoy in life?

On written assessment … What do you hope to get out of this course?

Particular skills or experience

Page 50: GIS4107 Day 11 of 50 GIS 4107 – Visual Programming Instructor: David Viljoen (Last name pronounced vil-john) dviljoen@sympatico.ca

GIS4107 Day 1 50 of 50

References

“Flow” by Mihaly Csikszentmihalyi

“Pragmatic Thinking & Learning”by Andy Hunt

“Anticancer: A New Way of Life” by David Servan-Schreiber, MD, PhD

“Predictably Irrational, Revised and Expanded Edition: The Hidden Forces That Shape Our Decisions” by Dan Ariely