r-tmap/tmap

Interactive mode not working with my linestring geometries

Closed this issue · 0 comments

The default "plot" mode is able to plot the linestring geometries as expected, but "view" mode does not.

library(tidyverse)
library(osmdata)
library(sf)
library(tmap)

# Bounding box for Snow Mountain Ranch system of hiking trails
smr_bb <- c(left = -120.76525, bottom = 46.62510, 
            right = -120.73286, top = 46.66085)

# Fetching hiking trail geometries from OpenStreetMap using osmdata
trails <- smr_bb |>
  opq() |>
  add_osm_feature(key = "highway", value = "path") |>
  osmdata_sf()

# Works as expected in default "plot" mode
trails_map <- tm_shape(trails$osm_lines) +
  tm_lines(col = "blue")
trails_map

hiking_trails_plot_mode Large

# Interactive map displays but the hiking trails are not visible
tmap_mode("view")
trails_map

hiking_trails_view_mode