window: Producing windows of class "owin"

Description Usage Arguments Details Value Note Author(s) Examples

Description

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

Usage

1
2
3
hullToOwin(points, shift, alpha)
mapsToOwin(country, database = "worldHires")
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 getData.

database

Database as used by map.

sub, level

Names for Subdivisions of countries as available in the GADM database. Read the help file getData for more information about GADM, the subdivisions and how to acces them.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Boundary of the German state "Hessen"
# This will need to access the GADM database online
## Not run: 
boundary <- gadmToOwin("DEU","Hessen",1)
## End(Not run)

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

# 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)

qlcVisualize documentation built on May 29, 2017, 9:35 p.m.