2010-06-25 23 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