[R-sig-Geo] Distance from point to specified raster cell value

Alexandre Lafontaine a_lafontaine at hotmail.com
Tue Jul 7 19:56:14 CEST 2015


Thanks Matt for the input, converting cells of interest to points was indeed an efficient and quick way to do it.

Alex


> Date: Mon, 6 Jul 2015 11:57:20 -0700
> Subject: Re: [R-sig-Geo] Distance from point to specified raster cell value
> From: strimas at zoology.ubc.ca
> To: a_lafontaine at hotmail.com
> CC: r-sig-geo at r-project.org
> 
> Perhaps the rasterToPoints function is what you're after:
> http://www.inside-r.org/packages/cran/raster/docs/rasterToPoints
> 
> gDistance(spatialpoints, rasterToPoints(r, fun=function(x) {x == 15}))
> 
> On Mon, Jul 6, 2015 at 10:38 AM, Alexandre Lafontaine
> <a_lafontaine at hotmail.com> wrote:
>>
>> Dear members,
>> I am looking for a way to extract the distance from spatial points objects to the closest raster cell of a specific value. I have not a found a way to do so yet with the raster or rgeos librairies...
>>
>> Something like the gDistance function in which I could specify the raster value I am interested in:
>>
>>
>> gDistance( spatialpoints, r[r==15])
>>
>>
>> If anyone have suggestions, (it needs to be fairly quick because I have thousands of points to compute).
>>
>>
>> Any help really appreciated,
>>
>>
>> Alex Lafontaine
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
 		 	   		  


More information about the R-sig-Geo mailing list