Reads a spatial data file (.shp or .gpkg) and optionally displays it in an interactive map preview. macOS only: tabular viewing uses view_vd_nonint(), which is not supported on Windows or Linux; on those systems the function stops with an error.

view_mapview_from_path(path, preview = FALSE)

Arguments

path

Path to the spatial data file (.shp or .gpkg)

preview

Logical. If TRUE, opens an interactive map preview in the browser. Default is FALSE.

Value

Returns nothing, called for side effects

Details

Requires macOS because the workflow always opens the attribute table with VisiData via view_vd_nonint(). The function performs the following steps:

  1. Validates that the input file exists and has the correct extension (.shp or .gpkg)

  2. Creates a temporary HTML file for the map preview in ~/.local/share/mapview/

  3. Reads the spatial data using sf::read_sf()

  4. If preview=TRUE, creates an interactive map using mapview and opens it in the browser

  5. Opens the attribute data in VisiData