Storing a Part of a Map

Description

subsetmap is a generic function. It has methods for the classes asc and kasc. It is used to store a part of any given map into an other object.

Usage

1

Arguments

x

an object of class asc or kasc

xlim

numerical vector of length 2. The x limits of the rectangle including the new map

ylim

numerical vector of length 2. The y limits of the rectangle including the new map

...

further arguments passed to or from other methods

Details

If xlim or ylim are not provided, the function asks the user to click on the map to delimit the lower left corner and the higher right corner of the new map (see Examples).

Value

Returns an object of class asc or kasc

Author(s)

Clement Calenge clement.calenge@oncfs.gouv.fr, improvements by Jon Olav Vik

See Also

asc, kasc

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
data(puechabon)
kasc <- puechabon$kasc
el <- getkasc(kasc, "Elevation")

## limits of the new map:
xl <- c(701561, 704017)
yl <- c(3160560, 3162343)

## computation of the new map:
su <- subsetmap(el, xlim = xl, ylim = yl)

## Display
opar <- par(mar = c(0,0,0,0))
layout(matrix(c(1,1,1,1,1,1,1,1,2), byrow = TRUE, ncol = 3))
image(el, axes = FALSE)
polygon(c(xl[1], xl[2], xl[2], xl[1]),
        c(yl[1], yl[1], yl[2], yl[2]))
image(su, axes = FALSE)
box()

par(opar)
par(mfrow = c(1,1))

### Gets this part for the whole kasc object
m <- subsetmap(kasc, xlim = xl, ylim = yl)
image(m)


## Not run: 
 ## Interactive example 
 su <- subsetmap(kasc)

 image(su)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.