[R-sig-Geo] xyValues on raster with distances

Robert J. Hijmans r.hijmans at gmail.com
Sat Nov 6 23:17:08 CET 2010


Dear Manuel,

If you are using the same village points to extract values that would
make sense. The distance from a village to the nearest village
(itself) is zero. You can visually investigate what is going using
these functions:

plot(distpob)
points(poblados)
click(distpob)
zoom(distpob)
plot(poblados)

Also, rather than this
> rp = pointsToRaster(r, poblados, values=1)
> distpob <- distance(rp)

you could consider
dispob <- distanceFromPoints(r, poblados)


Robert

On Fri, Nov 5, 2010 at 2:01 PM, Manuel Spínola <mspinola10 at gmail.com> wrote:
> Dear list members,
>
> I created a raster with distances to villages and when I tried to obtain
> the values form the raster for several points (using function xyValues)
> I got all 0 values.  Any help will be appreciated.
>
> r = raster(corredor)
>
> res(r) = 300
>
> rp = pointsToRaster(r, poblados, values=1)
>
> distpob <- distance(rp)
>
> distpob
> class       : RasterLayer
> filename    :
> nrow        : 314
> ncol        : 236
> ncell       : 74104
> min value   : 0
> max value   : 46013.58
> projection  : NA
> xmin        : 447165.1
> xmax        : 517965.1
> ymin        : 1122216
> ymax        : 1216416
> xres        : 300
> yres        : 300
>
>
> Best,
>
> Manuel
>
>
>
> --
> *Manuel Spínola, Ph.D.*
> Instituto Internacional en Conservación y Manejo de Vida Silvestre
> Universidad Nacional
> Apartado 1350-3000
> Heredia
> COSTA RICA
> mspinola at una.ac.cr
> mspinola10 at gmail.com
> Teléfono: (506) 2277-3598
> Fax: (506) 2237-7036
> Personal website: Lobito de río
> <https://sites.google.com/site/lobitoderio/>
> Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
>
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>



More information about the R-sig-Geo mailing list