i ♥ maps: quantum gis + python

Post on 08-Feb-2016

40 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

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

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

THREE W’S OF GEOGRAPHY:

What is where?Why is it there?

…and why do I care?

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.

…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

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

…BUT WHEN MAPPED:

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.

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

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

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

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

ROUTE OPTIMIZATION

SPECIES PATTERNS

MAPPING OIL CONTAMINATION

SOCIAL DEMOGRAPHICS

RICE UNIVERSITY TREE MAP

GEOLOGICAL MODELING

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

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

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++

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)

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?

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]

LET’S MAKE A TH

ING!

QUESTIONS?

Than

ks!

top related