view_mapview_from_path: View spatial data from file path with optional map preview

View source: R/view_in.R

view_mapview_from_pathR Documentation

View spatial data from file path with optional map preview

Description

Reads a spatial data file (.shp or .gpkg) and optionally displays it in an interactive map preview. The data is also opened in VisiData for tabular viewing.

Usage

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.

Details

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

Value

Returns nothing, called for side effects


kguidonimartins/misc documentation built on Dec. 20, 2024, 7:03 p.m.