Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Preparing and processing environmental data forSpecies Distribution Modeling
using FOSS software (R+SAGA)
T. Hengl
Instituut voor Biodiversiteit en Ecosysteem DynamicaUniversiteit van Amsterdam
July 12, 2010
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Programme
9:00–11:00 Importance of environmental maps for SDM;
11:00–12:15 Overview of publicly available global data sets;
13:15–14:00 Obtaining and preparing data using FOSS;
Installation and first (baby) steps (intro.R).Building, running and editing models in R.Working with spatial data.
14:00–16:30 Processing worldmaps;
Optional: preparation of ecological predictors andmetadata for your own case study;
16:30–17:00 Discussion and closing remarks
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Outline
1 IntroductionLiteratureSDM and env mapsEnvironmental data
2 SoftwareWhy R?R code editorsWorking with spatial dataR+SAGA
3 ExercisesR+FWToolsR + MaxEntExport to Google Earth
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Literature
Bivand, R., Pebesma, E., Rubio, V., 2008. Applied SpatialData Analysis with R. Use R Series, Springer, Heidelberg,378 p.
Hengl, T., 2009. A Practical Guide to GeostatisticalMapping, 2nd edition. University of Amsterdam, 291 p.ISBN 978-90-9024981-0.
Kabacoff, R.I., 2009. Data Analysis and Graphics with R.Manning publications, 375 p.
Phillips, S.J., Anderson, R.P., Schapire, R.E., 2006.Maximum entropy modeling of species geographicdistributions. Ecological Modelling, 190: 231–259.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
The ASDA(R)-book.org
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
The ASDA(R) team
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
A Practical Guide to Geostatistical Mapping
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Outline
1 IntroductionLiteratureSDM and env mapsEnvironmental data
2 SoftwareWhy R?R code editorsWorking with spatial dataR+SAGA
3 ExercisesR+FWToolsR + MaxEntExport to Google Earth
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Objectives
Where to obtain auxiliary environmental maps for SDM?
Where to obtain and how to use the R+OSGeo software?
How to combine GIS and SDM operations?
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Objectives
Where to obtain auxiliary environmental maps for SDM?
Where to obtain and how to use the R+OSGeo software?
How to combine GIS and SDM operations?
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Objectives
Where to obtain auxiliary environmental maps for SDM?
Where to obtain and how to use the R+OSGeo software?
How to combine GIS and SDM operations?
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Definitions
Species Distribution Model: Analytical model thatgenerates predictions of distribution of a species in an areaof interest, given field records of occurrences and list ofenvironmental maps.
The main input to SDM is a map; the main output ofSDM analysis is a map;
There are two main groups of maps we produce:1 Habitat-maps (potential distribution)2 Density-maps (actual distribution)
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Definitions
Species Distribution Model: Analytical model thatgenerates predictions of distribution of a species in an areaof interest, given field records of occurrences and list ofenvironmental maps.
The main input to SDM is a map; the main output ofSDM analysis is a map;
There are two main groups of maps we produce:1 Habitat-maps (potential distribution)2 Density-maps (actual distribution)
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Definitions
Species Distribution Model: Analytical model thatgenerates predictions of distribution of a species in an areaof interest, given field records of occurrences and list ofenvironmental maps.
The main input to SDM is a map; the main output ofSDM analysis is a map;
There are two main groups of maps we produce:1 Habitat-maps (potential distribution)2 Density-maps (actual distribution)
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Definitions
Species Distribution Model: Analytical model thatgenerates predictions of distribution of a species in an areaof interest, given field records of occurrences and list ofenvironmental maps.
The main input to SDM is a map; the main output ofSDM analysis is a map;
There are two main groups of maps we produce:1 Habitat-maps (potential distribution)2 Density-maps (actual distribution)
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Definitions
Species Distribution Model: Analytical model thatgenerates predictions of distribution of a species in an areaof interest, given field records of occurrences and list ofenvironmental maps.
The main input to SDM is a map; the main output ofSDM analysis is a map;
There are two main groups of maps we produce:1 Habitat-maps (potential distribution)2 Density-maps (actual distribution)
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Space / domains
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Bittervoorn
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Outline
1 IntroductionLiteratureSDM and env mapsEnvironmental data
2 SoftwareWhy R?R code editorsWorking with spatial dataR+SAGA
3 ExercisesR+FWToolsR + MaxEntExport to Google Earth
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Environmental data
Environmental maps (environmental predictors) are equallyimportant input to species distribution modeling as theoccurrence records.
If we are lucky, we will be able to explain distribution of aspecies by using a small sample of speciesoccurrence/attributes.
Environmental data can be of different type (remotesensing images, topographic, land cover data, proximityand sources of food and water, proximity to humanpopulation etc.).
The publicly available global data sets are in generalunder-used.
. . . for various reasons (unpopular formats, missingmetadata, significant processing required to put it to ausable format etc.).
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Environmental data
Environmental maps (environmental predictors) are equallyimportant input to species distribution modeling as theoccurrence records.
If we are lucky, we will be able to explain distribution of aspecies by using a small sample of speciesoccurrence/attributes.
Environmental data can be of different type (remotesensing images, topographic, land cover data, proximityand sources of food and water, proximity to humanpopulation etc.).
The publicly available global data sets are in generalunder-used.
. . . for various reasons (unpopular formats, missingmetadata, significant processing required to put it to ausable format etc.).
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Environmental data
Environmental maps (environmental predictors) are equallyimportant input to species distribution modeling as theoccurrence records.
If we are lucky, we will be able to explain distribution of aspecies by using a small sample of speciesoccurrence/attributes.
Environmental data can be of different type (remotesensing images, topographic, land cover data, proximityand sources of food and water, proximity to humanpopulation etc.).
The publicly available global data sets are in generalunder-used.
. . . for various reasons (unpopular formats, missingmetadata, significant processing required to put it to ausable format etc.).
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Environmental data
Environmental maps (environmental predictors) are equallyimportant input to species distribution modeling as theoccurrence records.
If we are lucky, we will be able to explain distribution of aspecies by using a small sample of speciesoccurrence/attributes.
Environmental data can be of different type (remotesensing images, topographic, land cover data, proximityand sources of food and water, proximity to humanpopulation etc.).
The publicly available global data sets are in generalunder-used.
. . . for various reasons (unpopular formats, missingmetadata, significant processing required to put it to ausable format etc.).
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Environmental data
Environmental maps (environmental predictors) are equallyimportant input to species distribution modeling as theoccurrence records.
If we are lucky, we will be able to explain distribution of aspecies by using a small sample of speciesoccurrence/attributes.
Environmental data can be of different type (remotesensing images, topographic, land cover data, proximityand sources of food and water, proximity to humanpopulation etc.).
The publicly available global data sets are in generalunder-used.
. . . for various reasons (unpopular formats, missingmetadata, significant processing required to put it to ausable format etc.).
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Global repository of publicly available maps
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
worldmaps
I’ve been collecting and sorting/processing various publiclyavailable data sets over the years (at 1–5 km resolution,there is a lot of free data).
The result is a repository with cca 100 unique rasters, thatcan be obtained directly fromhttp://spatial-analyst.net/worldmaps/.
Each gridded map consists of 7200 columns and 3600rows; the cell size is 0.05 arcdegrees, which corresponds toabout 5.6 km; all maps fall on the same grid.
Maps are projected in the Latitude-Longitude WGS84system +proj=longlat +ellps=WGS84.
These maps are ideal for SDM applications at continentaland national levels.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
The happy triangle guy
GIS analysis
Storage andbrowsing of
geo-data
Statisticalcomputing
KML
GDAL
groundoverlays,
time-series
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Setting up R+SAGA
R basics
R basic and add-on packages;
R syntax; R objects and ’methods’;
R FAQs; getting help and the most important literature;
Scripting in R
data management; creating and debugging scripts(scripting editors: Tinn-R);
automating analysis — making functions and packages;
publication quality outputs (using R+Sweave);
Advanced topics
GDAL and R; spatial classes and packages;
export of maps to Google Earth;
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Outline
1 IntroductionLiteratureSDM and env mapsEnvironmental data
2 SoftwareWhy R?R code editorsWorking with spatial dataR+SAGA
3 ExercisesR+FWToolsR + MaxEntExport to Google Earth
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Getting the right motivation
What is R, and why should you invest time to learn it?
What can it do? (and what it can’t do?)
How does the R community works (what are its sharedprinciples)?
Is R suited for spatio-temporal data analysis?
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Quote
“R has really become the second language for peoplecoming out of grad school now, and there’s anamazing amount of code being written for it.”
Max Kuhn
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Packages of interest to SDM:
Pure habitat analysis packages: adehabitat package forhabitat analysis for animals; BiodiversityR for communityecology analysis; spatstat for analysis of point patterns;and gstat for geostatistical analysis;
Integration packages: RODBC package; XML package;
Geographical analysis: Open Source Desktop andServer-based GIS: SAGA GIS, GRASS GIS and ILWIS GIS;
openModeller — an open source plugin that contains anextensive Niche modeling library (Munoz et al. 2007);
MaxEnt — the Maximum Entropy niche analysis algorithm(Phillips et al. 2008);
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Type of SDM output maps
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
R code
> library(spatstat); library(geoR)
# unconditional gaussian simulations (psill=1, mean=0):
> s <- grf(100, grid="reg", cov.pars=c(1, 0.2),
+ cov.model="mat", kappa=1.5)
# define your own model, e.g. poisson:
> lambda <- 0.2*exp(0.5 +s$data)
> y <- rpois(length(s$data), lambda=lambda)
> image(s, col=gray(seq(1, 0.5, l=21)))
> text(s$coords, label=y, pos=3, offset=-0.2, cex=1.5)
# simulate a point pattern:
> sm <- list(x=seq(0, 1, l=10), y=seq(0, 1, l=10),
+ z=matrix(y, nrow=10))
> y.p <- rpoint(n=sum(y), f=as.im(sm))
> image(s, col=gray(seq(1, 0.5, l=21)))
> points(y.p, pch="+", cex=1.5)
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Why make scripts?
It’s easy to use: “Because S (and its implementation R) isa well-developed, simple and effective programminglanguage which includes conditionals, loops, user-definedrecursive functions and input and output facilities, existingfunctions can be modified.” In R we all becomeprogrammers (but much faster than with C++ or Java).
The basic approach to using R is to generate scripts thatdefine the data processing steps (workflows?).
Documenting the analysis process is a “good thing”, soprogramming scripts are not just a burden, certainly forusers doing original research and repetitive work, arguablyfor student classes too.
Point-and-click operations are for amateurs.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Why make scripts?
It’s easy to use: “Because S (and its implementation R) isa well-developed, simple and effective programminglanguage which includes conditionals, loops, user-definedrecursive functions and input and output facilities, existingfunctions can be modified.” In R we all becomeprogrammers (but much faster than with C++ or Java).
The basic approach to using R is to generate scripts thatdefine the data processing steps (workflows?).
Documenting the analysis process is a “good thing”, soprogramming scripts are not just a burden, certainly forusers doing original research and repetitive work, arguablyfor student classes too.
Point-and-click operations are for amateurs.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Why make scripts?
It’s easy to use: “Because S (and its implementation R) isa well-developed, simple and effective programminglanguage which includes conditionals, loops, user-definedrecursive functions and input and output facilities, existingfunctions can be modified.” In R we all becomeprogrammers (but much faster than with C++ or Java).
The basic approach to using R is to generate scripts thatdefine the data processing steps (workflows?).
Documenting the analysis process is a “good thing”, soprogramming scripts are not just a burden, certainly forusers doing original research and repetitive work, arguablyfor student classes too.
Point-and-click operations are for amateurs.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Why make scripts?
It’s easy to use: “Because S (and its implementation R) isa well-developed, simple and effective programminglanguage which includes conditionals, loops, user-definedrecursive functions and input and output facilities, existingfunctions can be modified.” In R we all becomeprogrammers (but much faster than with C++ or Java).
The basic approach to using R is to generate scripts thatdefine the data processing steps (workflows?).
Documenting the analysis process is a “good thing”, soprogramming scripts are not just a burden, certainly forusers doing original research and repetitive work, arguablyfor student classes too.
Point-and-click operations are for amateurs.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Software we will use
Not all software is required to follow the exercises
R v2.11 (Windows OS) including a list of packages;
Tinn-R v2.3 (code editor);
Optional: FWTools v2.4 — a list of utilities to handlespatial data; SAGA GIS v2.0.4 — a light GIS excellent foreducational purposes.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Installing the add-on packages
> install.packages("ctv")
> library(ctv)
> install.views("Spatial")
This will install all connected packages listed at R views Spatial.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Check your installation
> Sys.getenv(c("OS", "COMPUTERNAME", "R_HOME", "R_LIBS_USER",
+ "PROCESSOR_IDENTIFIER"))
OS
"Windows_NT"
COMPUTERNAME
"PC-IBED193"
R_HOME
"C:\\PROGRA~1\\R\\R-210~1.1"
R_LIBS_USER
"n:/R/win-library/2.10"
PROCESSOR_IDENTIFIER
"x86 Family 6 Model 15 Stepping 6, GenuineIntel"
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Outline
1 IntroductionLiteratureSDM and env mapsEnvironmental data
2 SoftwareWhy R?R code editorsWorking with spatial dataR+SAGA
3 ExercisesR+FWToolsR + MaxEntExport to Google Earth
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Tinn-R
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
JaGuaR
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Customizing link between R and Tinn-R:
1 Open Tinn-R select “Options” 7→“R” 7→ Path and checkthat the path is correct;
2 Tinn-R requires R to run either Rterm or Rgui in SDImode: In Rgui, select “Edit” 7→“GUI preferences” and setSDI and click on Save.
3 To add the CRTL+R shortcut to Tinn-R:
First open “Options” 7→“Shortcuts” and replace the existingCRTL+R shortcut to e.g. CRTL+M;Then, open “R” menu and select “Hotkeys”; add a CRTL+R
shortcut to “Send line”;To send blocks of text you will need to edit yourRprofile.site file under “R/etc/” directory;
4 To learn more about how to customize Tinn-R, read theuser_guide.html file under the“Tinn-R/doc/English/user guide/” directory.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Outline
1 IntroductionLiteratureSDM and env mapsEnvironmental data
2 SoftwareWhy R?R code editorsWorking with spatial dataR+SAGA
3 ExercisesR+FWToolsR + MaxEntExport to Google Earth
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Spatial objects
An advantage of R (as compared to e.g. Matlab) is that youcan create your own formats and structures for data. But ifthere are too many formats you can easily get lots. In addition,we want to have smooth links to external formats (R is open!).
To reduce this problem, Bivand et al. (2008) developednew-style classes to represent spatial data.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Spatial class
The foundation object is the Spatial class, with just two basicslots (new-style S classes have pre-defined components calledslots):
a bounding box — mostly used for setting up plots;
a CRS class object — defining the coordinate referencesystem, and may be set to CRS(as.character(NA));
Operations on Spatial* objects should update or copy thesevalues to the new Spatial* objects being created. The mostbasic spatial data object is a point, which may have 2 or 3dimensions.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Spatial classes
for point features: SpatialPoints;SpatialPointsDataFrame;
for line features: SpatialLines,SpatialLinesDataFrame;
polygons: SpatialPolygons,SpatialPolygonsDataFrame;
rasters: SpatialPixels, SpatialPixelsDataFrame,SpatialGrid, SpatialGridDataFrame;
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
SpatialPoints
> library(sp)
> data(meuse)
> coords <- SpatialPoints(meuse[, c("x", "y")])
> summary(coords)
Object of class SpatialPoints
Coordinates:
min max
x 178605 181390
y 329714 333611
Is projected: NA
proj4string : [NA]
Number of points: 155
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
SpatialPointsDataFrame
We can add the tabular data to make aSpatialPointsDataFrame object:
> meuse1 <- SpatialPointsDataFrame(coords, meuse)
> str(meuse1, max.level = 2)
Formal class 'SpatialPointsDataFrame' [package "sp"] with 5 slots
..@ data :'data.frame': 155 obs. of 14 variables:
..@ coords.nrs : num(0)
..@ coords : num [1:155, 1:2] 181072 181025 181165 ...
.. ..- attr(*, "dimnames")=List of 2
..@ bbox : num [1:2, 1:2] 178605 329714 181390 333611
.. ..- attr(*, "dimnames")=List of 2
..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Basic methods
spplot — plotting of spatial objects (maps);
spsample — sample points from a set of polygons, on aset of lines or from a gridded area;
bbox — get the bounding box;
proj4string — get or set the projection (coordinatereference system);
coordinates — set or retrieve coordinates;
spTransform — transform coordinates from one CRS toanother;
overlay — combine two different spatial objects;
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Plotting a SpatialPoints object
> plot(as(meuse1, "Spatial"), axes = TRUE)
> plot(meuse1, add = TRUE)
> plot(meuse1[meuse1$ffreq == 1, ], col = "green", add = TRUE)
178000 179000 180000 181000 182000
3300
0033
1000
3320
0033
3000
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Combining statistical and GIS operations
Because the Spatial*DataFrame family objects behave inmost cases like data frames, most of what we are used todoing with standard data frames just works (but no merge,etc., yet).
These objects are very similar to typical representations ofthe same kinds of objects in geographical informationsystems, so they do not suit spatial data that is notgeographical (like medical imaging) as such.
Because now sp classes for GIS data exits, this opens thedoor for fusing GIS and statistical operations (this has notbeen possible in e.g. 2002).
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Spatial packages
R now offers a range of contributed packages in spatialstatistics and increasing awareness of the importance of spatialdata analysis in the broader community. Current contributedpackages with spatial applications:
point patterns: spatstat, VR:spatial, splancs;
geostatistics: gstat, geoR, geoRglm, fields, spBayes,RandomFields, VR:spatial, sgeostat, vardiag;
lattice/area data: spdep, DCluster, spgwr, ade4;
links to GIS: rgdal, spgrass, RPy, RSAGA;
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Let’s create spatial objects!
We can create spatial objects from scratch! For example aDEM:
> dem <- expand.grid(x = seq(100, 600, 100), y = seq(100,
+ 600, 100))
> dem$Z <- as.vector(c(23, 24, 34, 38, 45, 51, 24, 20,
+ 20, 28, 18, 49, 22, 20, 19, 14, 38, 45, 19, 15, 13,
+ 21, 23, 25, 14, 11, 18, 11, 18, 19, 10, 16, 23, 16,
+ 9, 6))
> gridded(dem) <- ~x + y
> dem <- as(dem, "SpatialGridDataFrame")
> str(dem)
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Outline
1 IntroductionLiteratureSDM and env mapsEnvironmental data
2 SoftwareWhy R?R code editorsWorking with spatial dataR+SAGA
3 ExercisesR+FWToolsR + MaxEntExport to Google Earth
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Controlling SAGA from R
> library(RSAGA)
> rsaga.env()
$workspace
[1] "."
$cmd
[1] "saga_cmd.exe"
$path
[1] "C:/PROGRA~1/R/R-210~1.1/library/RSAGA/saga_vc"
$modules
[1] "C:/PROGRA~1/R/R-210~1.1/library/RSAGA/saga_vc/modules"
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Getting list of modules
> rsaga.get.modules("ta_channels")
$ta_channels
code name interactive
1 0 Channel Network FALSE
2 1 Watershed Basins FALSE
3 2 Watershed Basins (extended) FALSE
4 3 Vertical Distance to Channel Network FALSE
5 4 Overland Flow Distance to Channel Network FALSE
6 5 D8 Flow Analysis FALSE
7 6 Strahler Order FALSE
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Run stream extraction
> rsaga.geoprocessor(lib = "ta_channels", module = 5,
+ param = list(DEM = "dem6.sgrd",
+ DIRECTION = "channels.sgrd", CONNECTION = "route.sgrd",
+ NETWORK = "channels.shp"))
SAGA CMD 2.0.4
library path: C:/PROGRA~1/R/R-210~1.1/library/RSAGA/...
library name: ta_channels
module name : D8 Flow Analysis
author : (c) 2003 by O.Conrad
Load grid: dem6.sgrd...
ready
Parameters
Grid system: 100; 6x 6y; 100x 100y
DEM: dem6
Flow Direction: Flow Direction
Flow Connectivity: Flow Connectivity
Flow Network: Flow Network
Minimum Connectivity: 0
...
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Read back to R
> dem$route <- readGDAL("route.sdat")$band1
route.sdat has GDAL driver SAGA
and has 6 rows and 6 columns
> channels <- readOGR("channels.shp", "channels")
OGR data source with driver: ESRI Shapefile
Source: "channels.shp", layer: "channels"
with 32 features and 2 fields
Feature type: wkbLineString with 2 dimensions
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Plot the final result
> dem.plt <- spplot(dem[1], main = "DEM", col.regions = topo.colors(25))
> channels.plt <- spplot(dem[2], col.regions = rev(gray(0:20/20)),
+ main = "Flow connectivity", sp.layout = list("sp.lines",
+ channels, col = "red"))
> print(dem.plt, split = c(1, 1, 2, 1), more = T)
> print(channels.plt, split = c(2, 1, 2, 1), more = F)
DEM
10
20
30
40
50
Flow connectivity
0.0
0.5
1.0
1.5
2.0
2.5
3.0
3.5
4.0
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Outline
1 IntroductionLiteratureSDM and env mapsEnvironmental data
2 SoftwareWhy R?R code editorsWorking with spatial dataR+SAGA
3 ExercisesR+FWToolsR + MaxEntExport to Google Earth
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Exercise 1
Create a working directory called NL, then download themakeRDC.R script.
Open new session in R and run the script from Tinn-R.
This will download a land cover map of NL and resample itto the Dutch coordinate system.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Exercise 1
Create a working directory called NL, then download themakeRDC.R script.
Open new session in R and run the script from Tinn-R.
This will download a land cover map of NL and resample itto the Dutch coordinate system.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Exercise 1
Create a working directory called NL, then download themakeRDC.R script.
Open new session in R and run the script from Tinn-R.
This will download a land cover map of NL and resample itto the Dutch coordinate system.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Preparing FWTools
There is still no package to control FWTools from R, but wecan simply send command lines using the system command.Before we can use FWTools from R, we need to locate it on ourPC:
> gdalwarp <- gsub("/", "\\\\", dir(path="C:/PROGRA~2/FWTOOL~1.7",
+ pattern="gdalwarp.exe", recursive=TRUE, full.names=TRUE))
> gdalwarp
[1] "C:\\PROGRA~2\\FWTOOL~1.7\\bin\\gdalwarp.exe"
> workd <- paste(gsub("/", "\\\\", getwd()), "\\", sep="")
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
MODIS data
Now we can download some GIS data from web:
> MOD12Q1 <- "ftp://anonymous:[email protected]/
+ MOLT/MOD12Q1.004/2004.01.01/"
> download.file(paste(MOD12Q1,
+ "MOD12Q1.A2004001.h18v03.004.2006117173748.hdf", sep=""),
+ destfile=paste(getwd(),
+ "MOD12Q1.A2004001.h18v03.004.2006117173748.hdf", sep="/"),
+ mode='wb', method='wget')
Resolving e4ftl01u.ecs.nasa.gov... 152.61.4.83
Connecting to e4ftl01u.ecs.nasa.gov|152.61.4.83|:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD /MOLT/MOD12Q1.004/2004.01.01 ... done.
==> SIZE MOD12Q1.A2004001.h18v03.004.2006117173748.hdf ... 23165983
==> PASV ... done. ==> RETR MOD12Q1.A2004... done.
Length: 23165983 (22M)
0K .......... .......... 0% 64.9K 5m48s
...
22550K .......... .......... 99% 501K 0s
22600K .......... 100% 503K=65s
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Reprojecting grids
We can reproject/resample the map to our local coordinatesystem using the gdalwarp functionality (this combines severalprocessing steps in one function):
> NL.prj <- "+proj=sterea +lat_0=52.15616055555555
+ +lon_0=5.38763888888889 +k=0.999908 +x_0=155000
+ +y_0=463000 +ellps=bessel +units=m +no_defs
+ +towgs84=565.237,50.0087,465.658,
+ -0.406857,0.350733,-1.87035,4.0812"
> system(paste(gdalwarp, " HDF4_EOS:EOS_GRID:\"", workd,
+ "\\MOD12Q1.A2004001.h18v03.004.2006117173748.hdf\"
+ :MOD12Q1:Land_Cover_Type_1 -t_srs \"", NL.prj, "\"
+ IGBP2004NL.tif -r near -te 0 300000 280000 625000
+ -tr 500 500", sep=""))
Creating output file that is 560P x 650L.
Processing input file HDF4_EOS:EOS_GRID:\\MOD12Q1.A2004001...
Using internal nodata values (eg. 255) for image HDF4_EOS:EOS_...
0...10...20...30...40...50...60...70...80...90...100 - done.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Plot the final result
In this case we have produced a MODIS-based land cover mapfor the whole Netherlands in resolution of 500 m (in localcoordinate system).
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Exercise 2 & 3
Create a working directory called worldmaps, thendownload a selection of worldmaps from the repository (orget a copy from the USB stick) and unzip the maps thatyou need to complete the exercises.
Use any GIS that you find suitable to answer the questions.
I recommend first testing SAGA GIS, then running theanalysis in R. These maps are Large so it could take timeuntil you import/open a map.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Exercise 2 & 3
Create a working directory called worldmaps, thendownload a selection of worldmaps from the repository (orget a copy from the USB stick) and unzip the maps thatyou need to complete the exercises.
Use any GIS that you find suitable to answer the questions.
I recommend first testing SAGA GIS, then running theanalysis in R. These maps are Large so it could take timeuntil you import/open a map.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Exercise 2 & 3
Create a working directory called worldmaps, thendownload a selection of worldmaps from the repository (orget a copy from the USB stick) and unzip the maps thatyou need to complete the exercises.
Use any GIS that you find suitable to answer the questions.
I recommend first testing SAGA GIS, then running theanalysis in R. These maps are Large so it could take timeuntil you import/open a map.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Exercise 4
We focus on extracting land surface parameters (orgeomorphometric parameters) using a DEM.
First create a new working directory on your computer,then Download the map of world countries (countries)and the global Digital Elevation Model at 5.6 kmresolution (globedem).
Resample and subset the DEMs to local coordinatesystems — for Germany use the European ETRS89coordinate system (EPSG:3035), and for Bolivia use theSouth America Albers Equal Area Conic coordinate system(ESRI:102033).
Try also to derive these parameters using the RSAGApackage, i.e. by sending the commands to SAGA from R.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Outline
1 IntroductionLiteratureSDM and env mapsEnvironmental data
2 SoftwareWhy R?R code editorsWorking with spatial dataR+SAGA
3 ExercisesR+FWToolsR + MaxEntExport to Google Earth
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Controlling MaxEnt from R
MaxEnt is by many considered to be the most robustapproach to species distribution modeling.
It can work with both continuous and categorical predictorsand has very extensive and flexible possibilities for analysisof biodiversity data.
MaxEnt is not available as an R package, therefore you willfirst need to request and download it from the MaxEnthomepage.
The complete algorithm is contained in a singlemaxent.jar (Java ARchive) file, which is basically azipped Java (class file) code.
More flexible way to writing KML files is by using loops.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Prepare grids
# Location of MaxEnt and directories:
> Sys.chmod(getwd(), mode="7777") # write permissions
> MaxEnt <- "C:\\MaxEnt\\maxent.jar"
> dir.create(path="MEout"); dir.create(path="MEsamples")
> MaxEnt.layers <- paste(gsub("/", "\\\\", getwd()), "\\grids", sep="")
> MaxEnt.out <- paste(gsub("/", "\\\\", getwd()), "\\MEout", sep="")
> MaxEnt.samples <- paste(gsub("/", "\\\\", getwd()),
+ "\\MEsamples", sep="")
where MEout is the directory where MaxEnt will write theresults of analysis (plots, grids and table data), and MEsamples
is a directory containing the input samples.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Prepare grids
Next, copy the grids of interest to some working directory e.g./grids:
> dir.create(path="grids")
> for(j in c("dem.asc", "grad.asc", "twi.asc", "achan.asc")) {
> file.copy(j, paste("grids/", j, sep=""), overwrite=TRUE)
> }
> asc.list <- list.files(paste(getwd(), "/grids", sep=""),
+ pattern="\\.asc$", recursive=TRUE, full=FALSE)
> asc.list
[1] "achan.asc" "dem.asc" "twi.asc"
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Preparing the occurrence only records
Before we can run MaxEnt, we still need to prepare theoccurrence records in the required format (.csv):
# Write records to a csv file (species, longitude, latitude):
> bei.csv <- data.frame(sp=rep("bei", bei$n), gx=bei$x, gy=bei$y)
> write.csv(bei.csv[,c("sp","gx","gy")], "MEsamples/bei.csv",
+ quote=FALSE, row.names=FALSE)
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Sending batch process to MaxEnt
We can now run MaxEnt using the system command in R:
# Run a batch process (opens a process window):
> system(command=paste("java -mx1000m -jar ", MaxEnt,
+ " environmentallayers=", MaxEnt.layers, " samplesfile=",
+ MaxEnt.samples, "\\bei.csv", " outputdirectory=",
+ MaxEnt.out, " randomtestpoints=25 maximumiterations=100
+ redoifexists autorun nowarnings notooltips", sep=""))
where randomtestpoints=25 will randomly take 25% pointsfor cross-validation, redoifexists will replace the existingfiles, autorun, nowarnings and notooltips will force MaxEntto run without waiting. For more information about MaxEntbatch mode flags, look in the MaxEnt Help documentation.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Reading the results
After the analysis, open the /MEout directory and browse thegenerated files. We are most interested in two files: bei.asc
— the Habitat Suitability Index map (0–1), and bei.html —the complete report from the analysis.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
MaxEnt window
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Exercise (for ambitious)
We focus on mapping the potential habitat for Sturnellamagna (Eastern Meadowlark) in USA based on theoccurrence records obtained from AKN.
First create a new working directory on your computer,then download the worldmap.R script and open it inTinn-R.
Note that the worldmaps need to be already available inthe working directory, and a link to MaxEnt needs to beestablished via the directory address e.g.C:\\MaxEnt\\maxent.jar. Otherwise the script will notrun.
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Modeling distribution of Bigfoot (?!)
Lozier et al. (2009)
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Outline
1 IntroductionLiteratureSDM and env mapsEnvironmental data
2 SoftwareWhy R?R code editorsWorking with spatial dataR+SAGA
3 ExercisesR+FWToolsR + MaxEntExport to Google Earth
Environmentaldata for SDM
T. Hengl
Introduction
Literature
SDM and env maps
Environmental data
Software
Why R?
R code editors
Working withspatial data
R+SAGA
Exercises
R+FWTools
R + MaxEnt
Export to GoogleEarth
Writing spatial data to KML
There are two possibilities to export maps to KML: (a)using existing packages, and (b) by writing KML files“by-hand”.
To export point or line features to KML, use the writeOGR
method that is available in R package rgdal.
More flexible way to writing KML files is by using loops.