View source: R/get_location_data.R
get_location_data | R Documentation |
Returns data for a selected location or a list of locations (for
map_location_data). If data is a character string, the parameter is passed
to read_sf_url, read_sf_path, or read_sf_pkg. This function uses
location_filter()
to filter (using sf::st_intersects), crop, or trim data
to the provided location. location can also be an an address, county GeoID,
state name, abbreviation, or GeoID.
get_location_data( location = NULL, dist = getOption("overedge.dist"), diag_ratio = getOption("overedge.diag_ratio"), unit = getOption("overedge.unit", default = "meter"), asp = getOption("overedge.asp"), data = NULL, package = getOption("overedge.data_package"), filetype = getOption("overedge.data_filetype", default = "gpkg"), fn = NULL, crop = TRUE, trim = FALSE, from_crs = getOption("overedge.from_crs"), crs = getOption("overedge.crs"), class = "sf", label = NULL, index = NULL, col = NULL, ... ) map_location_data( location = NULL, dist = NULL, diag_ratio = NULL, unit = NULL, asp = NULL, data = NULL, package = NULL, filetype = "gpkg", fn = NULL, crop = TRUE, trim = FALSE, from_crs = NULL, crs = NULL, class = "list", label = NULL, load = FALSE, index = NULL, ... )
location |
sf object. If multiple areas are provided, they are unioned into a single sf object using sf::st_union |
dist |
buffer distance in units. Optional. |
diag_ratio |
ratio of diagonal distance of area's bounding box used as
buffer distance. e.g. if the diagonal distance is 3000 meters and the
"diag_ratio = 0.1" a 300 meter will be used. Ignored when |
unit |
Units for buffer. Supported options include "meter", "foot", "kilometer", and "mile", "nautical mile" Common abbreviations (e.g. "km" instead of "kilometer") are also supported. Distance in units is converted to units matching GDAL units for x; defaults to "meter" |
asp |
Aspect ratio of width to height as a numeric value (e.g. 0.33) or
character (e.g. "1:3"). If numeric, |
data |
Character string (e.g. url, file path, or name of data from
package), a |
package |
Name of the package to search for data. |
filetype |
File type to use if passing parameters to read_sf_download or read_sf_pkg (required for extdata and cached data). |
fn |
Function to apply to data after filtering by location but before returning from function. |
crop |
If |
trim |
If |
from_crs |
Coordinate reference system used to match the location CRS to the source data. |
crs |
Coordinate reference system to return. |
class |
Class of object to return. |
label |
label is optionally used by map_location_data to name the data objects in the list returned by the function. |
index |
A list of possible location, data, and (optionally) package
values. List must be named and include a value named package and package
must be |
... |
additional parameters passed to read_sf_path, read_sf_url, or read_sf_pkg and location_filter |
load |
If |
Working with sf lists for data and locations:
map_location_data makes it easier to work with sf
lists. It supports data
as a character vector, data as an sf
list when location is a single object,
location as a character vector or sf
list (including lists of bbox
or sfc
objects), or when both data and location are lists (such as a list created
by make_location_data_list).
map_location_data( data = c("streets", "mta_bus_lines"), package = "mapbaltimore", location = get_location( type = "council_districts", id = 1, package = "mapbaltimore"), load = TRUE )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.