get_locations: Obtaining locations for a SAFE dataset.

Description Usage Arguments Details Value Note See Also Examples

View source: R/locations.R

Description

This function returns a spatial 'simple features' (sf) object for a dataset record, including basic information about locations for the SAFE gazetteer if requested.

Usage

1
get_locations(obj, gazetteer_info = FALSE)

Arguments

obj

A single record id, or an existing safedata dataframe.

gazetteer_info

Should all the gazetteer fields be included in the returned sf object.

Details

All SAFE datasets recording observations from the field must include a Locations worksheet, which must contain all of the location names used in Locations type fields in data worksheets. These entries are matched against existing location names in the SAFE gazetteer. Users can also include 'new' location names in their dataset, which do not necessarily have coordinates. Processing locations works as follows:

  1. Known locations (new_location=FALSE) are matched against both the official location names in the gazetteer and the accepted aliases.

  2. New locations are first checked against the location aliases list to see if any new locations in this dataset have been matched to a gazetteer location. The gazetteer location is then used in preference to any new location data within the dataset.

  3. Finally, remaining new locations are assigned any feature geometry within the dataset. New locations do not necessarily have geometry data, so may have null or empty geometries.

Value

An object of classes 'safe_locations', 'sf' and 'data.frame'.

Note

Not all SAFE project datasets contain locations. In this case get_locations will return NULL.

See Also

add_locations, load_gazetteer, load_location_aliases

Examples

1
2
3
   safedir <- system.file('example_data_dir', package='safedata')
   set_safe_dir(safedir, update=FALSE, validate=FALSE)
   locations <- get_locations(1400562)

ImperialCollegeLondon/safe_data documentation built on Oct. 8, 2019, 4:27 p.m.