pointsInPolygon(secr)
pointsInPolygon()所属R语言包:secr
Points Inside Polygon
内多边形点
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Determines which of a set of points lie inside a closed polygon or at least one of a set of polygons
确定的一组点位于一个封闭的多边形内或一组多边形中的至少一个
用法----------Usage----------
pointsInPolygon(xy, poly, logical = TRUE)
参数----------Arguments----------
参数:xy
2-column matrix or dataframe of x-y coordinates for points to assess
2列的矩阵或数据框的XY坐标点,以评估
参数:poly
2-column matrix or dataframe containing perimeter points of polygon, or a SpatialPolygonsDataFrame object from package sp, or a "mask" object
2列的矩阵或数据框含有其周边的点多边形,或SpatialPolygonsDataFrame的套件sp,或“掩模”的对象的对象从
参数:logical
logical to control the output when "poly" is a mask (see Details)
逻辑控制输出时,“聚”是一个面具(见详情)
Details
详细信息----------Details----------
If poly is a SpatialPolygonsDataFrame object then the function overlay is used from sp. This allows multiple polygons and polygons with holes.
如果poly是一个SpatialPolygonsDataFrame的对象,然后使用的功能overlaysp。这允许多个多边形,多边形的孔。
If poly is an secr "mask" object then xy is discretized and matched to the cells in poly. If logical = FALSE then the returned value is a vector of integer indices to the row in "poly" corresponding to each row of "xy"; otherwise the result is a vector of logical values.
如果poly是xy离散匹配的单元在poly秘书服务的面具“对象。如果logical = FALSE然后返回的值是一个向量整数指数在聚的XY的每一行对应的行,否则结果是一个向量,逻辑值。
Otherwise, the algorithm is adapted from some code posted on the S-news list by Peter Perkins (23/7/1996). The polygon should be closed (last point same as first).
否则,该算法是改编自彼得·珀金斯(23/7/1996)S-新闻列表发布一些代码。多边形是封闭的(最后一个点作为第一个相同)。
值----------Value----------
Vector of logical or integer values, one for each row in xy
矢量的逻辑或整数值,每行一个xy
参见----------See Also----------
overlay
overlay
实例----------Examples----------
## 100 random points in unit square[#100个随机点在单位面积]
xy <- matrix(runif(200), ncol = 2)
## triangle centred on (0.5, 0.5)[#三角形中心(0.5,0.5)]
poly <- data.frame(x = c(0.2,0.5,0.8,0.2), y = c(0.2,0.8,0.2,0.2))
plot(xy, pch = 1 + pointsInPolygon(xy, poly))
lines(poly)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|