View source: R/UtilityFunctions.R
prepareTargetData | R Documentation |
Prepare features for use when querying a lidar project or tile index to determine
available data coverage. The basic operation done by this function is to apply the
buffer
to the features.
prepareTargetData(
x = NULL,
y = NULL,
buffer = 0,
shape = "square",
aoi = NULL,
crs = "",
segments = 60,
returnType = "sf",
useLegacyBuffering = FALSE
)
x |
Location or list of locations containing the easting for the center of the area-of-interest. |
y |
Location or list of locations containing the northing for the center of the area-of-interest. |
buffer |
Distance or list of distances added or subtracted to |
shape |
Character string describing the shape of the sample area.
Valid values are |
aoi |
|
crs |
Valid |
segments |
Number of segments to use when generating a circular
area of interest. When using a |
returnType |
Character string specifying the object type for the
polygon object returned by |
useLegacyBuffering |
Boolean flag indicating that the |
Prepare point or polygon data for use when querying to determine a lidar project or tile coverage. Typically this function is called by the queryUSGSProjectIndex, queryUSGSTileIndex, or queryMPCTileIndex functions but you can use prepareTargetData to build the query objects so they can be used for other purposes.
Units for buffer
are always meters.
In operation, features are first projected to WGS84 LON-LAT. Then the centroid of all
features is computed and used to determine the UTM zone. Features are
projected to UTM and the buffer is applied. Then the features
are projected back to the original projection (or LON-LAT if applicable). As a result,
the actual shape of the buffered area when providing point features may not
be a perfect circle or square if the original projection does not preserve
distances. If this behavior causes problems, you can specify useLegacyBuffering = TRUE
to any of the query functions to have the buffer applied using the native
projection of the input features.
A set of optionally buffered spatial features. The return type will
be the same as the aoi
type. When (x,y)
is used,
returnType
specifies the object type returned by prepareTargetData
.
prepareTargetData(-13540901, 5806426, 180, shape = "circle",
crs = sp::CRS(SRS_string="EPSG:3857")@projargs)
pt1 <- sf::st_point(c(-13540901, 5806426 + 500))
pt2 <- sf::st_point(c(-13540901 + 500, 5806426 - 500))
pt3 <- sf::st_point(c(-13540901 - 500, 5806426))
pt4 <- sf::st_point(c(-13540901 + 1000, 5806426 - 1000))
id <- c("P1", "P2", "P3", "P4")
x_sf <- sf::st_sf(data.frame(ID = id, stringsAsFactors = FALSE),
geom = sf::st_sfc(pt1, pt2, pt3, pt4),
crs = sp::CRS(SRS_string="EPSG:3857")@projargs)
samples <- prepareTargetData(aoi = x_sf, buffer = 180)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.