Title: | Transform Base Maps Using Log-Azimuthal Projection |
---|---|
Description: | Base maps are transformed to focus on a specific location using an azimuthal logarithmic distance transformation. |
Authors: | Timothée Giraud [cre, aut] , Luc Guibard [aut] |
Maintainer: | Timothée Giraud <[email protected]> |
License: | GPL-3 |
Version: | 0.3.0 |
Built: | 2024-10-26 03:55:25 UTC |
Source: | https://github.com/riatelab/fisheye |
Base maps are transformed to focus on a specific location using an azimuthal logarithmic distance transformation.
Maintainer: Timothée Giraud [email protected] (ORCID)
Authors:
Luc Guibard
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.
Useful links:
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.
fisheye(x, centre, method = "log", k = 1)
fisheye(x, centre, method = "log", k = 1)
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. |
The 'log' method transforms distances to center
with:
The 'sqrt' method transforms distances to center
with:
A transformed sf object is returned.
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)
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)