---
title: "Siraj R Notebook, Spatial Data Analysis"
output: html_notebook
---

```{r}
rm(list = ls(all.names = TRUE)) #will clear all objects includes hidden objects.
```

```{r}
library(raster)
r <- raster(ncol=10, nrow=10)
ncell(r)
values(r) <- 1:ncell(r)
hasValues(r)
values(r)[1:10]
plot(r, main='Raster with 100 cells')
```

```{r}
library(maps)
map()
```

```{r}
map(regions="Canada")
```

```{r}
map(xlim=c(5,15),ylim=c(53,58),fill=TRUE,col="red")

```

```{r}
library(mapdata)
map("worldHires",xlim=c(5,15),ylim=c(53,58),fill=TRUE,col="red")
map.axes()
```

```{r}
library(mapproj)
map("worldHires",xlim=c(-141,-53), ylim=c(40,85),fill=TRUE,col="red", projection="conic",param=35)
```

```{r}
map("worldHires","Canada",xlim=c(-140,-110),ylim=c(48,64),col="gray90",fill=TRUE)
```

```{r}
map("worldHires","Canada",xlim=c(-140,-110),ylim=c(48,64),col="gray90",fill=TRUE)
map("worldHires","usa",xlim=c(-140,-110),ylim=c(48,64),col="gray95",fill=TRUE,add=TRUE)
```


```{r}
map(database="world",ylim=c(45,90),xlim=c(-160,-50), projection="gilbert", fill=T,col="grey80", orientation=c(90,0,225),resolution=0, lwd=0.5)
lon<-c(-72,-66,-107,-154) #fake longitude vector
lat<-c(81.7,64.6,68.3,60) #fake latitude vector
#converting your points to projected lat/lon
coord<-mapproject(lon,lat,proj="gilbert",orientation=c(90,0,225))
points(coord,pch=16,cex=1.2,col="red")

```


```{r}
fl1<-raster("surf_topo_test.nc")
plot(fl1)
```

