Package Offline Fieldwork Vector Layers and Satellite Basemaps
Source:R/vantor_fieldwork.R
vantor_offline_package.RdBundles survey grid cells, sample points, seamline vintage polygons, and high-resolution Vantor satellite imagery into a self-contained directory ready to copy onto mobile tablets for offline use in QField, Mergin Maps, ArcGIS Field Maps, World Bank Survey Solutions, or ODK Collect:
Writes all vector layers (
grid,samples,seamlines) into a single multi-layer OGC GeoPackage (.gpkg).Writes a CSV preload table (
<package_name>_samples.csv) and a World Bank Survey Solutions tab-delimited assignment preload file (<package_name>_suso_preload.tab) whensamplesis provided.Saves or downloads the satellite basemap as a Web Mercator (
EPSG:3857) georeferenced GeoTIFF (.tif).Optionally builds a multi-zoom Esri Tile Package (
.tpkor.tpkx) viavantor_write_tpk()for zoomable offline basemaps in Survey Solutions (ArcGIS Maps SDK for .NET v200.x) and ArcGIS Field Maps.Optionally exports zipped Esri Shapefiles (
_shapes.zip) for uploading vector Enumeration Area boundaries to Survey Solutions Headquarters.
Usage
vantor_offline_package(
output_dir = tempfile(pattern = "vantor_offline_pkg_"),
grid = NULL,
samples = NULL,
seamlines = NULL,
raster = NULL,
fetch_basemap = FALSE,
create_tpk = FALSE,
tpk_zoom = 15:16,
create_shapefiles = FALSE,
suso_gps_var = "hh_gps",
resolution = 0.5,
product = "VIVID_STANDARD_30",
package_name = "vantor_fieldwork",
verbose = getOption("vantorr.verbose", TRUE)
)Arguments
- output_dir
Character string. Target directory for the offline bundle. Defaults to
tempfile(pattern = "vantor_offline_pkg_")in compliance with CRAN policy.- grid
Optional
sfpolygon layer (e.g., fromvantor_survey_grid()).- samples
Optional
sfpoint layer (e.g., fromvantor_export_capi()).- seamlines
Optional
sfseamline vintage layer (e.g., fromvantor_get_seamlines()).- raster
Optional
terra::SpatRasteror GeoTIFF file path to include in the offline bundle. Automatically reprojected to Web Mercator (EPSG:3857) for Survey Solutions / Esri compatibility.- fetch_basemap
Logical. If
TRUEandrasterisNULL, downloads the Vantor WMS basemap for the extent ofgridorsamples. Default isFALSE.- create_tpk
Logical or character (
"tpk"or"tpkx"). IfTRUEor"tpk", generates an Esri.tpk(Compact Cache V1) tile package; if"tpkx", generates an open-specification.tpkx(Compact Cache V2) tile package supported by Survey Solutions v24.09+ (ArcGIS Maps SDK v200.x). Default isFALSE.- tpk_zoom
Integer vector. Web Mercator zoom levels (
0to22) to include whencreate_tpkis enabled. Default is15:16.- create_shapefiles
Logical. If
TRUE, also writesgridandsamplesasEPSG:4326Esri Shapefiles bundled into<package_name>_shapes.zipfor Survey Solutions Headquarters upload. Default isFALSE.- suso_gps_var
Character string. Variable name of the identifying GPS question in your Survey Solutions Designer questionnaire used to format
<suso_gps_var>__Latitudeand<suso_gps_var>__Longitudecolumns in<package_name>_suso_preload.tab. Default is"hh_gps".- resolution
Numeric. Ground resolution in meters when
fetch_basemap = TRUE. Default is0.5.- product
Character string. Vivid product name when
fetch_basemap = TRUE. Default is"VIVID_STANDARD_30".- package_name
Character string. Base filename prefix for bundled files. Default is
"vantor_fieldwork".- verbose
Logical. Print progress messages. Default is
getOption("vantorr.verbose", TRUE).
Value
A list containing the paths to the generated offline bundle files:
output_dir, gpkg_path, layers, csv_path, suso_tab_path,
raster_path, tpk_path, tpk_zip_path, and shapefile_zip_path.
Examples
aoi <- sf::st_bbox(
c(xmin = -105.01, ymin = 39.73, xmax = -105.00, ymax = 39.74),
crs = sf::st_crs(4326)
)
grid_sf <- vantor_survey_grid(aoi, cell_size = 600, verbose = FALSE)
bundle <- vantor_offline_package(
grid = grid_sf,
create_shapefiles = TRUE,
verbose = FALSE
)
unlink(bundle$output_dir, recursive = TRUE)