2010-06-25 65 views
2

R包可用于计算大圆的最小包围盒?球体上圆的最小包围矩形

例如:

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

这将在指定的坐标(地球上)有35公里,距中心点的半径返回边框为一圈。 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. 

这样的东西应该已经存在于R中,但我找不到它。最近我发现(从SO),我目前transmogrifying到R,是:

http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates

而且,什么字(如果有的话)的圆的最小外接矩形? (中circumscribed对面)

+0

还有这一个:http://stackoverflow.com/questions/1303265/algorithm-for-determining-minimum-bounding-rectangle-for-collection-of-lat-lon-co – 2010-06-25 04:13:34

+0

你可以实现使用bbox ()包'sp'? – 2010-07-02 05:54:55

回答

0

给我:

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

使用polycirc函数生成圆的点,然后minmax对发现的边框:)

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

这是否适用于球体表面的圆形? (穿过两极或第180次子午线?)您将如何使用经纬度? – 2010-06-25 06:31:40

+0

@Dave Jarvis:Oooops ....我没有正确地读你的问题(对不起,早上一早)。不,这需要一些调整。 – nico 2010-06-25 13:46:47

+0

不用担心。我在搜索过程中看到了'polycirc',但打折它(和许多其他类似的R函数)不使用球面。 – 2010-06-25 21:26:52