SlideShare a Scribd company logo
Prepared by Volkan OBAN
Spatial data and Maps in R: Using R as
a GIS
Reference: https://pakillo.github.io/R-GIS-tutorial/
Basic packages
library(sp) # classes for spatial data
library(raster) # grids, rasters
library(rasterVis) # raster visualization
library(maptools)
library(rgeos)
library(dismo)
library(googleVis)
library(rworldmap)
library(RgoogleMaps)
library(dismo)
mycountry <- gmap("Turkey")
plot(mycountry)
>mycountry <- gmap("Turkey", type = "satellite")
> plot(mycountry)
>mycountry <- gmap("Turkey", type = "satellite",exp=3)
> plot(mycountry)
library(RgoogleMaps)
> newmap <- GetMap(center = c(41.112185,29.019965), zoom = 10, destfile = "new
map.png",
+ maptype = "satellite")
Izmir
library(RgoogleMaps)
newmap <- GetMap(center = c(38.423734,27.142826), zoom = 10, destfile = "newm
ap.png",
+ maptype = "satellite")
İstanbul Boğazı-Bosphorus:
newmap1 <- GetMap(center = c(41.046018,29.033891), zoom = 10, destfile = "n
ewmap1.png", maptype = "satellite")
> tmin <- getData("worldclim", var = "tmin", res = 10) # this will downloa
d
> # global data on minimum temperature at 10' resolution
> tmin1 <- raster(paste(getwd(), "/wc10/tmin1.bil", sep = "")) # Tmin for
January
> fromDisk(tmin1)
[1] TRUE
> tmin1 <- tmin1/10 # Worldclim temperature data come in decimal degrees
> tmin1
class : RasterLayer
dimensions : 900, 2160, 1944000 (nrow, ncol, ncell)
resolution : 0.1666667, 0.1666667 (x, y)
extent : -180, 180, -60, 90 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs
data source : in memory
names : tmin1
values : -54.7, 26.6 (min, max)
> plot(tmin1)
> library(gtools)
> file.remove(paste(getwd(), "/wc10/", "tmin_10m_bil.zip", sep = ""))
[1] FALSE
> list.ras <- mixedsort(list.files(paste(getwd(), "/wc10/", sep = ""), full
.names = T,
+ pattern = ".bil"))
> list.ras # I have just collected a list of the files containing monthly
temperature values
list.ras <- mixedsort(list.files(paste(getwd(), "/wc10/", sep = ""), full.names =
T, pattern = ".bil")) list.ras # I have just collected a list of the files
containing monthly temperature values
>tmin.all <- stack(list.ras)
> tmin.all
class : RasterStack
dimensions : 900, 2160, 1944000, 12 (nrow, ncol, ncell, nlayers)
resolution : 0.1666667, 0.1666667 (x, y)
extent : -180, 180, -60, 90 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs
names : tmin1, tmin2, tmin3, tmin4, tmin5, tmin6, tmin7, tmin8, tmin9
, tmin10, tmin11, tmin12
min values : -547, -525, -468, -379, -225, -170, -171, -178, -192
, -302, -449, -522
max values : 266, 273, 277, 283, 295, 312, 311, 312, 300
, 268, 267, 268
> tmin.all <- tmin.all/10
> plot(tmin.all)
> elevation <- getData("alt", country = "Turkey")
> x <- terrain(elevation, opt = c("slope", "aspect"), unit = "degrees")
> plot(x)
slope <- terrain(elevation, opt = "slope")
aspect <- terrain(elevation, opt = "aspect") hill <- hillShade(slope, aspect, 40, 270)
plot(hill, col = grey(0:100/100), legend = FALSE, main = "Türkiye")
plot(elevation, col = rainbow(25, alpha = 0.35), add = TRUE)
> library(ggmap)
> library(RgoogleMaps)
> mapImageData1 <- get_map(location = c(lon =29.019442, lat =41.103783),col
or = "color",source = "google",maptype = "satellite",zoom = 17)
>
> ggmap(mapImageData1,extent = "device", ylab = "Latitude",xlab = "Longitud
e")
İTÜ (Istanbul Technical University)
Ad

Recommended

Quick 入門 | iOS RDD テストフレームワーク for Swift/Objective-C
Quick 入門 | iOS RDD テストフレームワーク for Swift/Objective-C
Yuki Tanabe
 
Weather of the Century: Visualization
Weather of the Century: Visualization
MongoDB
 
Gc in golang
Gc in golang
Genchi Lu
 
確率的プログラミングライブラリEdward
確率的プログラミングライブラリEdward
Yuta Kashino
 
The Directions Pipeline at Mapbox - AWS Meetup Berlin June 2015
The Directions Pipeline at Mapbox - AWS Meetup Berlin June 2015
Johan
 
Cloud flare jgc bigo meetup rolling hashes
Cloud flare jgc bigo meetup rolling hashes
Cloudflare
 
The Weather of the Century
The Weather of the Century
MongoDB
 
Gc in golang
Gc in golang
Genchi Lu
 
The Weather of the Century Part 3: Visualization
The Weather of the Century Part 3: Visualization
MongoDB
 
Dtsn devnest9
Dtsn devnest9
Angus Fox
 
Semantic search within Earth Observation products databases based on automati...
Semantic search within Earth Observation products databases based on automati...
Gasperi Jerome
 
Webinar: Secrets of ClickHouse Query Performance, by Robert Hodges
Webinar: Secrets of ClickHouse Query Performance, by Robert Hodges
Altinity Ltd
 
Three Functional Programming Technologies for Big Data
Three Functional Programming Technologies for Big Data
Dynamical Software, Inc.
 
Advanced R Graphics
Advanced R Graphics
DataminingTools Inc
 
La R Users Group Survey Of R Graphics
La R Users Group Survey Of R Graphics
guest43ed8709
 
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
Altinity Ltd
 
Sorter
Sorter
Thomas Knudstrup
 
Coq for ML users
Coq for ML users
tmiya
 
The Weather of the Century Part 2: High Performance
The Weather of the Century Part 2: High Performance
MongoDB
 
Data warehouse or conventional database: Which is right for you?
Data warehouse or conventional database: Which is right for you?
Data Con LA
 
Bayesian learning
Bayesian learning
EngReads
 
Meet the Experts: Visualize Your Time-Stamped Data Using the React-Based Gira...
Meet the Experts: Visualize Your Time-Stamped Data Using the React-Based Gira...
InfluxData
 
Python Coding Examples for Drive Time Analysis
Python Coding Examples for Drive Time Analysis
Wisconsin Land Information Association
 
GeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS
GeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS
Roland Hansson
 
Ordered Record Collection
Ordered Record Collection
Hadoop User Group
 
Team ElectricGo: 2013 Apache Cassandra Hackathon at McGill University
Team ElectricGo: 2013 Apache Cassandra Hackathon at McGill University
DataStax Academy
 
OTTER 2017-12-03
OTTER 2017-12-03
Ruo Ando
 
Spatial Analysis with R - the Good, the Bad, and the Pretty
Spatial Analysis with R - the Good, the Bad, and the Pretty
Noam Ross
 
Geospatial Data in R
Geospatial Data in R
Barry Rowlingson
 
sexy maps comes to R - ggplot+ google maps= ggmap #rstats
sexy maps comes to R - ggplot+ google maps= ggmap #rstats
Ajay Ohri
 

More Related Content

What's hot (19)

The Weather of the Century Part 3: Visualization
The Weather of the Century Part 3: Visualization
MongoDB
 
Dtsn devnest9
Dtsn devnest9
Angus Fox
 
Semantic search within Earth Observation products databases based on automati...
Semantic search within Earth Observation products databases based on automati...
Gasperi Jerome
 
Webinar: Secrets of ClickHouse Query Performance, by Robert Hodges
Webinar: Secrets of ClickHouse Query Performance, by Robert Hodges
Altinity Ltd
 
Three Functional Programming Technologies for Big Data
Three Functional Programming Technologies for Big Data
Dynamical Software, Inc.
 
Advanced R Graphics
Advanced R Graphics
DataminingTools Inc
 
La R Users Group Survey Of R Graphics
La R Users Group Survey Of R Graphics
guest43ed8709
 
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
Altinity Ltd
 
Sorter
Sorter
Thomas Knudstrup
 
Coq for ML users
Coq for ML users
tmiya
 
The Weather of the Century Part 2: High Performance
The Weather of the Century Part 2: High Performance
MongoDB
 
Data warehouse or conventional database: Which is right for you?
Data warehouse or conventional database: Which is right for you?
Data Con LA
 
Bayesian learning
Bayesian learning
EngReads
 
Meet the Experts: Visualize Your Time-Stamped Data Using the React-Based Gira...
Meet the Experts: Visualize Your Time-Stamped Data Using the React-Based Gira...
InfluxData
 
Python Coding Examples for Drive Time Analysis
Python Coding Examples for Drive Time Analysis
Wisconsin Land Information Association
 
GeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS
GeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS
Roland Hansson
 
Ordered Record Collection
Ordered Record Collection
Hadoop User Group
 
Team ElectricGo: 2013 Apache Cassandra Hackathon at McGill University
Team ElectricGo: 2013 Apache Cassandra Hackathon at McGill University
DataStax Academy
 
OTTER 2017-12-03
OTTER 2017-12-03
Ruo Ando
 
The Weather of the Century Part 3: Visualization
The Weather of the Century Part 3: Visualization
MongoDB
 
Dtsn devnest9
Dtsn devnest9
Angus Fox
 
Semantic search within Earth Observation products databases based on automati...
Semantic search within Earth Observation products databases based on automati...
Gasperi Jerome
 
Webinar: Secrets of ClickHouse Query Performance, by Robert Hodges
Webinar: Secrets of ClickHouse Query Performance, by Robert Hodges
Altinity Ltd
 
Three Functional Programming Technologies for Big Data
Three Functional Programming Technologies for Big Data
Dynamical Software, Inc.
 
La R Users Group Survey Of R Graphics
La R Users Group Survey Of R Graphics
guest43ed8709
 
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
Webinar slides: MORE secrets of ClickHouse Query Performance. By Robert Hodge...
Altinity Ltd
 
Coq for ML users
Coq for ML users
tmiya
 
The Weather of the Century Part 2: High Performance
The Weather of the Century Part 2: High Performance
MongoDB
 
Data warehouse or conventional database: Which is right for you?
Data warehouse or conventional database: Which is right for you?
Data Con LA
 
Bayesian learning
Bayesian learning
EngReads
 
Meet the Experts: Visualize Your Time-Stamped Data Using the React-Based Gira...
Meet the Experts: Visualize Your Time-Stamped Data Using the React-Based Gira...
InfluxData
 
GeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS
GeoTuple a Framework for Web Based Geo-Analytics with R and PostGIS
Roland Hansson
 
Team ElectricGo: 2013 Apache Cassandra Hackathon at McGill University
Team ElectricGo: 2013 Apache Cassandra Hackathon at McGill University
DataStax Academy
 
OTTER 2017-12-03
OTTER 2017-12-03
Ruo Ando
 

Similar to R Data Visualization-Spatial data and Maps in R: Using R as a GIS (20)

Spatial Analysis with R - the Good, the Bad, and the Pretty
Spatial Analysis with R - the Good, the Bad, and the Pretty
Noam Ross
 
Geospatial Data in R
Geospatial Data in R
Barry Rowlingson
 
sexy maps comes to R - ggplot+ google maps= ggmap #rstats
sexy maps comes to R - ggplot+ google maps= ggmap #rstats
Ajay Ohri
 
Spatial visualization with ggplot2
Spatial visualization with ggplot2
Joaquim Silva
 
R spatial presentation
R spatial presentation
Todd Barr
 
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Guy Lansley
 
Climate data in r with the raster package
Climate data in r with the raster package
Alberto Labarga
 
Climate data in R with the raster package
Climate data in R with the raster package
CCAFS | CGIAR Research Program on Climate Change, Agriculture and Food Security
 
Raster package jacob
Raster package jacob
CCAFS | CGIAR Research Program on Climate Change, Agriculture and Food Security
 
Ggmap Packages in R
Ggmap Packages in R
Dr. Volkan OBAN
 
Geo Spatial Plot using R
Geo Spatial Plot using R
Rupak Roy
 
The Matsu Project - Open Source Software for Processing Satellite Imagery Data
The Matsu Project - Open Source Software for Processing Satellite Imagery Data
Robert Grossman
 
Catalog on the fly satellite images
Catalog on the fly satellite images
Luiz Motta
 
Download full ebook of Datacamp Ggplot2 Cheatsheet Itebooks instant download pdf
Download full ebook of Datacamp Ggplot2 Cheatsheet Itebooks instant download pdf
miatalafeer
 
R Spatial Analysis using SP
R Spatial Analysis using SP
tjagger
 
Manual of Remote Sensing
Manual of Remote Sensing
Shahjalal University of Science & Technology
 
Big datacourse
Big datacourse
Massimiliano Ruocco
 
Spatial_Data_Analysis_with_open_source_softwares[1]
Spatial_Data_Analysis_with_open_source_softwares[1]
Joachim Nkendeys
 
Eurostat cheatsheet
Eurostat cheatsheet
Dieudonne Nahigombeye
 
10. R getting spatial
10. R getting spatial
ExternalEvents
 
Spatial Analysis with R - the Good, the Bad, and the Pretty
Spatial Analysis with R - the Good, the Bad, and the Pretty
Noam Ross
 
sexy maps comes to R - ggplot+ google maps= ggmap #rstats
sexy maps comes to R - ggplot+ google maps= ggmap #rstats
Ajay Ohri
 
Spatial visualization with ggplot2
Spatial visualization with ggplot2
Joaquim Silva
 
R spatial presentation
R spatial presentation
Todd Barr
 
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Using R to Visualize Spatial Data: R as GIS - Guy Lansley
Guy Lansley
 
Climate data in r with the raster package
Climate data in r with the raster package
Alberto Labarga
 
Geo Spatial Plot using R
Geo Spatial Plot using R
Rupak Roy
 
The Matsu Project - Open Source Software for Processing Satellite Imagery Data
The Matsu Project - Open Source Software for Processing Satellite Imagery Data
Robert Grossman
 
Catalog on the fly satellite images
Catalog on the fly satellite images
Luiz Motta
 
Download full ebook of Datacamp Ggplot2 Cheatsheet Itebooks instant download pdf
Download full ebook of Datacamp Ggplot2 Cheatsheet Itebooks instant download pdf
miatalafeer
 
R Spatial Analysis using SP
R Spatial Analysis using SP
tjagger
 
Spatial_Data_Analysis_with_open_source_softwares[1]
Spatial_Data_Analysis_with_open_source_softwares[1]
Joachim Nkendeys
 
Ad

More from Dr. Volkan OBAN (20)

Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Dr. Volkan OBAN
 
Covid19py Python Package - Example
Covid19py Python Package - Example
Dr. Volkan OBAN
 
Object detection with Python
Object detection with Python
Dr. Volkan OBAN
 
Python - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) Parametreleri
Dr. Volkan OBAN
 
Linear Programming wi̇th R - Examples
Linear Programming wi̇th R - Examples
Dr. Volkan OBAN
 
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
Dr. Volkan OBAN
 
k-means Clustering in Python
k-means Clustering in Python
Dr. Volkan OBAN
 
Naive Bayes Example using R
Naive Bayes Example using R
Dr. Volkan OBAN
 
R forecasting Example
R forecasting Example
Dr. Volkan OBAN
 
k-means Clustering and Custergram with R
k-means Clustering and Custergram with R
Dr. Volkan OBAN
 
Data Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision Making
Dr. Volkan OBAN
 
Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.
Dr. Volkan OBAN
 
Scikit-learn Cheatsheet-Python
Scikit-learn Cheatsheet-Python
Dr. Volkan OBAN
 
Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet
Dr. Volkan OBAN
 
Pandas,scipy,numpy cheatsheet
Pandas,scipy,numpy cheatsheet
Dr. Volkan OBAN
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an example
Dr. Volkan OBAN
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an example
Dr. Volkan OBAN
 
R-ggplot2 package Examples
R-ggplot2 package Examples
Dr. Volkan OBAN
 
R Machine Learning packages( generally used)
R Machine Learning packages( generally used)
Dr. Volkan OBAN
 
treemap package in R and examples.
treemap package in R and examples.
Dr. Volkan OBAN
 
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Dr. Volkan OBAN
 
Covid19py Python Package - Example
Covid19py Python Package - Example
Dr. Volkan OBAN
 
Object detection with Python
Object detection with Python
Dr. Volkan OBAN
 
Python - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) Parametreleri
Dr. Volkan OBAN
 
Linear Programming wi̇th R - Examples
Linear Programming wi̇th R - Examples
Dr. Volkan OBAN
 
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
Dr. Volkan OBAN
 
k-means Clustering in Python
k-means Clustering in Python
Dr. Volkan OBAN
 
Naive Bayes Example using R
Naive Bayes Example using R
Dr. Volkan OBAN
 
k-means Clustering and Custergram with R
k-means Clustering and Custergram with R
Dr. Volkan OBAN
 
Data Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision Making
Dr. Volkan OBAN
 
Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.
Dr. Volkan OBAN
 
Scikit-learn Cheatsheet-Python
Scikit-learn Cheatsheet-Python
Dr. Volkan OBAN
 
Python Pandas for Data Science cheatsheet
Python Pandas for Data Science cheatsheet
Dr. Volkan OBAN
 
Pandas,scipy,numpy cheatsheet
Pandas,scipy,numpy cheatsheet
Dr. Volkan OBAN
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an example
Dr. Volkan OBAN
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an example
Dr. Volkan OBAN
 
R-ggplot2 package Examples
R-ggplot2 package Examples
Dr. Volkan OBAN
 
R Machine Learning packages( generally used)
R Machine Learning packages( generally used)
Dr. Volkan OBAN
 
treemap package in R and examples.
treemap package in R and examples.
Dr. Volkan OBAN
 
Ad

Recently uploaded (20)

Measurecamp Copenhagen - Consent Context
Measurecamp Copenhagen - Consent Context
Human37
 
NVIDIA Triton Inference Server, a game-changing platform for deploying AI mod...
NVIDIA Triton Inference Server, a game-changing platform for deploying AI mod...
Tamanna36
 
Starbucks in the Indian market through its joint venture.
Starbucks in the Indian market through its joint venture.
sales480687
 
Indigo dyeing Presentation (2).pptx as dye
Indigo dyeing Presentation (2).pptx as dye
shreeroop1335
 
RESEARCH-FINAL-GROUP-3, about the final .pptx
RESEARCH-FINAL-GROUP-3, about the final .pptx
gwapokoha1
 
一比一原版(TUC毕业证书)开姆尼茨工业大学毕业证如何办理
一比一原版(TUC毕业证书)开姆尼茨工业大学毕业证如何办理
taqyed
 
Camuflaje Tipos Características Militar 2025.ppt
Camuflaje Tipos Características Militar 2025.ppt
e58650738
 
PPT1_CB_VII_CS_Ch3_FunctionsandChartsinCalc.ppsx
PPT1_CB_VII_CS_Ch3_FunctionsandChartsinCalc.ppsx
animaroy81
 
lecture12.pdf Introduction to bioinformatics
lecture12.pdf Introduction to bioinformatics
SergeyTsygankov6
 
Artigo - Playing to Win.planejamento docx
Artigo - Playing to Win.planejamento docx
KellyXavier15
 
美国毕业证范本中华盛顿大学学位证书CWU学生卡购买
美国毕业证范本中华盛顿大学学位证书CWU学生卡购买
Taqyea
 
UPS and Big Data intro to Business Analytics.pptx
UPS and Big Data intro to Business Analytics.pptx
sanjum5582
 
ppt somu_Jarvis_AI_Assistant_presen.pptx
ppt somu_Jarvis_AI_Assistant_presen.pptx
MohammedumarFarhan
 
Indigo_Airlines_Strategy_Presentation.pptx
Indigo_Airlines_Strategy_Presentation.pptx
mukeshpurohit991
 
最新版美国约翰霍普金斯大学毕业证(JHU毕业证书)原版定制
最新版美国约翰霍普金斯大学毕业证(JHU毕业证书)原版定制
Taqyea
 
25 items quiz for practical research 1 in grade 11
25 items quiz for practical research 1 in grade 11
leamaydayaganon81
 
Attendance Presentation Project Excel.pptx
Attendance Presentation Project Excel.pptx
s2025266191
 
PPT2 W1L2.pptx.........................................
PPT2 W1L2.pptx.........................................
palicteronalyn26
 
ilide.info-tg-understanding-culture-society-and-politics-pr_127f984d2904c57ec...
ilide.info-tg-understanding-culture-society-and-politics-pr_127f984d2904c57ec...
jed P
 
Model Evaluation & Visualisation part of a series of intro modules for data ...
Model Evaluation & Visualisation part of a series of intro modules for data ...
brandonlee626749
 
Measurecamp Copenhagen - Consent Context
Measurecamp Copenhagen - Consent Context
Human37
 
NVIDIA Triton Inference Server, a game-changing platform for deploying AI mod...
NVIDIA Triton Inference Server, a game-changing platform for deploying AI mod...
Tamanna36
 
Starbucks in the Indian market through its joint venture.
Starbucks in the Indian market through its joint venture.
sales480687
 
Indigo dyeing Presentation (2).pptx as dye
Indigo dyeing Presentation (2).pptx as dye
shreeroop1335
 
RESEARCH-FINAL-GROUP-3, about the final .pptx
RESEARCH-FINAL-GROUP-3, about the final .pptx
gwapokoha1
 
一比一原版(TUC毕业证书)开姆尼茨工业大学毕业证如何办理
一比一原版(TUC毕业证书)开姆尼茨工业大学毕业证如何办理
taqyed
 
Camuflaje Tipos Características Militar 2025.ppt
Camuflaje Tipos Características Militar 2025.ppt
e58650738
 
PPT1_CB_VII_CS_Ch3_FunctionsandChartsinCalc.ppsx
PPT1_CB_VII_CS_Ch3_FunctionsandChartsinCalc.ppsx
animaroy81
 
lecture12.pdf Introduction to bioinformatics
lecture12.pdf Introduction to bioinformatics
SergeyTsygankov6
 
Artigo - Playing to Win.planejamento docx
Artigo - Playing to Win.planejamento docx
KellyXavier15
 
美国毕业证范本中华盛顿大学学位证书CWU学生卡购买
美国毕业证范本中华盛顿大学学位证书CWU学生卡购买
Taqyea
 
UPS and Big Data intro to Business Analytics.pptx
UPS and Big Data intro to Business Analytics.pptx
sanjum5582
 
ppt somu_Jarvis_AI_Assistant_presen.pptx
ppt somu_Jarvis_AI_Assistant_presen.pptx
MohammedumarFarhan
 
Indigo_Airlines_Strategy_Presentation.pptx
Indigo_Airlines_Strategy_Presentation.pptx
mukeshpurohit991
 
最新版美国约翰霍普金斯大学毕业证(JHU毕业证书)原版定制
最新版美国约翰霍普金斯大学毕业证(JHU毕业证书)原版定制
Taqyea
 
25 items quiz for practical research 1 in grade 11
25 items quiz for practical research 1 in grade 11
leamaydayaganon81
 
Attendance Presentation Project Excel.pptx
Attendance Presentation Project Excel.pptx
s2025266191
 
PPT2 W1L2.pptx.........................................
PPT2 W1L2.pptx.........................................
palicteronalyn26
 
ilide.info-tg-understanding-culture-society-and-politics-pr_127f984d2904c57ec...
ilide.info-tg-understanding-culture-society-and-politics-pr_127f984d2904c57ec...
jed P
 
Model Evaluation & Visualisation part of a series of intro modules for data ...
Model Evaluation & Visualisation part of a series of intro modules for data ...
brandonlee626749
 

R Data Visualization-Spatial data and Maps in R: Using R as a GIS

  • 1. Prepared by Volkan OBAN Spatial data and Maps in R: Using R as a GIS Reference: https://pakillo.github.io/R-GIS-tutorial/ Basic packages library(sp) # classes for spatial data library(raster) # grids, rasters library(rasterVis) # raster visualization library(maptools) library(rgeos) library(dismo) library(googleVis) library(rworldmap) library(RgoogleMaps)
  • 3. >mycountry <- gmap("Turkey", type = "satellite") > plot(mycountry)
  • 4. >mycountry <- gmap("Turkey", type = "satellite",exp=3) > plot(mycountry)
  • 5. library(RgoogleMaps) > newmap <- GetMap(center = c(41.112185,29.019965), zoom = 10, destfile = "new map.png", + maptype = "satellite")
  • 6. Izmir library(RgoogleMaps) newmap <- GetMap(center = c(38.423734,27.142826), zoom = 10, destfile = "newm ap.png", + maptype = "satellite")
  • 7. İstanbul Boğazı-Bosphorus: newmap1 <- GetMap(center = c(41.046018,29.033891), zoom = 10, destfile = "n ewmap1.png", maptype = "satellite")
  • 8. > tmin <- getData("worldclim", var = "tmin", res = 10) # this will downloa d > # global data on minimum temperature at 10' resolution > tmin1 <- raster(paste(getwd(), "/wc10/tmin1.bil", sep = "")) # Tmin for January > fromDisk(tmin1) [1] TRUE > tmin1 <- tmin1/10 # Worldclim temperature data come in decimal degrees > tmin1 class : RasterLayer dimensions : 900, 2160, 1944000 (nrow, ncol, ncell) resolution : 0.1666667, 0.1666667 (x, y) extent : -180, 180, -60, 90 (xmin, xmax, ymin, ymax) coord. ref. : +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs data source : in memory names : tmin1 values : -54.7, 26.6 (min, max) > plot(tmin1)
  • 9. > library(gtools) > file.remove(paste(getwd(), "/wc10/", "tmin_10m_bil.zip", sep = "")) [1] FALSE > list.ras <- mixedsort(list.files(paste(getwd(), "/wc10/", sep = ""), full .names = T, + pattern = ".bil")) > list.ras # I have just collected a list of the files containing monthly temperature values list.ras <- mixedsort(list.files(paste(getwd(), "/wc10/", sep = ""), full.names = T, pattern = ".bil")) list.ras # I have just collected a list of the files containing monthly temperature values >tmin.all <- stack(list.ras) > tmin.all class : RasterStack dimensions : 900, 2160, 1944000, 12 (nrow, ncol, ncell, nlayers) resolution : 0.1666667, 0.1666667 (x, y) extent : -180, 180, -60, 90 (xmin, xmax, ymin, ymax) coord. ref. : +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs names : tmin1, tmin2, tmin3, tmin4, tmin5, tmin6, tmin7, tmin8, tmin9 , tmin10, tmin11, tmin12
  • 10. min values : -547, -525, -468, -379, -225, -170, -171, -178, -192 , -302, -449, -522 max values : 266, 273, 277, 283, 295, 312, 311, 312, 300 , 268, 267, 268 > tmin.all <- tmin.all/10 > plot(tmin.all)
  • 11. > elevation <- getData("alt", country = "Turkey") > x <- terrain(elevation, opt = c("slope", "aspect"), unit = "degrees") > plot(x)
  • 12. slope <- terrain(elevation, opt = "slope") aspect <- terrain(elevation, opt = "aspect") hill <- hillShade(slope, aspect, 40, 270) plot(hill, col = grey(0:100/100), legend = FALSE, main = "Türkiye") plot(elevation, col = rainbow(25, alpha = 0.35), add = TRUE)
  • 13. > library(ggmap) > library(RgoogleMaps) > mapImageData1 <- get_map(location = c(lon =29.019442, lat =41.103783),col or = "color",source = "google",maptype = "satellite",zoom = 17) > > ggmap(mapImageData1,extent = "device", ylab = "Latitude",xlab = "Longitud e") İTÜ (Istanbul Technical University)