Skip to contents

checks from a list dependent on type, category and scale. If it returns FALSE the data may still exist on the website. Doesn't yet do checking on raster names because I found the naming convention too tricky.

Usage

check_data_exist(
  type,
  scale = 110L,
  category = c("cultural", "physical", "raster")
)

Arguments

type

type of natural earth file to download one of 'countries', 'map_units', 'map_subunits', 'sovereignty', 'states' OR the portion of any natural earth vector url after the scale and before the . e.g. for 'ne_50m_urban_areas.zip' this would be 'urban_areas' OR the raster filename e.g. for 'MSR_50M.zip' this would be 'MSR_50M'

scale

The scale of map to return, one of `110`, `50`, `10` or `small`, `medium`, `large`.

category

one of natural earth categories : 'cultural', 'physical', 'raster'

Value

TRUE or FALSE

Details

Note that the filename of the requested object will be returned if `load = FALSE`.

See also

ne_load, pre-downloaded data are available using ne_countries, ne_states. Other geographic data are available in the raster package : getData.

Examples

check_data_exist(type = "countries", scale = 110, category = "cultural")
#> [1] TRUE

# Type not in list for this category
check_data_exist(type = "airports", scale = 110, category = "physical")
#> Warning: `airports` seems not to be in the list for category= "physical" maybe try the
#> other category of c('cultural', 'physical')
#> [1] FALSE

# Type in list but scale shows FALSE
check_data_exist(type = "airports", scale = 110, category = "cultural")
#> Warning: The requested daa seem not to exist in the list of Natural Earth data. Check
#> `?ne_download` or <http://www.naturalearthdata.com/features/> to see data
#> availability.
#> [1] FALSE