开发者

Minimum bounding rectangle of a circle on a sphere

What R packages are available to calculate the minimum bounding box for a great circle?

For example:

box <- polycirc( c( longitude, latitude ), distance=35 )

This would return the bounding box for the circle with a radius of 35 kilo开发者_StackOverflow社区metres from the central point at the given coordinates (on Earth). Where:

box.longitude_min = The longitude of the circle's western-most point.
box.longitude_max = The longitude of the circle's eastern-most point.
box.latitude_min = The latitude of the circle's southern-most point.
box.latitude_max = The latitude of the circle's northern-most point.

Something like this should already exist in R, but I cannot find it. The closest I've found (from SO), which I am currently transmogrifying to R, is:

http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates

Also, what is the word (if any) for minimum bounding rectangle of a circle? (The opposite of circumscribed.)


Given to me:

  library( geosphere )
  p <- c( longitude, latitude )
  box <- apply( destPoint( p, c(0, 90, 180, 270), distance ), 2, range )
  print( box )


Use the polycirc function to generate the points of the circle and then min and max to found the bounding box :)

require(pgirmess)
circle <- polycirc(20, c(10, 20))
plot(circle, type = "l")
rect(min(circle[,1]), min(circle[,2]), max(circle[,1]), max(circle[,2]))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜