View source: R/UtilityFunctions.R
prepareTargetDataLegacy | 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.
prepareTargetDataLegacy(
x,
y,
buffer = 0,
shape = "square",
aoi = "",
crs = "",
segments = 60,
returnType = "sf"
)
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 |
Prepare point or polygon data for use when querying to determine the lidar project or tile coverage. Typically this preparation is done by the queryUSGSProjectIndex or queryUSGSTileIndex functions but you can use prepareTargetDataLegacyu to build the query objects so they can be used for other purposes.
Units for buffer
are the same as the horizontal units for the input features
so you shouldn't use data in LON-LAT with units of degrees. In addition, LON-LAT
coordinates are not allowed when working with Spatial* return types and (x,y)
inputs. If you must use LON-LAT coords, set returnType = "sf".
Ideally, you should use a projection for the input (x,y)
or aoi
that
preserves distances and areas so the buffered area is accurate. UTM is a good
choice. Web Mercator does not preserve distance or areas so the actual area produced
when buffering a point varies considerably as you go from mid to northern or
southern latitudes. You can use the computeClipBufferForCONUS
function
to adjust the buffer width depending on the location of (x,y)
or aoi
.
This isn't a perfect solution but it gets you close. More accurate results
can be produced by projecting you (x,y)
or aoi
into UTM, calling
prepareTargetDataLegacy
, then reproject the returned features into the
desired projection.
prepareTargetDataLegacy
is the original version of the prepareTargetData
function in the package. It has been replaced by a new version of the function that
projects features to UTM, applies the buffer, then projects feature back to the
original projection. The new version produces more accurate features. This is
especially true when using point 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 prepareTargetDataLegacy
.
prepareTargetDataLegacy(-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 <- prepareTargetDataLegacy(aoi = x_sf, buffer = 180)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.