狠狠撸

狠狠撸Share a Scribd company logo
Workshop – Lund 2015 1
Landscape ecology analysis with QGIS
Workshop at Lund University (2015) by Martin Jung
Workshop – Lund 2015 2
About me
● BSc thesis about plant-pollinator networks in Bia?owieza
● MSc thesis about broad-scale biodiversity modelling
● Starting a PhD in september on Global biodiversity impacts of land-use
dynamics
● Using QGISQGIS since many years, two plugins (LecoS, QSDM)
Twitter: @Martin_Ecology
Blog: http://conservationecology.wordpress.com/
Workshop – Lund 2015 3
Roadplan for today
1 Working with GIS formats and attributes in QGIS
2 Projections
3 Introduction to Georeferencing with QGIS
… Short break somewhere here ...
4 Landscape Analysis with QGIS (LecoS)
5 Questions and problems (...Open end...)
Workshop – Lund 2015 4
Now install (if you haven't already)
● Make some room on your computer (at least 1 GB !)
● Install the current Stable Version ( QGIS 2.8 ) on your computer (see
provided folder) for Windows
● MAC-Users: Download QGIS and install python libraries
● (http://www.kyngchaos.com/software/python )
Important!
– Make sure the libraries python-scipy, python-numpy, python-pil and python-
matplotlib are checked
Workshop – Lund 2015 5
● Select “Advanced Install”
● “Install from local Folder”
● Mark everything
– Qgis
– Python-numpy
– Python-scipy
– ...
How to install (WIN)
Install from local folder
Workshop – Lund 2015 6
GIS data
formats
Source: maprabu.blogspot.com
Format:
*.shp, *.csv, *.gpx, *.kml, ...
Format:
*.tif, *.vrt, *.hdr, *.asc, ...
Workshop – Lund 2015 7
Raster vs vector
● Vector
– Advantage: Accuracy, more visually pleasing
– Disadvantage: Space-inefficient. Every vertex needs to be stored.
Algorithms computational intensive.
● Raster
– Advantage: Geogr. Position associated with data, easier for analysis
– Disadvantage: Resolution dependent on cellsize. Often not nice-
looking
Workshop – Lund 2015 8
Other data sources
● Google, Bing, Openstreetmaps, ... ( OpenLayers plugin)
● WMS server, for instance the EEA WMS services
– http://discomap.eea.europa.eu/home.html
– Can be loaded into QGIS as WMS layer
Those files can be visualized, but not edited (see WFS) !!!
You can make a screenshot though and georeference this, but check
the publishers license!
Workshop – Lund 2015 9
A note on proprietary formats
● Long-term ArcGIS users are often confronted with .lyr files
– Proprietary format by ESRI. Container that stores data and viz
● (Open-source alternative in QGIS ← .qlr )
● TMK: Not convertible without having a ESRI license!
– Arc2Earth extension for ArcMap lets you save .lyr to .sld
Workshop – Lund 2015 10
What are Map projections
● Map projections to represent a 3-dimensional structure on a 2d
planar plane
● Many formats and types
– Spherical, azimuthal, equidistant, equal area, …
– Most commonly used:
● WGS84 (lon,lat ← In degree)
● WGS84 Google Pseudo-Mercator (in meter, but inaccurate in tropics!!! )
● WGS84 UTM (in meter, subdivided in lon-lat grids)
http://epsg.io/ ← Lookup projections
Workshop – Lund 2015 11
Now hands on in QGIS
Workshop – Lund 2015 12
Geo-referencing with QGIS
● GR is the process of
associating data with spatial
coordinates
● In QGIS using the excellent
gdal-referencer
● What we need:
– A non-spatial file
– A reference projection
– Reference points or ROI
Harsj?n
Workshop – Lund 2015 13
(1) Get the geocode plugin (or use the bar) to jump to
59.55275,18.33490 long-lat
(2) Load Google layers or any other WMS service
(3) Make sure the gdal-georeferencer is available (Raster menu)
(4) Add the Harsj?n.tif file to the referencer and add around 5-6
GCP points – Choose linear interpolation
(5) Now you have the rasterized the map and create a new
vector point layer with the study-locations
Workshop – Lund 2015 14
Visualizing Gradients
● Add the pH-0915_3.csv to
QGIS via “Add-delimited-
Text-layer”
● Specify RT90 2.5 gon V as
projection (assumed)
● Color the points with the Ph
attribute
● Subset to Skane (Select –
Save Selection).
Computational intensive!!!
● Use the Heatmap plugin (Ph
as weight) or GRASS-
modules in Processing
(v.surf.*)
Vector Raster
Workshop – Lund 2015 15
Use the new Heatmap renderer (QGIS 2.8)
Workshop – Lund 2015 16
Short Break
Kort paus
Kurze Pause
Workshop – Lund 2015 17
LecoS
● Simple Plugin to extract landscape metrics from raster layer
● Inspired by FRAGSTAT
● With Graphical interface, but more options available in
Processing Toolbox
Workshop – Lund 2015 18
Example Data set
Use the data within the Gotland zip file
Workshop – Lund 2015 19
Research questions
1) What is the most abundant land-cover type in the study
locations?
2) How much combined forest is there in our study sites?
3) How heterogen is the landcover in our study-sites?
4) What is the distance to the Forest-edge for each of our sites?
● (Optional) Neutral Landscape Models with NLMPy
Workshop – Lund 2015 20
Landscape analysis preparation
Landscape Layer Studylocations with 500m Buffer
Workshop – Lund 2015 21
Research Question 1.)
● Crop your the raster dataset with your buffered Studysites
(overlapping buffers are not correctly cropped. Use DissolveDissolve first)
● Use “LecoS – Land cover statistics” to compute the
“Landscape proportion” of each land cover class
● Use “Groupstats”, “QScatter” or “Statist” to get the aggregated
values
– Or export to csv and open with a spreadsheet program!
Workshop – Lund 2015 22
Results Question 1.)
Results Top 3:
30 (?kermark) Arable land→ 21 %
44 (Barrskog ej p? lavmark 7-15 meter) Coniferous
forest →17 %
32 (Betesmark) Pasture → 11 %
Workshop – Lund 2015 23
Research Question 2.)
● Isolate all forest cover from both datasets using the raster calculator
(Classes 40 – 50)
●
("Layer_Gotland@1" >= 40 AND "Layer_Gotland@1" <= 50)("Layer_Gotland@1" >= 40 AND "Layer_Gotland@1" <= 50)
● Use “LecoS – Polygon overlay” to compute the Total forest cover for
each buffer
● Ether add to attribute table (Layer needs to be reloaded ) or save as
csv
Workshop – Lund 2015 24
Results Question 2.)
● On average:
– 285874 m? (28.58 ha)
Workshop – Lund 2015 25
Research Question 3.)
● In order to measure land-cover heterogeneity you have 2
options:
– Ether use the Moving Window in the Processing Toolbox, select
variety and an appropriate window size
– Afterwards extract the mean for each of your buffers using the
polygon-overlay
● Or
– Use the LecoS polygon-overlay tool to compute a “diversity-index”
like Shannon or Simpson index for each of your buffers
Workshop – Lund 2015 26
Research
Question 3.)
Workshop – Lund 2015 27
Research Question 4.)
The landscape modifier
● Clean Map of small pixels
● Extract the forest edge of the previous
generated forest extract.
● Then use the Proximity tool in the
Raster menu
● Use the Save-As function (rightclick
raster) to correctly set a nodata-value
● Use LecoS to extract the median values
inside the grid per buffer or point
Workshop – Lund 2015 28
Results question 4.)
FeatureID 27 + 30
farthest away from forest
edge
~ 942m and 522m
Workshop – Lund 2015 29
(Optional) Neutral Landscape Models (NLMpy)
● LecoS has optional NLMpy
support since version 1.9.3
● Neutral Landscape Models
as “Nullmodel” for continuous
and classified landscapes
● Publication:
● onlinelibrary.wiley.com/doi/10
.1111/2041-210X.12308/full
Workshop – Lund 2015 30
How to get the library?
● In order to install non-supported libraries you have to use PIP
(python package index).
● NO Guarantee that this will work for your!
● https://pypi.python.org/pypi/nlmpy
– Open the Python console in QGIS (or terminal on Linux)
– Run pip install nlmpy
– Or alternatively download and pip install nlmpy-0.1.1.tar.gz
Workshop – Lund 2015 31
Time for Map Presentation?
Workshop – Lund 2015 32
Running scripts in the Processing Toolbox
● The Processing toolbox (formerly called Sextante) in QGIS can
be used to write models and script to do repeatable tasks
● Currently Python and R scripts are supported
● In order to create a R-script, make sure that it is enabled in the
Processing options (menu)
Workshop – Lund 2015 33
Other useful stuff -
Processing R commands
Command Function
##[datagis]=group Sets the group to “datagis”
##layer = vector or raster Specifies the input layer to use
##distance=number 100 Sets a number field with default 100
##title=string France Get text input. Default is “France”
##field=field layer Select a field from the vector layer “layer”
hist(layer[[field]]) R-command: Histogram for fields from layer
##showplots Has to be set in order to see plot outputs
>t.test(layer[[field]]) Console output with a “>” before command
##output=output vector File output as vector or raster
Workshop – Lund 2015 34
Example Script
##[Own Scripts]=group
##showplots
##layer=vector
##y=field layer
##x=field layer
plot(as.numeric( layer[[y]] )~as.numeric( layer[[x]] ),pch=19,bty="l",ylab=paste( y ),xlab=paste( x ) )
fit = lm( layer[[y]]~layer[[x]] )
abline(fit,col="blue",lwd=2)
Workshop – Lund 2015 35
Additional examples, help and tutorials
● http://www.gistutor.com/
● http://qgis.spatialthoughts.com/
● Youtube → search QGIS
● http://gis.stackexchange.com
● QGIS-user mailing list → http://lists.osgeo.org/listinfo/qgis-user
Workshop – Lund 2015 36
Thanks for your attention!
Open questions....!
Ad

Recommended

GRASS GIS 7 capabilities: a graphical overview
GRASS GIS 7 capabilities: a graphical overview
Markus Neteler
?
GRASS GIS e Sextante
GRASS GIS e Sextante
Markus Neteler
?
GRASS GIS 7: your reliable geospatial number cruncher
GRASS GIS 7: your reliable geospatial number cruncher
Markus Neteler
?
Vom Laptop zum Gro?rechner: Neues in GRASS GIS 7
Vom Laptop zum Gro?rechner: Neues in GRASS GIS 7
Markus Neteler
?
OpenWebGlobe - GeoSharing Bern
OpenWebGlobe - GeoSharing Bern
Martin Christen
?
GeoServer for Spatio-temporal Data Handling With Examples For MetOc And Remot...
GeoServer for Spatio-temporal Data Handling With Examples For MetOc And Remot...
GeoSolutions
?
Geographic scripting in uDig
Geographic scripting in uDig
Andrea Antonello
?
Big Linked Data Federation - ExtremeEarth Open Workshop
Big Linked Data Federation - ExtremeEarth Open Workshop
ExtremeEarth
?
Reproducibility with R
Reproducibility with R
Martin Jung
?
Apresenta??o Achva Stein
Apresenta??o Achva Stein
transformurb
?
Millington Research Overview | EED Seminar Sept 2013
Millington Research Overview | EED Seminar Sept 2013
James Millington
?
R presentation - UoN
R presentation - UoN
Lukasz Kosma Bonenberg
?
WF ED 540, CLASS MEETING 7, RMarkdown, 2016
WF ED 540, CLASS MEETING 7, RMarkdown, 2016
Penn State University
?
Landscape ecology (2013bpln010)
Landscape ecology (2013bpln010)
Bhupendra Singh
?
Landscape ecology
Landscape ecology
Mary Scipioni
?
Ecology architecture
Ecology architecture
Universidad Yacambú
?
Presentation - Lund 2013 GIS workshop
Presentation - Lund 2013 GIS workshop
Martin Jung
?
QGIS Tutorial 2
QGIS Tutorial 2
niloyghosh1984
?
QGIS Module 1
QGIS Module 1
CAPSUCSF
?
SAGT Conference 2016 - Teaching Census through GIS
SAGT Conference 2016 - Teaching Census through GIS
celiamac58
?
QGIS Open Source Desktop GIS
QGIS Open Source Desktop GIS
GIS Colorado
?
Introduction_to_QGIS_Revision, read before
Introduction_to_QGIS_Revision, read before
MadhuSudhan725843
?
150810 ilts workshop_handson_presentation
150810 ilts workshop_handson_presentation
Takayuki Nuimura
?
Spatial analysis and Analysis Tools ( GIS )
Spatial analysis and Analysis Tools ( GIS )
designQube
?
iGETT Exercise Lesson Classify
iGETT Exercise Lesson Classify
Michelle Kinzel, GISP
?
I ? Maps: Quantum GIS + Python
I ? Maps: Quantum GIS + Python
Paige Bailey
?
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Guy Lansley
?
Esriuk_track8_newcastle_embedding_gis
Esriuk_track8_newcastle_embedding_gis
Esri UK
?
QGIS UK User Group - QGIS Evangelism (thinkWhere)
QGIS UK User Group - QGIS Evangelism (thinkWhere)
QGIS UK
?
QGIS UK: QGIS Evangelism (thinkWhere)
QGIS UK: QGIS Evangelism (thinkWhere)
Ross McDonald
?

More Related Content

Viewers also liked (8)

Reproducibility with R
Reproducibility with R
Martin Jung
?
Apresenta??o Achva Stein
Apresenta??o Achva Stein
transformurb
?
Millington Research Overview | EED Seminar Sept 2013
Millington Research Overview | EED Seminar Sept 2013
James Millington
?
R presentation - UoN
R presentation - UoN
Lukasz Kosma Bonenberg
?
WF ED 540, CLASS MEETING 7, RMarkdown, 2016
WF ED 540, CLASS MEETING 7, RMarkdown, 2016
Penn State University
?
Landscape ecology (2013bpln010)
Landscape ecology (2013bpln010)
Bhupendra Singh
?
Landscape ecology
Landscape ecology
Mary Scipioni
?
Ecology architecture
Ecology architecture
Universidad Yacambú
?

Similar to Lund 2015 - QGIS workshop (20)

Presentation - Lund 2013 GIS workshop
Presentation - Lund 2013 GIS workshop
Martin Jung
?
QGIS Tutorial 2
QGIS Tutorial 2
niloyghosh1984
?
QGIS Module 1
QGIS Module 1
CAPSUCSF
?
SAGT Conference 2016 - Teaching Census through GIS
SAGT Conference 2016 - Teaching Census through GIS
celiamac58
?
QGIS Open Source Desktop GIS
QGIS Open Source Desktop GIS
GIS Colorado
?
Introduction_to_QGIS_Revision, read before
Introduction_to_QGIS_Revision, read before
MadhuSudhan725843
?
150810 ilts workshop_handson_presentation
150810 ilts workshop_handson_presentation
Takayuki Nuimura
?
Spatial analysis and Analysis Tools ( GIS )
Spatial analysis and Analysis Tools ( GIS )
designQube
?
iGETT Exercise Lesson Classify
iGETT Exercise Lesson Classify
Michelle Kinzel, GISP
?
I ? Maps: Quantum GIS + Python
I ? Maps: Quantum GIS + Python
Paige Bailey
?
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Guy Lansley
?
Esriuk_track8_newcastle_embedding_gis
Esriuk_track8_newcastle_embedding_gis
Esri UK
?
QGIS UK User Group - QGIS Evangelism (thinkWhere)
QGIS UK User Group - QGIS Evangelism (thinkWhere)
QGIS UK
?
QGIS UK: QGIS Evangelism (thinkWhere)
QGIS UK: QGIS Evangelism (thinkWhere)
Ross McDonald
?
Spatial Analysis with R - the Good, the Bad, and the Pretty
Spatial Analysis with R - the Good, the Bad, and the Pretty
Noam Ross
?
QGIS training
QGIS training
Bonface Thaa
?
Mastering_ArcGIS_Pro_CH11_ADA_AU_Accessible.pptx
Mastering_ArcGIS_Pro_CH11_ADA_AU_Accessible.pptx
BrycePeacher1
?
GeoServer beginners gwf_2015
GeoServer beginners gwf_2015
GeoSolutions
?
QGIS Training.pptx
QGIS Training.pptx
SeemaAjay7
?
MoWE-QGIS_Training-March2022-Day1_AM.pptx
MoWE-QGIS_Training-March2022-Day1_AM.pptx
AbdilbasitHamid
?
Presentation - Lund 2013 GIS workshop
Presentation - Lund 2013 GIS workshop
Martin Jung
?
QGIS Module 1
QGIS Module 1
CAPSUCSF
?
SAGT Conference 2016 - Teaching Census through GIS
SAGT Conference 2016 - Teaching Census through GIS
celiamac58
?
QGIS Open Source Desktop GIS
QGIS Open Source Desktop GIS
GIS Colorado
?
Introduction_to_QGIS_Revision, read before
Introduction_to_QGIS_Revision, read before
MadhuSudhan725843
?
150810 ilts workshop_handson_presentation
150810 ilts workshop_handson_presentation
Takayuki Nuimura
?
Spatial analysis and Analysis Tools ( GIS )
Spatial analysis and Analysis Tools ( GIS )
designQube
?
I ? Maps: Quantum GIS + Python
I ? Maps: Quantum GIS + Python
Paige Bailey
?
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Guy Lansley
?
Esriuk_track8_newcastle_embedding_gis
Esriuk_track8_newcastle_embedding_gis
Esri UK
?
QGIS UK User Group - QGIS Evangelism (thinkWhere)
QGIS UK User Group - QGIS Evangelism (thinkWhere)
QGIS UK
?
QGIS UK: QGIS Evangelism (thinkWhere)
QGIS UK: QGIS Evangelism (thinkWhere)
Ross McDonald
?
Spatial Analysis with R - the Good, the Bad, and the Pretty
Spatial Analysis with R - the Good, the Bad, and the Pretty
Noam Ross
?
Mastering_ArcGIS_Pro_CH11_ADA_AU_Accessible.pptx
Mastering_ArcGIS_Pro_CH11_ADA_AU_Accessible.pptx
BrycePeacher1
?
GeoServer beginners gwf_2015
GeoServer beginners gwf_2015
GeoSolutions
?
QGIS Training.pptx
QGIS Training.pptx
SeemaAjay7
?
MoWE-QGIS_Training-March2022-Day1_AM.pptx
MoWE-QGIS_Training-March2022-Day1_AM.pptx
AbdilbasitHamid
?
Ad

Recently uploaded (20)

Development of an AFOLU module for TIMES
Development of an AFOLU module for TIMES
IEA-ETSAP
?
TIMES-NZ 3.0: automating upstream data processing for an open-source workflow
TIMES-NZ 3.0: automating upstream data processing for an open-source workflow
IEA-ETSAP
?
China Grain Silos Manufacturer Center Enamel’s Premium Storage Solutions for ...
China Grain Silos Manufacturer Center Enamel’s Premium Storage Solutions for ...
AllenLin596164
?
The plant-level decarbonization pathways and mitigation cost of global oil re...
The plant-level decarbonization pathways and mitigation cost of global oil re...
IEA-ETSAP
?
Dry Bulk Storage Tanks Advanced Solutions for Bulk Material Storage.docx
Dry Bulk Storage Tanks Advanced Solutions for Bulk Material Storage.docx
AllenLin596164
?
Near-optimal solutions for long-term energy planning facing the possible crit...
Near-optimal solutions for long-term energy planning facing the possible crit...
IEA-ETSAP
?
The Deadly Risk of Leaving Kids in Cars.
The Deadly Risk of Leaving Kids in Cars.
Bisnar Chase Personal Injury Attorneys
?
global-energy-perspective-2024.pdf document
global-energy-perspective-2024.pdf document
constantinosvoulgari
?
IEA H2 TCP Task 52 Hydrogen for Iron and Steel Making
IEA H2 TCP Task 52 Hydrogen for Iron and Steel Making
IEA-ETSAP
?
Environmental Awareness impact of Giraffe Centre
Environmental Awareness impact of Giraffe Centre
African Fund for Endangered Wildlife (K)—Giraffe Centre
?
最新版美国加利福尼亚州立大学北岭分校毕业证(颁厂鲍狈毕业证书)原版定制
最新版美国加利福尼亚州立大学北岭分校毕业证(颁厂鲍狈毕业证书)原版定制
taqyea
?
Liberating energy models from modelers Amit Kanudia
Liberating energy models from modelers Amit Kanudia
IEA-ETSAP
?
Worldmap 狠狠撸s Powerpoint Template.pptx
Worldmap 狠狠撸s Powerpoint Template.pptx
911ak11062003
?
COMMUNITY HEALTH PROBLEMS GRADE 9 FIRST QUARTER
COMMUNITY HEALTH PROBLEMS GRADE 9 FIRST QUARTER
MarkNorlanGamazon1
?
Giraffe Centre's Methodology to shaping the Environmental Conservation Conver...
Giraffe Centre's Methodology to shaping the Environmental Conservation Conver...
African Fund for Endangered Wildlife (K)—Giraffe Centre
?
The Solar System - Earth and Life Science
The Solar System - Earth and Life Science
rizellemarieastrolo
?
Towards a national integrated energy, land and food system model for long ter...
Towards a national integrated energy, land and food system model for long ter...
IEA-ETSAP
?
SB62 IPCC Side Event - Working Group I contribution to the 7th IPCC Assessmen...
SB62 IPCC Side Event - Working Group I contribution to the 7th IPCC Assessmen...
ipcc-media
?
Growth responses of hybrid corn applied with black soldier fly frass (BSFF)
Growth responses of hybrid corn applied with black soldier fly frass (BSFF)
Open Access Research Paper
?
Are Heavy-Duty Vehicles at a Crossroads? A Real Options and Innovation Diffus...
Are Heavy-Duty Vehicles at a Crossroads? A Real Options and Innovation Diffus...
IEA-ETSAP
?
Development of an AFOLU module for TIMES
Development of an AFOLU module for TIMES
IEA-ETSAP
?
TIMES-NZ 3.0: automating upstream data processing for an open-source workflow
TIMES-NZ 3.0: automating upstream data processing for an open-source workflow
IEA-ETSAP
?
China Grain Silos Manufacturer Center Enamel’s Premium Storage Solutions for ...
China Grain Silos Manufacturer Center Enamel’s Premium Storage Solutions for ...
AllenLin596164
?
The plant-level decarbonization pathways and mitigation cost of global oil re...
The plant-level decarbonization pathways and mitigation cost of global oil re...
IEA-ETSAP
?
Dry Bulk Storage Tanks Advanced Solutions for Bulk Material Storage.docx
Dry Bulk Storage Tanks Advanced Solutions for Bulk Material Storage.docx
AllenLin596164
?
Near-optimal solutions for long-term energy planning facing the possible crit...
Near-optimal solutions for long-term energy planning facing the possible crit...
IEA-ETSAP
?
global-energy-perspective-2024.pdf document
global-energy-perspective-2024.pdf document
constantinosvoulgari
?
IEA H2 TCP Task 52 Hydrogen for Iron and Steel Making
IEA H2 TCP Task 52 Hydrogen for Iron and Steel Making
IEA-ETSAP
?
最新版美国加利福尼亚州立大学北岭分校毕业证(颁厂鲍狈毕业证书)原版定制
最新版美国加利福尼亚州立大学北岭分校毕业证(颁厂鲍狈毕业证书)原版定制
taqyea
?
Liberating energy models from modelers Amit Kanudia
Liberating energy models from modelers Amit Kanudia
IEA-ETSAP
?
Worldmap 狠狠撸s Powerpoint Template.pptx
Worldmap 狠狠撸s Powerpoint Template.pptx
911ak11062003
?
COMMUNITY HEALTH PROBLEMS GRADE 9 FIRST QUARTER
COMMUNITY HEALTH PROBLEMS GRADE 9 FIRST QUARTER
MarkNorlanGamazon1
?
The Solar System - Earth and Life Science
The Solar System - Earth and Life Science
rizellemarieastrolo
?
Towards a national integrated energy, land and food system model for long ter...
Towards a national integrated energy, land and food system model for long ter...
IEA-ETSAP
?
SB62 IPCC Side Event - Working Group I contribution to the 7th IPCC Assessmen...
SB62 IPCC Side Event - Working Group I contribution to the 7th IPCC Assessmen...
ipcc-media
?
Growth responses of hybrid corn applied with black soldier fly frass (BSFF)
Growth responses of hybrid corn applied with black soldier fly frass (BSFF)
Open Access Research Paper
?
Are Heavy-Duty Vehicles at a Crossroads? A Real Options and Innovation Diffus...
Are Heavy-Duty Vehicles at a Crossroads? A Real Options and Innovation Diffus...
IEA-ETSAP
?
Ad

Lund 2015 - QGIS workshop

  • 1. Workshop – Lund 2015 1 Landscape ecology analysis with QGIS Workshop at Lund University (2015) by Martin Jung
  • 2. Workshop – Lund 2015 2 About me ● BSc thesis about plant-pollinator networks in Bia?owieza ● MSc thesis about broad-scale biodiversity modelling ● Starting a PhD in september on Global biodiversity impacts of land-use dynamics ● Using QGISQGIS since many years, two plugins (LecoS, QSDM) Twitter: @Martin_Ecology Blog: http://conservationecology.wordpress.com/
  • 3. Workshop – Lund 2015 3 Roadplan for today 1 Working with GIS formats and attributes in QGIS 2 Projections 3 Introduction to Georeferencing with QGIS … Short break somewhere here ... 4 Landscape Analysis with QGIS (LecoS) 5 Questions and problems (...Open end...)
  • 4. Workshop – Lund 2015 4 Now install (if you haven't already) ● Make some room on your computer (at least 1 GB !) ● Install the current Stable Version ( QGIS 2.8 ) on your computer (see provided folder) for Windows ● MAC-Users: Download QGIS and install python libraries ● (http://www.kyngchaos.com/software/python ) Important! – Make sure the libraries python-scipy, python-numpy, python-pil and python- matplotlib are checked
  • 5. Workshop – Lund 2015 5 ● Select “Advanced Install” ● “Install from local Folder” ● Mark everything – Qgis – Python-numpy – Python-scipy – ... How to install (WIN) Install from local folder
  • 6. Workshop – Lund 2015 6 GIS data formats Source: maprabu.blogspot.com Format: *.shp, *.csv, *.gpx, *.kml, ... Format: *.tif, *.vrt, *.hdr, *.asc, ...
  • 7. Workshop – Lund 2015 7 Raster vs vector ● Vector – Advantage: Accuracy, more visually pleasing – Disadvantage: Space-inefficient. Every vertex needs to be stored. Algorithms computational intensive. ● Raster – Advantage: Geogr. Position associated with data, easier for analysis – Disadvantage: Resolution dependent on cellsize. Often not nice- looking
  • 8. Workshop – Lund 2015 8 Other data sources ● Google, Bing, Openstreetmaps, ... ( OpenLayers plugin) ● WMS server, for instance the EEA WMS services – http://discomap.eea.europa.eu/home.html – Can be loaded into QGIS as WMS layer Those files can be visualized, but not edited (see WFS) !!! You can make a screenshot though and georeference this, but check the publishers license!
  • 9. Workshop – Lund 2015 9 A note on proprietary formats ● Long-term ArcGIS users are often confronted with .lyr files – Proprietary format by ESRI. Container that stores data and viz ● (Open-source alternative in QGIS ← .qlr ) ● TMK: Not convertible without having a ESRI license! – Arc2Earth extension for ArcMap lets you save .lyr to .sld
  • 10. Workshop – Lund 2015 10 What are Map projections ● Map projections to represent a 3-dimensional structure on a 2d planar plane ● Many formats and types – Spherical, azimuthal, equidistant, equal area, … – Most commonly used: ● WGS84 (lon,lat ← In degree) ● WGS84 Google Pseudo-Mercator (in meter, but inaccurate in tropics!!! ) ● WGS84 UTM (in meter, subdivided in lon-lat grids) http://epsg.io/ ← Lookup projections
  • 11. Workshop – Lund 2015 11 Now hands on in QGIS
  • 12. Workshop – Lund 2015 12 Geo-referencing with QGIS ● GR is the process of associating data with spatial coordinates ● In QGIS using the excellent gdal-referencer ● What we need: – A non-spatial file – A reference projection – Reference points or ROI Harsj?n
  • 13. Workshop – Lund 2015 13 (1) Get the geocode plugin (or use the bar) to jump to 59.55275,18.33490 long-lat (2) Load Google layers or any other WMS service (3) Make sure the gdal-georeferencer is available (Raster menu) (4) Add the Harsj?n.tif file to the referencer and add around 5-6 GCP points – Choose linear interpolation (5) Now you have the rasterized the map and create a new vector point layer with the study-locations
  • 14. Workshop – Lund 2015 14 Visualizing Gradients ● Add the pH-0915_3.csv to QGIS via “Add-delimited- Text-layer” ● Specify RT90 2.5 gon V as projection (assumed) ● Color the points with the Ph attribute ● Subset to Skane (Select – Save Selection). Computational intensive!!! ● Use the Heatmap plugin (Ph as weight) or GRASS- modules in Processing (v.surf.*) Vector Raster
  • 15. Workshop – Lund 2015 15 Use the new Heatmap renderer (QGIS 2.8)
  • 16. Workshop – Lund 2015 16 Short Break Kort paus Kurze Pause
  • 17. Workshop – Lund 2015 17 LecoS ● Simple Plugin to extract landscape metrics from raster layer ● Inspired by FRAGSTAT ● With Graphical interface, but more options available in Processing Toolbox
  • 18. Workshop – Lund 2015 18 Example Data set Use the data within the Gotland zip file
  • 19. Workshop – Lund 2015 19 Research questions 1) What is the most abundant land-cover type in the study locations? 2) How much combined forest is there in our study sites? 3) How heterogen is the landcover in our study-sites? 4) What is the distance to the Forest-edge for each of our sites? ● (Optional) Neutral Landscape Models with NLMPy
  • 20. Workshop – Lund 2015 20 Landscape analysis preparation Landscape Layer Studylocations with 500m Buffer
  • 21. Workshop – Lund 2015 21 Research Question 1.) ● Crop your the raster dataset with your buffered Studysites (overlapping buffers are not correctly cropped. Use DissolveDissolve first) ● Use “LecoS – Land cover statistics” to compute the “Landscape proportion” of each land cover class ● Use “Groupstats”, “QScatter” or “Statist” to get the aggregated values – Or export to csv and open with a spreadsheet program!
  • 22. Workshop – Lund 2015 22 Results Question 1.) Results Top 3: 30 (?kermark) Arable land→ 21 % 44 (Barrskog ej p? lavmark 7-15 meter) Coniferous forest →17 % 32 (Betesmark) Pasture → 11 %
  • 23. Workshop – Lund 2015 23 Research Question 2.) ● Isolate all forest cover from both datasets using the raster calculator (Classes 40 – 50) ● ("Layer_Gotland@1" >= 40 AND "Layer_Gotland@1" <= 50)("Layer_Gotland@1" >= 40 AND "Layer_Gotland@1" <= 50) ● Use “LecoS – Polygon overlay” to compute the Total forest cover for each buffer ● Ether add to attribute table (Layer needs to be reloaded ) or save as csv
  • 24. Workshop – Lund 2015 24 Results Question 2.) ● On average: – 285874 m? (28.58 ha)
  • 25. Workshop – Lund 2015 25 Research Question 3.) ● In order to measure land-cover heterogeneity you have 2 options: – Ether use the Moving Window in the Processing Toolbox, select variety and an appropriate window size – Afterwards extract the mean for each of your buffers using the polygon-overlay ● Or – Use the LecoS polygon-overlay tool to compute a “diversity-index” like Shannon or Simpson index for each of your buffers
  • 26. Workshop – Lund 2015 26 Research Question 3.)
  • 27. Workshop – Lund 2015 27 Research Question 4.) The landscape modifier ● Clean Map of small pixels ● Extract the forest edge of the previous generated forest extract. ● Then use the Proximity tool in the Raster menu ● Use the Save-As function (rightclick raster) to correctly set a nodata-value ● Use LecoS to extract the median values inside the grid per buffer or point
  • 28. Workshop – Lund 2015 28 Results question 4.) FeatureID 27 + 30 farthest away from forest edge ~ 942m and 522m
  • 29. Workshop – Lund 2015 29 (Optional) Neutral Landscape Models (NLMpy) ● LecoS has optional NLMpy support since version 1.9.3 ● Neutral Landscape Models as “Nullmodel” for continuous and classified landscapes ● Publication: ● onlinelibrary.wiley.com/doi/10 .1111/2041-210X.12308/full
  • 30. Workshop – Lund 2015 30 How to get the library? ● In order to install non-supported libraries you have to use PIP (python package index). ● NO Guarantee that this will work for your! ● https://pypi.python.org/pypi/nlmpy – Open the Python console in QGIS (or terminal on Linux) – Run pip install nlmpy – Or alternatively download and pip install nlmpy-0.1.1.tar.gz
  • 31. Workshop – Lund 2015 31 Time for Map Presentation?
  • 32. Workshop – Lund 2015 32 Running scripts in the Processing Toolbox ● The Processing toolbox (formerly called Sextante) in QGIS can be used to write models and script to do repeatable tasks ● Currently Python and R scripts are supported ● In order to create a R-script, make sure that it is enabled in the Processing options (menu)
  • 33. Workshop – Lund 2015 33 Other useful stuff - Processing R commands Command Function ##[datagis]=group Sets the group to “datagis” ##layer = vector or raster Specifies the input layer to use ##distance=number 100 Sets a number field with default 100 ##title=string France Get text input. Default is “France” ##field=field layer Select a field from the vector layer “layer” hist(layer[[field]]) R-command: Histogram for fields from layer ##showplots Has to be set in order to see plot outputs >t.test(layer[[field]]) Console output with a “>” before command ##output=output vector File output as vector or raster
  • 34. Workshop – Lund 2015 34 Example Script ##[Own Scripts]=group ##showplots ##layer=vector ##y=field layer ##x=field layer plot(as.numeric( layer[[y]] )~as.numeric( layer[[x]] ),pch=19,bty="l",ylab=paste( y ),xlab=paste( x ) ) fit = lm( layer[[y]]~layer[[x]] ) abline(fit,col="blue",lwd=2)
  • 35. Workshop – Lund 2015 35 Additional examples, help and tutorials ● http://www.gistutor.com/ ● http://qgis.spatialthoughts.com/ ● Youtube → search QGIS ● http://gis.stackexchange.com ● QGIS-user mailing list → http://lists.osgeo.org/listinfo/qgis-user
  • 36. Workshop – Lund 2015 36 Thanks for your attention! Open questions....!