window {qlcVisualize}R Documentation

Producing windows of class "owin"

Description

These functions are deprecated: use weightedMap instead.

Different ways to easily produce windows of class "owin" from the package "spatstat" are presented here. These are used by voronoi.

Usage

hullToOwin(points, shift, alpha)
mapsToOwin(country, database = "world")
gadmToOwin(country, sub = NULL, level = 0)

Arguments

points

Set of points that need a window around them. Two column matrix.

shift

The amount of space around the outer points at determining the window.

alpha

Parameter for the 'curviness': lower values show more detail. Passed internally to ahull.

country

Name of the country to obtain borders and turn them into an owin object needed for the function voronoi. For mapsToOwin check map how to specify the names. For gadmToOwin, check https://gadm.org.

database

Database as used by map.

sub, level

Names for Subdivisions of countries as available in the GADM database

Details

For hullToOwin, the function ahull is used to make a hull around the points. This is then converted to an "owin" window.

The functions mapsToOwin and GadmToWin use external topogaphic boundaries to produce windows.

Value

All functions return an object of class owin from the package spatstat.

Note

Includes code from code from Andrew Bevan, based on code from Dylan Beaudette, see https://stat.ethz.ch/pipermail/r-sig-geo/2012-March/014409.html.

The function gadmToOwin needs online access to download the data. The data is saved in the current working directory, and will not be downloaded again when it is already available there.

Author(s)

Michael Cysouw <cysouw@mac.com>

Examples

## Not run: 
# Boundary of the German state "Hessen"
# This will need to access the online GADM database
# and might take some time
boundary <- gadmToOwin("DEU", "Hessen", 1)

# A window does not have to be continuous
random <- mapsToOwin(c("Germany", "Greece"))
plot(random, main = NULL)

# hull around some points
# note influence of alpha and shift
data(hessen)

hull <- hullToOwin(hessen$villages, shift = 0.2, alpha = 1)
plot(hull)
points(hessen$villages)

hull <- hullToOwin(hessen$villages, shift = 0.1, alpha = 0.2)
plot(hull)
points(hessen$villages)

## End(Not run)

[Package qlcVisualize version 0.3 Index]