如何计算领海水域?

时间:2016-02-24 09:45:05

标签: r polygon spatial

在图像中有两个彼此非常接近的岛屿。我正试图计算两个岛屿的领海。然而,由于岛屿非常接近,我使用的方法不起作用。到目前为止,这就是我所做的

require(rgeos)
x.buf <- gBuffer(x,capStyle="ROUND",joinStyle="ROUND",width=c(0.11112))
y.buf <- gBuffer(y,capStyle="ROUND",joinStyle="ROUND",width=c(0.11112))
int <- gIntersection(x.buf,y.buf)
diff_y<- gDifference(y.buf,int)
diff_x <- gDifference(x,int)

poly<- slot(x,"polygons")
polys <- poly[[1]]@Polygons 
coords <- do.call("rbind", lapply(polys, function(x) x@coords ))
coords <- as.data.frame(coords)
coordinates(coords) <- coords

# LOOP USING gDistance, DISTANCES STORED IN LIST OBJECT
Fdist <- list()
for(i in 1:dim(coords)[1]) {
  pDist <- vector()
  for(j in 1:dim(y)[1]) { 
    pDist <- append(pDist, gDistance(coords[i,],y[j,])) }
  Fdist[[i]] <- pDist
} 

## getting the min distances           
min.dist<- unlist(lapply(Fdist, FUN=function(x) min(x)))
verbose <- min.dist <= 0.11112 * 2 ## checking if greater than distance limit
min.dist[!verbose] <- 0.11112 ## if greater take the limit for buffering
min.dist[verbose] <- min.dist[verbose] /2 ## if not, take the half of it
buffered_x <- list()
for (i in 1:length(coords)){
  buffered_x[i] <- gBuffer(coords[i,],capStyle="ROUND",joinStyle="ROUND",
                             width=min.dist[i])
   }

    united_x <- gUnion(buffered_x[[1]],buffered_x[[2]])
for (i in 1:length(buffered_x)-1){
  united_x <-gUnion(united_x,buffered_x[[i+1]])  
}

然后我为y做了同样的事情

plot(y.buf, col="sky blue")
plot(x.buf, col="yellow",add=T)
plot(gUnion(united_x, diff_x), col="purple",add=T)
plot(gUnion(united_y, diff_y ), col="green",add=T)
plot(test_map3, col= c("red","blue")[test_map3$sovereignt],add=T )

plot

因此,根据划分,黄色区域应为绿色和紫色。但我无法弄清楚如何公平地划分这些领海。你能帮帮我吗?提前谢谢。

0 个答案:

没有答案