270 likes | 435 Views
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?.
E N D
I ♥ Maps:quantum Gis + Python Paige Bailey August 6th, 2014
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:
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 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
Some beautiful examples of qgis maps • https://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]
Questions? Thanks!