Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

I ♥ Maps: Quantum GIS + Python

1,798 views

Published on

Quantum GIS (QGIS) is an open-source, highly customizable geospatial application that's great for data exploration, manipulation, and cartographic preparation -- in other words, it's software that allows you to make detailed, aesthetically-pleasing maps for free!

QGIS is also *extremely* script-able with Python, and integrates with a large number of database and analysis backends (GRASS, R, PostGIS, etc.). In this talk, Paige Bailey will be giving a short overview of QGIS; detailing a few mapping case studies; then showing how to leverage additional functionality by writing custom Python plugins.

Published in: Technology
  • Be the first to comment

I ♥ Maps: Quantum GIS + Python

  1. 1. THREE W’S OF GEOGRAPHY: What is where? Why is it there? …and why do I care?
  2. 2. 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.
  3. 3. …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
  4. 4. DATABASES AREN’T REALLY ALL THAT EASY TO INTERPRET, CONNECTIONS AREN’T EASY TO SEE:
  5. 5. …BUT WHEN MAPPED:
  6. 6. 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.
  7. 7. 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
  8. 8. 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
  9. 9. 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
  10. 10. SPECIFIC CASE STUDIES Networking solutions – route optimization, like Google Maps Ecosystem Management – tracking deforestation, migration of species, endangered species, protected animals and plants Oil and mineral exploration – three-dimensional visualization with leases, wells Environmental monitoring of a toxic plume or oil spill Modeling of social demographics, -- how populations change over time Facilities mapping – can show where specific areas are in an office building, where trees are on Rice’s campus, where patients are in a hospital
  11. 11. ROUTE OPTIMIZATION
  12. 12. SPECIES PATTERNS
  13. 13. MAPPING OIL CONTAMINATION
  14. 14. SOCIAL DEMOGRAPHICS
  15. 15. RICE UNIVERSITY TREE MAP
  16. 16. GEOLOGICAL MODELING
  17. 17. SOME BEAUTIFUL EXAMPLES OF QGIS MAPS https://www.flickr.com/groups/qgis/pool/ https://www.flickr.com/groups/qgis-screenshots/
  18. 18. 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
  19. 19. 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++
  20. 20. 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)
  21. 21. 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?
  22. 22. 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]

×