i ♥ maps: quantum gis + python

25
I MAPS: QUANTUM GIS + PYTHON PAIGE BAILEY AUGUST 6 T H , 2014

Upload: keren

Post on 08-Feb-2016

40 views

Category:

Documents


0 download

DESCRIPTION

I ♥ Maps: quantum Gis + Python. Paige Bailey August 6 th , 2014. Three W’s of Geography:. What is where? Why is it there? …and why do I care ?. What is a GIS?. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: I  ♥  Maps: quantum  Gis  + Python

I ♥ MAPS:

QUANTUM GIS + PY

THON

P A I GE B A I L E Y

A U GU

S T 6T

H , 2 0 1 4

Page 2: I  ♥  Maps: quantum  Gis  + Python

THREE W’S OF GEOGRAPHY:

What is where?Why is it there?

…and why do I care?

Page 3: I  ♥  Maps: quantum  Gis  + Python

WHAT IS A GIS?GIS = stands for “geographic information system”, “geographical information

science”, or “geospatial information studies”, depending on who you talk to

GIS is an ecoystem of computer software; hardware and data; and personnel to help manipulate, analyze and present information that is tied to a spatial location.

• Spatial location – usually a geographic location• Information – visualization of analysis of data• System – linking software, hardware, data• People – a user and analyst of all of the above!

What you’re really after are “Smart Maps” – visualizing, manipulating, analyzing, and displaying spatial data, connected to a database.

Page 4: I  ♥  Maps: quantum  Gis  + Python

…AND WHAT IS A GIS NOT?• GPS – global positioning system (though these do come into

play to obtain geographic coordiantes quite often)• A static, unchanging map – paper or digital• Maps are often the product of a GIS, but are just a way to visualize

the analysis• The magic comes by separating the variables and making it

dynamic• A specific software package, like QGIS or ArcGIS• Estimates are that 80% of all data has some sort of spatial

component

Page 5: I  ♥  Maps: quantum  Gis  + Python

DATABASES AREN’T REALLY ALL THAT EASY TO INTERPRET, CONNECTIONS AREN’T EASY TO SEE:

Page 6: I  ♥  Maps: quantum  Gis  + Python

…BUT WHEN MAPPED:

Page 7: I  ♥  Maps: quantum  Gis  + Python

INPUTTING AND VISUALIZING DATA• Raster – like a grid• Pixels• Each pixel has a location and value• Satelite images and aerial photos are examples

• Vector – linear• Comprised of points, lines, and polygons• “Features” (house, lake, etc.)

• Features have “attributes”: size, type, length, etc.

Page 8: I  ♥  Maps: quantum  Gis  + Python

WHAT IS QUANTUM GIS?• Quantum GIS (QGIS) is an open-source desktop

GIS product that helps you visualize, manage, edit, analyze, and compose maps with geographic data.

• Runs on Linux, Unix, Mac OSX, and Windows• Supports vector, raster, and database formats –

and these formats can be obtained from anywhere

• GNU Public License• Written in C++• Uses the Qt library• Allows integration of plugins developed using

either C++ or Python

Page 9: I  ♥  Maps: quantum  Gis  + Python

HISTORY AND COMMUNITY• Was started in May 2002• Has a huge user community, and is constantly growing –

web site, source code (SVN), bug tracker, and mailing lists are hosted and partially maintained by OSGeo.org

• Project Steering Committee – international team of developers and GIS users who each have a specific area of responsibility (development, release management, community resources, finance & marketing)

• Ways for you to contribute (if you want): code contributions, bug fixes, bug reports, contributed documentation, advocacy, supporting other users on mailing lists and the QGIS Forum

Page 10: I  ♥  Maps: quantum  Gis  + Python

SOME WAYS THAT GIS IS USED:• Emergency services: -- rescue groups, firefighters, police• Environmental -- monitoring and modeling• Business – site locations, delivery systems, customer

locations, “geotriggers”• Industry – transportation, communication, mining, pipelines,

oil, health care• Government – local, state, federal, military• Education – research, as a teaching tool, administration

Page 11: I  ♥  Maps: quantum  Gis  + Python

SPECIFIC CASE STUDIESNetworking solutions – route optimization, like Google MapsEcosystem Management – tracking deforestation, migration of

species, endangered species, protected animals and plantsOil and mineral exploration – three-dimensional visualization

with leases, wellsEnvironmental monitoring of a toxic plume or oil spillModeling of social demographics, -- how populations change

over timeFacilities mapping – can show where specific areas are in an

office building, where trees are on Rice’s campus, where patients are in a hospital

Page 12: I  ♥  Maps: quantum  Gis  + Python

ROUTE OPTIMIZATION

Page 13: I  ♥  Maps: quantum  Gis  + Python

SPECIES PATTERNS

Page 14: I  ♥  Maps: quantum  Gis  + Python

MAPPING OIL CONTAMINATION

Page 15: I  ♥  Maps: quantum  Gis  + Python

SOCIAL DEMOGRAPHICS

Page 16: I  ♥  Maps: quantum  Gis  + Python

RICE UNIVERSITY TREE MAP

Page 17: I  ♥  Maps: quantum  Gis  + Python

GEOLOGICAL MODELING

Page 18: I  ♥  Maps: quantum  Gis  + Python

SOME BEAUTIFUL EXAMPLES OF QGIS MAPShttps://www.flickr.com/groups/qgis/pool/https://www.flickr.com/groups/qgis-screenshots/

Page 19: I  ♥  Maps: quantum  Gis  + Python

WHY IS PYTHON A GOOD FIT FOR QGIS?• Clear, readable syntax• Implemented in many languages (C/C++, but also Java’s Jython

and .NET’s IronPython)• Can be used to access tons of OSGeo libraries and software• QGIS• PostGIS• GDAL/OGR• GEOS• JTS• GeoTools• Proj4• Mapserver• gvSIG

Page 20: I  ♥  Maps: quantum  Gis  + Python

WHAT IS QT ? AND PYQYT?• Qt helps you build graphical user interfaces• Developed by Nokia • Exists in Google Earth, Virtual Box, Skype, Autodesk,

Android smart phones, QGIS• Qt is built using the C++ language – supports a number of

compilers• PyQt = Python bindings that wrap C++ Qt libraries,. This is

great, because it means that we can build Qt applications without learning C++

Page 21: I  ♥  Maps: quantum  Gis  + Python

QGIS + PYTHON• Plugins – can create your own, or install public or private.

Allows users to create / extend editing tools that interact with data inside the QGIS environment

• Python console – command line terminal inside QGIS that allows you to test out ideas and make quick one-off jobs. Can interact with layers that are loaded into QGIS, access their attributes and geometry

• Python scripts and applications – writing applications from scratch that are built off QGIS and Qt libraries (we’re not doing that today)

Page 22: I  ♥  Maps: quantum  Gis  + Python

PLAYING WITH THE PYTHON CONSOLE• Accessing layers• activeLayer()• QgsMapCanvas• Visible layers vs. layers in the order they’re stacked in the table of

contents• Loading layers into QGIS• addVectorLayer() – takes three args (path, basename, provider key)• addRasterLayer() – takes two args (path and basename)

• Accessing vector geometry• OgsGeometry• Buffer, intersection, combine, difference

• Accessing data attributes• What’s the name of the selected feature?• What values does this raster cell have?• How many features meet this filtering requirement?

Page 23: I  ♥  Maps: quantum  Gis  + Python

INSTALLING QGIS PLUGINS[ open up QGIS, show where the plugins are housed] [install a random public one][show how you can investigate the .py files using a terminal

window in /.qgis2/python/plugins][encourage folks to change parameters and recompile to see

how layers change, once they check out Python QGIS Cookbook]

Page 24: I  ♥  Maps: quantum  Gis  + Python

LET’S MAKE A TH

ING!

Page 25: I  ♥  Maps: quantum  Gis  + Python

QUESTIONS?

Than

ks!