Ricardo Adelino
Ricardo Adelino

Reputation: 165

SpatialLines with determined distance

I have spatial point coordinates in a matrix, and I need create (n) spatial lines with 100km of distance from the point coordinate using intervals of 1°.

How do I determine distance in kilometer using SpatialLines function from sp package? How do I determine regular intervals with 1°?

Upvotes: 0

Views: 134

Answers (1)

Robert Hijmans
Robert Hijmans

Reputation: 47146

Is this what you are after?

library(geosphere)
library(raster)

pt <- cbind(0,0)
d <- destPoint(pt, 0:360, 1000000)
s <- spLines(d)

plot(s)

for 10 degree steps:

d <- destPoint(pt, seq(0, 360, 10), 1000000)
s <- spLines(d)

plot(s)
points(d)

Upvotes: 1

Related Questions