Reconnect saved horizons to moved panorama PNGs

Description

Update the external PNG paths in one horizon or a list after moving a project.

Usage

relinkHor(hor, path, recursive = FALSE)

Arguments

hor

A skyscapeR.horizon object or a list of horizon objects.

path

A directory containing the moved PNGs, or a character vector of PNG filenames in any order.

recursive

Search subdirectories when path names a directory. Defaults to FALSE.

Details

A saved horizon records the checksum of its displayed PNG. Copy that PNG with the RDS, including the levelled copy for a calibrated photograph. Matching checks file contents, so a renamed file can be recovered and different panoramas with the same filename can be distinguished. For identical copies, the original basename is preferred, then the first matching candidate. A skyline-only horizon passes through unchanged. If any required image cannot be verified, the function stops before returning a result. Assign the returned object and use saveRDS() to keep the updated paths. The original PeakFinder archive used for native-layout export is separate.

Value

The horizon or list, retaining its names, order and metadata with updated absolute PNG paths.

Examples

## Not run: 
sites <- readRDS("sites.rds")
sites <- relinkHor(sites, "panoramas", recursive = TRUE)
saveRDS(sites, "sites.rds")
# A single renamed image
hh <- relinkHor(hh, "photos/west-ridge.png")

## End(Not run)