[R-sig-Geo] Distance from SpatialLinesDataFrame

Roger Bivand Roger.Bivand at nhh.no
Mon Dec 19 09:17:11 CET 2011


On Mon, 19 Dec 2011, Dimitrios Efthymiou wrote:

> Hi,
>
> I'm using the function "distanceFromPoints" of the R package 'raster' to
> create a raster with the Euclidean distances from a SpatialPointsDataFrame.
>
> Is there a similar command to calculate the Euclidean Distance from a
> SpatialLinesDataFrame object (in my case this is a highway)?

Please try gDistance() in rgeos.

Roger

>
> What I'm doing now, is to extract the Mid points of
> the SpatialLineDataFrame using the command "SpatialLineDataFrame", and then
> create a raster with distances from these points.
> However, I need something more accurate.
>
> Thanks in advance for you help.
>
>
>> sessionInfo() R version 2.14.0 (2011-10-31)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
> [1] C
>
> attached base packages:
> [1] splines   grid      stats     graphics  grDevices utils
> datasets  methods   base
>
> other attached packages:
> [1] ape_2.8             ade4_1.4-17         car_2.0-11
> survival_2.36-10    nnet_7.3-1
> [6] gstat_1.0-10        spacetime_0.5-7     xts_0.8-2
> zoo_1.7-6           rasterVis_0.10-7
> [11] hexbin_1.26.0       latticeExtra_0.6-19 RColorBrewer_1.0-5
> RANN_2.1.3          spdep_0.5-43
> [16] coda_0.14-6         nlme_3.1-102        MASS_7.3-16
> Matrix_1.0-2        boot_1.3-3
> [21] ggplot2_0.8.9       proto_0.3-9.2       reshape_0.8.4
> plyr_1.6            spgwr_0.6-13
> [26] spatstat_1.25-0     deldir_0.0-16       mgcv_1.7-12
> rgdal_0.7-5         maptools_0.8-10
> [31] lattice_0.20-0      foreign_0.8-48      raster_1.9-55
> sp_0.9-91
>
> loaded via a namespace (and not attached):
> [1] gee_4.13-17  tools_2.14.0
>
>
>
>

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