Displaying 1 result from an estimated 1 matches for "y_rdm".
Did you mean:
y_rd
2006 Oct 07
1
random point in a circle centred in a geographical position
...tm))
# Generate a random radius with a maximum distance of 1000 meters from the original location.
>radius<-runif(1,0,1000)
# Generate a random angle
>angle<-runif(1,0,360)
#Generate a random x coordinate
>x_rdm<-coord$x_utm[1]+radius*cos(angle)
#Generate a random y coordinate
>y_rdm<-coord$y_utm[1]+radius*sin(angle)
>result<-as.data.frame(cbind(x_rdm,y_rdm, x_utm, y_utm))
# We can calculate the distance between the original and the random location
> result$dist_m<-sqrt(((coord$x_utm-result$x_rdm)^2+(coord$y_utm-result$y_rdm)^2))
>result