Search code examples
rgeometrygreat-circle

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 kilometres 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.)


Solution

  • Given to me:

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