Description Usage Arguments Details Author(s) See Also Examples
These functions convert maps of classes available in adehabitat toward
classes available in the package sp and conversely.
kasc2spixdf converts an object of class kasc into an
object of class SpatialPixelsDataFrame.
asc2spixdf converts an object of class asc into an
object of class SpatialGridDataFrame.
spixdf2kasc converts an object of class
SpatialPixelsDataFrame or SpatialGridDataFrame into an
object of class asc or kasc.
area2spol converts an object of class area into an
object of class SpatialPolygons.
spol2area converts an object of class SpatialPolygons or
SpatialPolygonsDataFrame into an object of class
area.
attpol2area gets the data attribute of an object of class
SpatialPolygonsDataFrame and stores it into a data frame.
traj2spdf converts an object of class traj into an
object of class SpatialPointsDataFrame.
traj2sldf converts an object of class traj into an
object of class SpatialLinesDataFrame.
ltraj2spdf converts an object of class ltraj into an
object of class SpatialPointsDataFrame.
ltraj2sldf converts an object of class ltraj into an
object of class SpatialLinesDataFrame.
kver2spol converts an object of class kver into an
object of class SpatialPolygons.
1 2 3 4 5 6 7 8 9 10 11 | kasc2spixdf(ka)
asc2spixdf(a)
spixdf2kasc(sg)
area2spol(ar)
spol2area(sr)
attpol2area(srdf)
traj2spdf(tr)
traj2sldf(tr, byid = FALSE)
ltraj2spdf(ltr)
ltraj2sldf(ltr, byid = FALSE)
kver2spol(kv)
|
ka |
an object of class |
a |
an object of class |
sg |
an object of class |
ar |
an object of class |
sr |
an object of class |
srdf |
an object of class |
tr |
an object of class |
ltr |
an object of class |
kv |
an object of class |
byid |
logical. If |
We describe here more in detail the functions spol2area and
attpol2area. Objects of class area do not deal with
holes in the polygons, whereas the objects of class
SpatialPolygons do. Therefore, when holes are present in the
SpatialPolygons object passed as argument, the function
spol2area ignore them and returns only the external contour of
the polygon (though a warning is returned).
Clement Calenge clement.calenge@oncfs.gouv.fr, code
of spixdf2kasc kindly provided by Roger Bivand
Roger.Bivand@nhh.no
asc for information on objects of
class asc, kasc for info on objects of
class kasc, area for info on objects of
class area, traj for objects of class
traj, ltraj for objects of class
ltraj.
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | ## Not run:
if (require(sp)) {
#########################################
##
## Conversion kasc -> SpatialPixelsDataFrame
##
data(puechabon)
toto <- kasc2spixdf(puechabon$kasc)
image(toto)
summary(toto)
#### and conversely
toto <- spixdf2kasc(toto)
image(toto)
hist(toto)
data(meuse.grid)
m <- SpatialPixelsDataFrame(points = meuse.grid[c("x", "y")],
data = meuse.grid)
i <- spixdf2kasc(m)
image(i)
### conversion asc -> SpatialPixelsDataFrame
cuicui <- asc2spixdf(getkasc(toto,1))
image(cuicui)
#########################################
##
## Conversion kver -> SpatialPolygons
##
hr <- getverticeshr(kernelUD(puechabon$locs[,c("X","Y")], puechabon$locs$Name,
grid=100))
plot(hr)
class(hr)
spo <- kver2spol(hr)
plot(spo)
class(spo)
#########################################
##
## Conversion area -> SpatialPolygons
##
data(elec88)
ar <- as.area(elec88$area)
plot(ar)
toto <- area2spol(ar)
plot(toto)
#########################################
##
## Conversion SpatialPolygons -> area
##
## First create an object of class "SpatialRingsDataFrame"
tutu <- SpatialPolygonsDataFrame(toto, elec88$tab)
## and then conversion:
coincoin <- spol2area(tutu)
plot(coincoin)
## gets the attributes
haha <- attpol2area(tutu)
area.plot(coincoin, values = haha$Waechter)
#########################################
##
## Conversion ltraj -> SpatialPointsDataFrame
##
data(puechcirc)
plot(puechcirc)
toto <- ltraj2spdf(puechcirc)
plot(toto)
#########################################
##
## Conversion ltraj -> SpatialLinesDataFrame
##
toto <- ltraj2sldf(puechcirc)
plot(toto)
}
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.