get_close_tags()
returns relevant tags which are at a certain distance from each location, giving a
meaningful sense of the type of place the person is in without providing exact data. No data is sent
online. If repeated queries are performed from the same directory with the same tags and the same or smaller distance,
most of the analysis will be drawn from cache and analysis time will be greatly reduced.
Usage
get_close_tags(
pbfdir,
lat,
long,
layers = DEFAULT_LAYERS,
tags = DEFAULT_TAGS,
dst = units::set_units(100, m),
refilter_data = FALSE,
quiet = TRUE
)
Arguments
- pbfdir
File directory with .osm.pbf files containing map data for the relevant area. The directory must be writeable as during processing the function will create temporary files in this directory, and then delete them.
- lat
numeric vector of latitudes
- long
numeric vector of longitudes
- layers
relevant layers from the pbf files (Do not touch if not familiar with OpenStreetMap data)
location tags of interest (Do not touch if not familiar with OpenStreetMap data)
- dst
max distance from each location to look for tags
- refilter_data
forcefully ignore cache
- quiet
less verbose function output
Examples
mydir <- withr::local_tempdir()
file.copy(system.file("extdata", "tokelau.osm.pbf", package = "privlocR"), mydir)
#> [1] TRUE
get_close_tags(mydir, c(-9.1979860, -9.192079), c(-171.8501176, -171.856883))
#> Error: Cannot open "/tmp/RtmpduIgqE/file1a182771db48.gpkg"; The file doesn't seem to exist.
get_close_tags(mydir, c(-9.1979860, -9.192079), c(-171.8501176, -171.856883),
dst = units::set_units(10,m))
#> Error: Cannot open "/tmp/RtmpduIgqE/file1a182771db48.gpkg"; The file doesn't seem to exist.
get_close_tags(mydir, c(-9.1979860, -9.192079), c(-171.8501176, -171.856883),
dst = units::set_units(10,m), tags = c("amenity","landuse"))
#> Warning: cannot remove file '/tmp/RtmpduIgqE/file1a182771db48.gpkg', reason 'No such file or directory'
#> Error: Cannot open "/tmp/RtmpduIgqE/file1a18721d89f6.gpkg"; The file doesn't seem to exist.