[R-sig-Geo] Coercing spatstat::psp to sp:SpatialLines

Roger Bivand Roger.Bivand at nhh.no
Tue Nov 15 18:15:30 CET 2011


On Tue, 15 Nov 2011, Mathieu Rajerison wrote:

> Hi,
>
>
> I've generated random segment patterns with spatstat::rpoisline so as to
> plot differences of profile lines between two different digital elevation
> models.
>
> Now, I want to use raster::extract function to get the raster values on
> both rasters for each segment but for this, I have to coerce a psp to a
> SpatialLines object but I don't know how to do the coercion. (SpatialLines
> to psp is OK).
> as(psp, "SpatialLines") doesn't seem to work.

The coercion functions in maptools, contributed by Adrian Baddeley, go 
from SpatialLines to psp, not the reverse. You need to create the set of 
coercion methods to go the other way - contributions welcome!

Roger

>
>
> Any help would be appreciated,
>
> Mathieu
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list