-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathtools.ctv
235 lines (219 loc) · 12.3 KB
/
tools.ctv
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<CRANTaskView>
<name>MappingTools</name>
<topic>Mapping tools and services</topic>
<maintainer email="hollister.jeff@epa.gov">Jeff Hollister, Scott Chamberlain,
Karthik Ram, Hadley Wickham, Ben Marwick, Cory Nissen</maintainer>
<version>2015-07-04</version>
<info> This task view contains information about mapping and visualizing spatial
data in R. The base version of R does not ship with many tools for mapping
spatial data. Thankfully, there are an increasingly large number of tools for doing so, both
with just R or javascript libraries. A list of available
packages and functions is presented below, grouped by the type of activity.
If you have any comments or suggestions for additions or improvements for this
taskview, go to Github and <a href="https://github.com/ropensci/maptools/issues">
submit an issue</a>, or <a href="https://github.com/ropensci/maptools/CONTRIBUTING.md">
make some changes</a> and <a href="https://github.com/ropensci/maptools/pulls">
submit a pull request</a>. If you can't contribute on Github,
<a href="mailto:hollister.jeff@epa.gov">send Jeff an email</a>. If you have an
issue with one of the packages discussed below, please contact the maintainer of
that package.
This task view is focused on mapping spatial data and less so on the foundations of working with spatial data in R. That material is covered in detail in the <view>Spatial Task View</view>. There is some overlap between the two task views, but an effort has been made to reduce redundancy so that these task views compliment one another.
<h2>
Mapping tools in R
</h2>
<p><strong>Visualization</strong></p>
<ul>
<li>
<a href="https://github.com/Vizzuality/cartodb-r">cartodb</a>: CartoDB R client.
Not on CRAN, and hasn't been active for a while.
<a href="https://github.com/Vizzuality/cartodb-r">Source on Github</a>
</li>
<li>
<a href="https://github.com/ropensci/cartographer">cartographer</a>: Interactive
maps in R using <a href="https://github.com/emeeks/d3-carto-map">d3-carto-map</a>.
<a href="https://github.com/ropensci/cartographer">Source on Github</a>
</li>
<li>
<pkg>ggmap</pkg>: Visualization of spatial data and models on top of Google Maps,
OpenStreetMaps, Stamen Maps, or CloudMade Maps using ggplot2.
<a href="https://github.com/dkahle/ggmap">Source on Github</a>
</li>
<li>
<pkg>leaflet</pkg>: Client for the JavaScript library Leaflet.js. Uses <pkg>htmlwidgets</pkg> to provide structure for output. Integrated with R Console, RStudio, and R Markdown v 2. Can include interactive maps with markdown documents as well as with <pkg>shiny</pkg> apps. <a href="https://github.com/rstudio/leaflet">Source on Github</a>
</li>
<li>
<pkg>leafletR</pkg>: Another client for the JavaScript library Leaflet.js. Basic mapping
functionality to combine vector data and online map tiles from different
sources. <a href="https://github.com/chgrl/leafletR">Source on Github</a>
</li>
<li>
<pkg>mapview</pkg>: This package provides wrappers to the <pkg>leaflet</pkg> package that simplifies the creation of maps. Stated purpose of the package is to facilitate interactive viewing of spatial data in R.
<a href="https://github.com/environmentalinformatics-marburg/mapview">Source on
Github.</a>
</li>
<li>
<pkg>micromap</pkg>: This group of functions simplifies the creation of linked
micromap plots, and uses ggplot2 plotting framework.
<a href="https://github.com/USEPA/R-micromap-package-development">Source on
Github.</a>
</li>
<li>
<pkg>OpenStreetMap</pkg>: An R client for fetching raster images via the Open Street Maps API.
</li>
<li>
<pkg>plotGoogleMaps</pkg>: This package provides a interactive plot device for
handling the geographic data for web browsers. It is designed for the automatic
creation of web maps as a combination of users' data and Google Maps layers.
</li>
<li>
<pkg>quickmpar</pkg>: Quick visualization of <pkg>sp</pkg> and <pkg>raster</pkg> objects. Provides basic interactivity including zooming and panning as well as identifying features.
<a href="https://github.com/jhollist/quickmapr">Source on Github</a>
</li>
<li>
<pkg>rasterVis</pkg>: Package for enhanced visualization of raster data.
<a href="https://github.com/oscarperpinan/rastervis/">Source on Github</a>
</li>
<li>
<pkg>Rgooglemaps</pkg>: Query Google static maps, and use the map as a background
image to overlay plots within R.
<a href="https://github.com/markusloecher/RgoogleMaps">Source on Github</a>
</li>
<li>
<a href="https://github.com/ramnathv/rMaps">rMaps</a>: A general purpose wrapper
around main Javascript mapping libraries, including
<a href="http://leafletjs.com/">Leaflet</a>,
<a href="http://datamaps.github.io/">Datamaps</a>, and
<a href="http://sztanko.github.io/crosslet/">Crosslet</a>.
<a href="https://github.com/ramnathv/rMaps">Source on Github</a>
</li>
<li>
<pkg>sp</pkg>: Core spatial package in R with basic spatial data manipulation methods. Most spatial analysis packages reuse the classes and methods provided by [sp](http://cran.r-project.org/web/packages/sp/index.html). Plotting capability in [sp](http://cran.r-project.org/web/packages/sp/index.html) is provided through plot methods. More advanced plotting based on <pkg>lattice</pkg>.
<a href="https://github.com/edzer/sp/">Source on GitHub</a>
</li>
<li>
<pkg>tmap</pkg>: Package provides an approach to build thematic maps (e.g. chloropleth or bubble maps). Utilizes a grammar of graphics syntax.
<a href="https://github.com/mtennekes/tmap">Source on GitHub</a>
</li>
</ul>
<p><strong>Projecting Data</strong></p>
<p>Coordinates for spatial data can come in many different flavors with different
units, datum, projections, and more. Many of the tools will visualize your
data regardless of the native coordinate reference system; however, most (all?)
of the javascript libraries assume some flavor of latitude-longitude, thus if
your data are projected they need to be transformed back to geographic
coordinates prior to mapping. For most mapping and visualization efforts
unprojected data (often displayed in Web Mercator/EPSG::3857) is fine; however,
if accurate area, length, or distance measurements are required through
interacting with the map, then projections need to be considered. A discussion
of projections and coordinate systems is beyond the scope of this task view.
To learn more a good starting place is [NCEAS' Overview of Coordinate Reference
Systems in R](https://www.nceas.ucsb.edu/~frazier/RSpatialGuides/OverviewCoordinateReferenceSystems.pdf). This more general discussion of projection from the [USGS](http://egsc.usgs.gov/isb//pubs/MapProjections/projections.html) is also good.</p>
<p>Once you know that you need to transform you data there are several options:</p>
<ul>
<li>
<pkg>sp</pkg>: The function <code>spTransform</code> (and methods in
<pkg>rgdal</pkg>) is the workhorse function for spatial transformations of
vector data and it uses [PROJ.4](http://trac.osgeo.org/proj/) arguments to
specify the transformations. Accepted inputs are provided by the spTransform
methods in <pkg>rgdal</pkg>. <a href="https://github.com/edzer/sp/"> Source for <code>sp</code> on GitHub</a>. <a href="https://r-forge.r-project.org/projects/rgdal/"> Source for <code>rgdal</code> on R-Forge</a>.
</li>
<pkg>raster</pkg>: Use <code>rasterProject()</code> to project rasters.
Projecting rasters is a bit different than vector as the transformation results
in a rotated grid which require some interpolation to map the original cell
values to the new cell values. Dealing with this requires a separate function
and <code>rasterProject()</code> has options for dealing with the interpolation.
<li>
<pkg>mapproj</pkg>: This package provides a function to convert two vectors
representing longitude (x) and latitude (y) to projected coordinates.
</li>
<li>
<pkg>PBSmapping</pkg>: The function <code>convUL</code> will transform
coordinates between Universal Transverse Mercator (UTM) and longitude-latitude.
A data frame with a <code>projection</code> attribute is required input.
<a href="http://code.google.com/p/pbs-software/">Source on Google Code</a>
</li>
</ul>
<p><strong>Geocoding</strong></p>
<p>Geocoding is the process of converting address or place name information into
geographic coordinates. Most of these have somewhat restricted Terms of Service(TOS). Be sure to read those carefully prior to use. Links for the TOS are provided.</p>
<ul>
<li>
<pkg>geocodeHERE</pkg>: Client for Nokia's
<a href="https://developer.here.com/geocoder">HERE geocoding API</a>.
<a href="https://github.com/corynissen/geocodeHERE/">Source on GitHub</a>
</li>
<li>
<pkg>ggmap</pkg>: The function <code>geocode</code> in <pkg>ggmap</pkg> uses
the <a href="https://developers.google.com/maps/documentation/geocoding/?csw=1">Google Geocoding API</a>.
<a href="https://github.com/dkahle/ggmap">Source on Github</a>
</li>
<li>
<a href="https://github.com/trestletech/rydn">rydn</a>: Client for the Yahoo!
Developers Network <a href="https://developer.yahoo.com/boss/">BOSS PlaceFinder API</a>.
<a href="https://github.com/trestletech/rydn">Source on Github</a>
</li>
</ul>
<p><strong>Map Data</strong></p>
<p>There are *many* possible sources and formats of data to use as base layers, so this list
will most certainly be incomplete. Details for reading and writing most types of spatial data are already included in the <view>Analysis of Spatial Data Task View</view>, thus this list will focus on additional sources or features not discussed in that task view. </p>
<ul>
<li>
<pkg>geojsonio</pkg>: Provides utility for working with geojson data in R. Includes functions to convert sp objects, lists, and character to geojson format.
</li>
<li>
<pkg>geonames</pkg>: functions for working with
<a href="http://www.geonames.org/">geonames</a>, a geographical database that
covers all countries and contains over eight million place names
</li>
<li>
<pkg>maps</pkg>: Collection of coarse scaled for the US, some European
countries, and a world map. Stored as `map` objects and various other
geographic datasets. Location information in decimal degrees. Needs conversion
to work with visualization from <pkg>sp</pkg>, <pkg>ggmap</pkg>, etc. Code for
projections and additional maps in packages <pkg>mapproj</pkg> <pkg>mapdata</pkg>.
</li>
<li>
<a href="https://github.com/sckott/openadds">openadds</a>: An R client for <a href="http://openaddresses.io">Openaddresses</a>. The Openaddresses data comes in a variety of formats and this package provides common interface to simplify working with it in R.
<a href="https://github.com/sckott/openadds">Source on Github</a>
</li>
<li>
<pkg>osmar</pkg>: Package for interacting with the Open Street Map API in R.
Functions for converting an open street map object into <pkg>sp</pkg> or
<pkg>igraph</pkg> objects.
<a href="https://r-forge.r-project.org/projects/osmar/">Source on R-Forge.</a>
</li>
<li>
<a href="https://github.com/ropensci/prism">prism</a>: Accesses climate data from [PRSIM](http://www.prism.oregonstate.edu/). Also provides some basic plotting and mapping functions.
</li>
<li>
<pkg>rworldmap</pkg>: Set of functions to create country based world maps.
Allows for joining of user specified data and can display chloropleth, gridded,
bubble plot, bar charts, or pie charts. Data stored as `sp` objects.
<a href="https://code.google.com/p/rworld/downloads/list">Source on Google Code.</a>
</li>
<li>
<a href="https://github.com/walkerke/tigris">tigris</a>: Access US Census TIGER shapefiles directly in R. This package is currently in active development.
</li>
<li>
<pkg>USAboundaries</pkg>: provides spatial objects with the boundaries of states
or counties in the United States of America from 1629 to 2000. It provides data
from the Atlas of Historical County Boundaries.
</li>
<li>
<pkg>UScensus2010</pkg>: Functions to facilitate accessing data from
the 2010 US Census using a suite of packages. Includes spatial data for census geographies (e.g. tracts,
blocks, block groups, etc.). This packages is the third in a series of
related package suites: <pkg>UScensus1990blkgrp</pkg> and <pkg>UScensus2000</pkg>.
</li>
</ul>
</info>
<packagelist>
<pkg priority="core">sp</pkg>
{{#pkgs}}
<pkg>{{package}}</pkg>
{{/pkgs}}
</packagelist>
<links>
<a href="http://cran.r-project.org/web/views/Spatial.html">Analysis of Spatial Data Task View</a>
</links>
</CRANTaskView>