Title: | Transform Base Maps Using Log-Azimuthal Projection |
Version: | 0.2.0 |
Description: | Base maps are transformed to focus on a specific location using an azimuthal logarithmic distance transformation. |
URL: | https://github.com/riatelab/fisheye |
BugReports: | https://github.com/riatelab/fisheye/issues |
License: | GPL-3 |
Depends: | R (≥ 3.5.0) |
Imports: | sf |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Suggests: | covr, tinytest |
NeedsCompilation: | no |
Packaged: | 2023-12-12 13:53:08 UTC; tim |
Author: | Timothée Giraud |
Maintainer: | Timothée Giraud <timothee.giraud@cnrs.fr> |
Repository: | CRAN |
Date/Publication: | 2023-12-12 14:10:02 UTC |
Package description
Description
Base maps are transformed to focus on a specific location using an azimuthal logarithmic distance transformation.
References
Hägerstrand, T. (1957). Migration and Area: A Survey of a Sample of Swedish Migration Fields and Hypothetical Considerations of their Genesis. Lund Studies in Geography, Series B, Human Geography, Department of Geography, University of Lund, Lund.
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)