fisheye {fisheye}R Documentation

fisheye

Description

This function transform an sf layer with a fisheye transformation. Several methods are available. This is a visualisation method that should not be used for geospatial calculation (area, distances...). The output sf object has no CRS as it is not relevant.

Usage

fisheye(x, centre, method = "log", k = 1)

Arguments

x

an sf object (POINT, LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON) to be transformed. This object needs to be projected (no lon/lat).

centre

an sf object, the center of the transformation. This object must use the same projection as x.

method

transfomation method, either 'log' or 'sqrt'. See Details.

k

integer, factor to adjust the log transformation, higher values soften the deformation. See Details.

Details

The 'log' method transforms distances to center with: {d}' = \log(1 + 10^{-k} * d)
The 'sqrt' method transforms distances to center with: {d}' = \sqrt(d)

Value

A transformed sf object is returned.

Examples

library(sf)
ncraw <- st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE)
nc <- st_transform(ncraw, 3857)
ncfe <- fisheye(nc, centre = nc[100, ], method = 'log', k = 4)
plot(st_geometry(ncfe), col = "grey70", lwd = .2)
plot(st_geometry(ncfe[100,]), col = NA, lwd = 2, border = "red", add = TRUE)

[Package fisheye version 0.2.0 Index]