-
Notifications
You must be signed in to change notification settings - Fork 10
/
README.Rmd
125 lines (92 loc) · 4.79 KB
/
README.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
title: quickmapr
output: github_document
editor_options:
chunk_output_type: console
---
```{r setup, cache=FALSE, echo=FALSE}
library(knitr)
knit_hooks$set(optipng = hook_optipng, pngquant = hook_pngquant)
opts_chunk$set(fig.path = "man/figures/",
fig.width = 6, fig.height = 6, dpi = 72,
fig.retina = 1, optipng = '-o7', pngquant = '--speed=1')
```
[![R build
status](https://github.com/geogugal/quickmapr/workflows/R-CMD-check/badge.svg)](https://github.com/geogugal/quickmapr/actions)
[![Coverage Status](https://coveralls.io/repos/github/jhollist/quickmapr/badge.svg?branch=master)](https://coveralls.io/github/jhollist/quickmapr?branch=master)
[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.33135.svg)](https://doi.org/10.5281/zenodo.33135)
[![RStudio_CRAN_Downloads](http://cranlogs.r-pkg.org:443/badges/quickmapr)](https://cran.r-project.org/package=quickmapr)
There are many packages that already exist or are in active development that support the visualization of spatial data in R. However, there seems to be a gap for those that need to quickly view, compare, and explore the results of a given spatial analysis. The current thinking behind `quickmapr` is to allow for quick visualization of `sp` and `raster` objects.
Functionality for the current release is for easy mapping of multiple layers, simple zooming, panning, labelling, and identifying. These tools are intended for use within an active spatial analysis workflow and not for production quality maps.
`quickmapr` is built as a series of wrapper functions for the default `sp` and `raster` plotting functions. Currently there are 10 commands. As the idea behind this is to quickly map data, an emphasis was given to brevity of function names. The commands are:
- `qmap()`: creates the map and controls options
- `zi()`: zooms in
- `zo()`: zooms out
- `ze()`: zoom in to an extent
- `p()`: pans
- `l()`: adds labels
- `i()`: identify features
- `f()`: returns to extent of originally created map
- `s()`: selects and returns spatial objects
- `m()`: measures distances on plot
A function for pulling in basemaps (aerials or topo-quads) from the USGS National Map is included but should be considered experimental.
Example data are available via:
- `data(lake)`
##Installation
To install the development version:
```{r,eval=FALSE}
install.packages("devtools")
library("devtools")
install_github("jhollist/quickmapr")
library("quickmapr")
```
To install from CRAN (curretnly version 0.1.1):
```{r,eval=FALSE}
install.packages("quickmapr")
library("quickmapr")
```
##Using Quickmapr (work in progress)
Basic usage of `quickmapr` is built around a `qmap` object which is simply a list of `sp` or `raster` objects and a recorded plot. Most of the other `quickmpar` functions will work with a `qmap` object.
To create a qmap object:
```{r,echo=FALSE,message=FALSE}
library(quickmapr)
```
```{r}
#First some data
data(lake)
#Create your first quick map and object
qm <- qmap(elev,samples,buffer,width)
```
There are some other options on `qmap` that let you change the draw order, coloring of vectors, extent of the map, and whether or not to preform a basic projection check (data are assumed to be in the same coordinate reference system).
So for instance, if you want to zoom in to the extent of one of your layers you could do something like:
```{r}
#Zoom to the extent of the layer named width
qm<-qmap(elev,samples,buffer,extent=width)
```
Currently this is only working with object in memory and not pulling from the `qmap` object.
You can change colors (this is still a bit clunky).
```{r}
#draw samples and width in red and buffer with blue fill
qm<-qmap(elev,samples,buffer,order = c(2,1,3), colors = c("red","red","blue"), fill=TRUE)
```
Identifying is accomplished with i() and returns different items depending on the type of spatial data.
```{r eval=FALSE}
#identify
i(qm,"samples")
i(qm,"lake")
```
Zooming and panning are accomplished with zi(),ze(),zo(),f(), and p():
```{r, eval=FALSE}
#Zoom in on selected point
zi(qm)
#Zoom in on a chosen extent
ze(qm)
#Zoom out form selected point
zo(qm)
#Go out to full extent
f(qm)
#pan
p(qm)
```
#EPA Disclaimer
The United States Environmental Protection Agency (EPA) GitHub project code is provided on an "as is" basis and the user assumes responsibility for its use. EPA has relinquished control of the information and no longer has responsibility to protect the integrity , confidentiality, or availability of the information. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by EPA. The EPA seal and logo shall not be used in any manner to imply endorsement of any commercial product or activity by EPA or the United States Government.