All Projects → ropensci → Rnaturalearth

ropensci / Rnaturalearth

Licence: other
an R package to hold and facilitate interaction with natural earth map data 🌍

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Rnaturalearth

Tic
Tasks Integrating Continuously: CI-Agnostic Workflow Definitions
Stars: ✭ 135 (-3.57%)
Mutual labels:  r-package, rstats
Crrri
A Chrome Remote Interface written in R
Stars: ✭ 137 (-2.14%)
Mutual labels:  r-package, rstats
Gramr
RStudio Addin, function, & shiny app for the write-good linter 📝
Stars: ✭ 116 (-17.14%)
Mutual labels:  r-package, rstats
Geojsonio
Convert many data formats to & from GeoJSON & TopoJSON
Stars: ✭ 132 (-5.71%)
Mutual labels:  r-package, rstats
Jqr
R interface to jq
Stars: ✭ 123 (-12.14%)
Mutual labels:  r-package, rstats
Umapr
UMAP dimensionality reduction in R
Stars: ✭ 115 (-17.86%)
Mutual labels:  r-package, rstats
Roomba
General purpose API response tidier
Stars: ✭ 117 (-16.43%)
Mutual labels:  r-package, rstats
Pkgverse
📦🔭🌠 Create your own universe of packages à la tidyverse
Stars: ✭ 108 (-22.86%)
Mutual labels:  r-package, rstats
Osmplotr
Data visualisation using OpenStreetMap objects
Stars: ✭ 122 (-12.86%)
Mutual labels:  r-package, rstats
Piggyback
📦 for using large(r) data files on GitHub
Stars: ✭ 122 (-12.86%)
Mutual labels:  r-package, rstats
Rgbif
Interface to the Global Biodiversity Information Facility API
Stars: ✭ 113 (-19.29%)
Mutual labels:  r-package, rstats
Packagemetrics
A Package for Helping You Choose Which Package to Use
Stars: ✭ 129 (-7.86%)
Mutual labels:  r-package, rstats
Ssh
Native SSH client in R based on libssh
Stars: ✭ 111 (-20.71%)
Mutual labels:  r-package, rstats
Rcrossref
R client for various CrossRef APIs
Stars: ✭ 137 (-2.14%)
Mutual labels:  r-package, rstats
Starters
R Package 📦 for initializing projects for various R activities 🔩
Stars: ✭ 111 (-20.71%)
Mutual labels:  r-package, rstats
Available
Check if a package name is available to use
Stars: ✭ 116 (-17.14%)
Mutual labels:  r-package, rstats
Monkeylearn
⛔️ ARCHIVED ⛔️ 🐒 R package for text analysis with Monkeylearn 🐒
Stars: ✭ 95 (-32.14%)
Mutual labels:  r-package, rstats
Rorcid
A programmatic interface the Orcid.org API
Stars: ✭ 101 (-27.86%)
Mutual labels:  r-package, rstats
Modistsp
An "R" package for automatic download and preprocessing of MODIS Land Products Time Series
Stars: ✭ 118 (-15.71%)
Mutual labels:  r-package, rstats
Datapackager
An R package to enable reproducible data processing, packaging and sharing.
Stars: ✭ 125 (-10.71%)
Mutual labels:  r-package, rstats

CRAN Status Badge CRAN Total Downloads CRAN Monthly Downloads Project Status: Active – The project has reached a stable, usable state and is being actively developed.

Travis-CI Build Status Build status

rnaturalearth

An R package to hold and facilitate interaction with Natural Earth map data.

Provides :

  1. access to a pre-downloaded subset of Natural Earth v4.1.0 (March 2018) vector data commonly used in world mapping
  2. easy subsetting by countries and regions
  3. functions to download other Natural Earth vector and raster data
  4. a simple, reproducible and sustainable workflow from Natural Earth data to rnaturalearth enabling updating as new versions become available
  5. clarification of differences in world maps classified by countries, sovereign states and map units
  6. consistency with Natural Earth naming conventions so that rnaturalearth users can use Natural Earth documentation
  7. data in 'sf' or 'sp' formats

The Natural Earth website structures vector data by scale, category and type. These determine the filenames of downloads. rnaturalearth uses this structure to facilitate download (like an API).

Install rnaturalearth

Install from CRAN :

install.packages("rnaturalearth")

or install the development version from GitHub using devtools.

devtools::install_github("ropensci/rnaturalearth")

Data to support much of the package functionality are stored in two data packages that you will be prompted to install when required if you do not do so here.

devtools::install_github("ropensci/rnaturalearthdata")
install.packages("rnaturalearthhires",
                 repos = "http://packages.ropensci.org",
                 type = "source")

First Usage

Here using sp::plot as a simple, quick way to plot maps. Maps could also be made with ggplot2, tmap or other options. All retrieval functions accept an argument returnclass='sf' to return package sf (Simple Features) objects.

library(rnaturalearth)
library(sp)

#world countries
sp::plot(ne_countries())

#uk
sp::plot(ne_countries(country = 'united kingdom'))

#states, admin level1 boundaries
sp::plot(ne_states(country = 'spain')) 

Introductory vignette

vignette('rnaturalearth', package='rnaturalearth')

To download Natural Earth data not already in the package

There are a wealth of other data available at the Natural Earth website. rnaturalearth has functions to help with download of these data.

The data available are outlined in the two tables below and online here.

category   cultural 
                                type scale110 scale50 scale10
1                          countries     TRUE    TRUE    TRUE
2                          map_units     TRUE    TRUE    TRUE
3                       map_subunits    FALSE    TRUE    TRUE
4                        sovereignty     TRUE    TRUE    TRUE
5                     tiny_countries     TRUE    TRUE    TRUE
6                             states    FALSE    TRUE    TRUE
7                   populated_places     TRUE    TRUE    TRUE
8                boundary_lines_land     TRUE    TRUE    TRUE
9                  pacific_groupings     TRUE    TRUE    TRUE
10          breakaway_disputed_areas    FALSE    TRUE    TRUE
11     boundary_lines_disputed_areas    FALSE    TRUE    TRUE
12 boundary_lines_maritime_indicator    FALSE    TRUE    TRUE
13                          airports    FALSE    TRUE    TRUE
14                             ports    FALSE    TRUE    TRUE
15                       urban_areas    FALSE    TRUE    TRUE
16                             roads    FALSE   FALSE    TRUE
17                         railroads    FALSE   FALSE    TRUE

category   physical 
                          type scale110 scale50 scale10
1                    coastline     TRUE    TRUE    TRUE
2                         land     TRUE    TRUE    TRUE
3                        ocean     TRUE    TRUE    TRUE
4      rivers_lake_centerlines     TRUE    TRUE    TRUE
5                        lakes     TRUE    TRUE    TRUE
6              glaciated_areas     TRUE    TRUE    TRUE
7  antarctic_ice_shelves_polys     TRUE    TRUE    TRUE
8             geographic_lines     TRUE    TRUE    TRUE
9                 graticules_1     TRUE    TRUE    TRUE
10                graticules_5     TRUE    TRUE    TRUE
11               graticules_10     TRUE    TRUE    TRUE
12               graticules_15     TRUE    TRUE    TRUE
13               graticules_20     TRUE    TRUE    TRUE
14               graticules_30     TRUE    TRUE    TRUE
15          wgs84_bounding_box     TRUE    TRUE    TRUE
16                      playas    FALSE    TRUE    TRUE
17               minor_islands    FALSE   FALSE    TRUE
18                       reefs    FALSE   FALSE    TRUE

Specify the scale, category and type of the vector you want as in the examples below.

#lakes
lakes110 <- ne_download(scale = 110, type = 'lakes', category = 'physical')
sp::plot(lakes110)

#rivers
rivers50 <- ne_download(scale = 50, type = 'rivers_lake_centerlines', category = 'physical')
sp::plot(rivers50)

Details of different country definitions and scales

vignette('what-is-a-country', package='rnaturalearth')

Reproducible download of Natural Earth data into the package

Script used to get data into the accompanying data packages.

Acknowledgements

Thanks to Lincoln Mullen for code structure inspiration from USAboundaries, Hadley Wickham for comments and prompting, Bob Rudis for answers to stackoverflow questions about downloading Natural Earth data into R. The Natural Earth team and Nathan Kelso for providing such a great resource.

Potential future work

potential additional data

  1. Country synonyms lookup

  2. Country larger regions lookup

potential additional functions

  1. facilitate joining of user data to country boundaries

  2. facilitate subsetting by country groupings

    • e.g. least developed countries etc.

ropensci_footer

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].