GEOG 435/535
GIS Programming
Salisbury University
Department of Geography
© Arthur J. Lembo, Jr.
GEOG 435/535 – GIS Programming
Introduction
• Reasons for taking this course
• Your expectations
– _______________
– _______________
• My expectations
– Course description
– Exams
– Attendance
• Major goals for the semester
• Relevance to emerging markets
• Topics to be covered
Salisbury University
Department of Geography
© Arthur J. Lembo, Jr.
GEOG 435/535 – GIS Programming
Syllabus
•
•
•
•
General introduction to programming
Familiarity with a GIS GUI
Introduction to SQL
Expansion of SQL to Spatial SQL (what I call
a language for geographers)
• An introduction to python
• Arcpy in context (spatial and non-spatial)
• Individual projects or group projects
Salisbury University
Department of Geography
© Arthur J. Lembo, Jr.
GEOG 435/535 – GIS Programming
Importance of Programming
• Pushing buttons only gets you so far
– Eliminating the glass ceiling
• Google phenomenon has opened up a
massive hole in the geography dam that will
need to be filled
• A way to explore new ways of doing things
Salisbury University
Department of Geography
© Arthur J. Lembo, Jr.
GEOG 435/535 – GIS Programming
Some examples of what I mean…
•
•
•
•
•
•
•
•
Trade area analysis
Dashboards for DLLR
Dashboards for BayStat
SELECT sum(cur_lnd_a)+
Mass cartography
sum(cur_tot_a) FROM parcels,
wetlands
where
Agricultural evaluation
touches(parcels.id,wetlands.id)
Parcel evaluation and critical areas
SELECT parcels.* FROM
Data entry tasks
parcels, wetlands
where
touches(parcels.id,wetlands
Discussion of parcel selection
.id)
Salisbury University
Department of Geography
© Arthur J. Lembo, Jr.
GEOG 435/535 – GIS Programming
Scripting vs. Programming
• Is there a difference?
– the line between a scripting language and a programming language is
blurred, but a purist might say:
• A scripting language is a type of programming language used to provide
control in another host environment. It is interpreted rather than compiled.
This means that a program built with a scripting language must be run in the
environment that contains the scripting language's interpreter and cannot be
run as a stand-alone application.
• Benefits of scripting
– Easy to learn - compared to traditional programming languages.
– It takes much less code to do something with scripting than
when using a traditional programming language.
• Benefits of programming
– More tools available, faster, and includes interesting ways to
deploy the code
Salisbury University
Department of Geography
© Arthur J. Lembo, Jr.
GEOG 435/535 – GIS Programming
What is .NET
• The core aspects of the .NET
framework lie within the
Common Language
Infrastructure, or CLI.
• The purpose of the CLI is to
provide a language-neutral
platform for
– application development
– execution, including functions for
exception handling, garbage
collection, security, and
interoperability
Salisbury University
Department of Geography
© Arthur J. Lembo, Jr.
GEOG 435/535 – GIS Programming
What is .NET
•
Interoperability
–
•
Common Runtime Engine
–
•
Installation of computer software must be carefully managed to ensure that it does not interfere with
previously installed software, and that it conforms to increasingly stringent security requirements.
The .NET framework includes design features and tools that help address these requirements.
Security
–
•
The Base Class Library (BCL), part of the Framework Class Library (FCL), is a library of functionality
available to all languages using the .NET Framework. The BCL provides classes which encapsulate
a number of common functions, including file reading and writing, graphic rendering, database
interaction and XML document manipulation.
Simplified Deployment
–
•
The .NET Framework introduces a Common Type System, or CTS. The CTS specification defines all
possible datatypes and programming constructs supported by the CLR and how they may or may
not interact with each other. Because of this feature, the .NET Framework supports the exchange of
instances of types between programs written in any of the .NET languages.
Base Class Library
–
•
Programming languages on the .NET Framework compile into an intermediate language known as
the Common Intermediate Language (CIL). In Microsoft's implementation this intermediate language
is not interpreted but rather compiled in a manner known as just-in-time compilation (JIT) into native
code.)
Language Independence
–
•
Because interaction between new and older applications is commonly required, the .NET
The design is meant to address some of the vulnerabilities, such as buffer overflows, that have been
exploited by malicious software. Additionally, .NET provides a common security model for all
applications.
Portability
–
The design of the .NET Framework allows it to theoretically be platform agnostic, and thus crossplatform compatible. That is, a program written to use the framework should run without change on
any type of system for which the framework is implemented.
Salisbury University
Department of Geography
© Arthur J. Lembo, Jr.
GEOG 435/535 – GIS Programming
Lots of languages to choose
•
•
Microsoft Languages
–
Visual Basic (VB or VB .NET) - A full-fledged development language that is normally used within Microsoft's
Visual Studio development environment. Visual Basic is a compiled language. Many professional applications that
are not coded in Visual C++ are coded in Visual Basic. Visual Basic includes superb editing, forms creation and
other accessories that facilitate use of this language.
–
Javascript (JScript or JScript .NET) - JScript is Microsoft's implementation of the widely used Javascript
language, a scripting version of the Java language. Javascript is a favorite of "cross platform" writers creating
Internet applications who wish to write scripts that work with many different browsers on Windows and nonWindows operating systems. JScript is an interpreted language that executes within an ActiveX scripting engine.
–
Visual Basic Scripting Edition (VBScript) - A subset of Visual Basic that is a very widely used scripting
language, in part because it comes free with every copy of Microsoft's Internet Explorer browser and may be freely
redistributed with applications created using Visual Studio. VBScript is the scripting language of choice (with JScript
being a second choice) for Microsoft web applications. It is the main language used with ActiveX scripting.
Microsoft's push into Internet has made VBScript immensely popular and well supported by third parties with
numerous books and objects. An interpreted language, VBScript has become so popular that third parties (such as
manifold.net) are now extending it with forms creation and other tools. VBScript is virtually identical to VB so
expertise in either VB or VBScript is automatically useful in the other language as well. VBScript has also emerged
as the main language used to configure and customize Microsoft's Enterprise class servers.
OTHER LANGUAGES
–
Python - Python is a widely used general-purpose, high-level programming language. Its design philosophy
emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than
would be possible in languages such as C.The language provides constructs intended to enable clear programs on
both a small and large scale.
–
Java
Salisbury University
Department of Geography
© Arthur J. Lembo, Jr.
GEOG 435/535 – GIS Programming
Examples of Languages
• Which is better? You be the judge
(distances.map)
–
–
–
–
VBScript
Javascript
C#
python
• Why are we using python?
–
–
–
–
Ease of use
Ease of implementation
We are geographers, not computer scientists
The ESRI world
Salisbury University
Department of Geography
© Arthur J. Lembo, Jr.
GEOG 435/535 – GIS Programming
What’s so cool about SQL
• Introducing QGIS, PostGIS, and PGAdmin
Salisbury University
Department of Geography
© Arthur J. Lembo, Jr.
GEOG 435/535 – GIS Programming
My first script
•
•
•
•
The Text Editor
Hello, world
A note about .py extension
Height in centimeters
• How do I do that?
– Class data directory
Salisbury University
Department of Geography
© Arthur J. Lembo, Jr.
GEOG 435/535 – GIS Programming
Descargar

GEOG 335 - Salisbury