-
Notifications
You must be signed in to change notification settings - Fork 0
/
Class_Spatial.Rmd
59 lines (45 loc) · 1.17 KB
/
Class_Spatial.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
title: "ClassApril29"
author: "Gustavo Facincani Dourado"
date: "4/29/2020"
output: html_document
---
```{r}
library(rgdal)
library(maps)
library(maptools)
wrld <- map("world",interior=FALSE,xlim=c(-179,179),ylim=c(-89,89),plot=FALSE)
wrld_p <- pruneMap(wrld,xlim=c(-179,179))
llCRS <- CRS("+proj=longlat +ellps=WGS84")
wrld_sp <- map2SpatialLines(wrld_p,proj4string=llCRS)
prj_new <- CRS("+proj=moll")
wrld_proj <- spTransform(wrld_sp,prj_new)
summary(wrld_proj)
```
```{r}
c(-179,seq(-150,150,50),179.5)
seq(-75,75,15)
```
```{r}
wrld_grd <- gridlines(wrld_sp,easts=c(-179,seq(-150,150,50),179.5),
norths=seq(-75,75,15),ndiscr=100)
```
```{r}
wrld_grd_proj <- spTransform(wrld_grd,prj_new)
?gridat
at_sp <- gridat(wrld_sp,easts=0,norths=seq(-75,75,15),offset=0.3)
at_sp@data # These are the labels we are going to use.
```
```{r}
at_proj <- spTransform(at_sp,prj_new)
plot(wrld_proj,col="blue")
plot(wrld_grd_proj,add=TRUE,lty=3,col="black")
text(coordinates(at_proj),pos=at_proj$pos,offset=at_proj$offset,
labels=parse(text=as.character(at_proj$labels)),cex=0.6)
```
```{r}
```
```{r}
```
```{r}
```