sl.circle | R Documentation |
Compute points approximating a circle on a sphere around a central location. Points are placed equidistant on a circle around a central longitude-latitude location with a to-be-specified radius.
sl.circle(lon, lat, radius, resolution = 1, repeat.first = TRUE)
lon |
a scalar specifying the central longitude. |
lat |
a scalar specifying the central latitude. |
radius |
a scalar specifying the radius in degrees. |
resolution |
a scalar specifying the resolution (distance between points) in degrees (around the central point). |
repeat.first |
a logical value specifying whether to close the circle explicitly by repeating the first point at the end. |
lon |
Longitudes of the points on the circle |
lat |
Latitudes of the points on the circle |
Helge Goessling
sl.circle(lon = 8, lat = 50, radius = 5, resolution=30)
# should return:
#$lon
# [1] 15.7507972 15.0886911 12.2782746 8.0000000 3.7217254 0.9113089 0.2492028 1.6076588
# [9] 4.4283457 8.0000000 11.5716543 14.3923412 15.7507972 15.7507972
#
#$lat
# [1] 49.74086 52.29224 54.25711 55.00000 54.25711 52.29224 49.74086 47.31720 45.61144 45.00000
#[11] 45.61144 47.31720 49.74086 49.74086
# Now some nice 'circles' on a lonlat plot:
pir = sl.plot.init(projection="lonlat",do.init.device=FALSE)
res = sl.plot.naturalearth(pir,resolution="coarse")
circ = sl.circle(90,-30,40)
sl.plot.lines(pir,circ$lon,circ$lat,col="blue")
circ = sl.circle(-30,70,25)
sl.plot.lines(pir,circ$lon,circ$lat,col="red")
sl.plot.end(pir,do.close.device=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.