Draws a BAS sample from a SpatialPoints*
object.
bas.point(x, n)
A SpatialPoints or SpatialPointsDataFrame object. This object must contain at least 1 point.
Sample size. Number of points to select from the set of points
contained in x
.
A SpatialPointsDataFrame
containing locations in the BAS sample,
in BAS order.
Attributes of the sample points are:
sampleID
: A unique identifier for every sample point. This
encodes the BAS order. If BAS order is lost, return[
order(
return$sampleID
),]
will resort the
returned object (i.e., return
) into BAS order.
geometryID
: The ID of the point in x
that has been
selected. The
ID of points in x
are row.names(x)
.
Any attributes of the original lines (in x
).
Additional attributes of the output object, beyond those which
make it a SpatialPointsDataFrame
, are:
frame
: Name of the input sampling frame.
frame.type
: Type of resource in sampling frame. (i.e., "point").
sample.type
: Type of sample drawn. (i.e., "BAS").
random.start
: The random seed of the random-start Halton sequence
that produced the sample. This is a vector of length 2 whose elements are
random integers between 0 and maxU
.
This routine ensures that the point
associated with this index
falls inside a polygon of interest. i.e.,
that halton(1,2,random.start)
scaled by a square bounding box
(see attribute bas.bbox
below)
lies inside a polygon of x
.
Note that halton(1,2,random.start+i)
, for
i
> 0, is not guaranteed to fall inside a polygon of x
when scaled by bas.bbox
. The sample consists of the point
associated with random.start
and the next n-1
Halton points in sequence that fall inside a polygon
of x
.
bas.bbox
: The square bounding box surrounding x
used to scale Halton points. A scaled Halton sequence of n points
is bas.bbox[,"min"] +
t(halton(n,2,random.start)) *
rep( max(diff(t(bas.bbox))), 2)
.
The BAS method for points computes the minimum distance between
any two points in
x
and places a small square (pixel) around each. Size of the
square around each point is d/sqrt(2) on a side, where d is the minimum
distance between points. The BAS method for points then selects a BAS sample
from the set of polygons (i.e., squares) surrounding each point (see
bas.polygon
). The BAS method of polygons selects Halton
points until n
points are located inside the squares surrounding the
points. When a square contains a Halton point, the official sample location
is the the original point (center of the square), not the Halton point.
# NOT RUN {
# }
# NOT RUN {
bas.point( WA.cities, 100)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab