| ddbs_locate | R Documentation |
Return the geometries at a specific M values or range of M values.
ddbs_locate_along(
x,
measure,
offset = 0,
conn = NULL,
name = NULL,
mode = NULL,
overwrite = FALSE,
quiet = FALSE
)
ddbs_locate_between(
x,
start_measure,
end_measure,
offset = 0,
conn = NULL,
name = NULL,
mode = NULL,
overwrite = FALSE,
quiet = FALSE
)
x |
Input spatial data. Can be:
Data is returned from this object. |
measure |
A numeric value specifying the M value at which to locate a
point along the geometry. Used only by |
offset |
A numeric value specifying a lateral offset to apply
perpendicular to the line direction at the located point(s). Default is
|
conn |
A connection object to a DuckDB database. If |
name |
A character string of length one specifying the name of the table,
or a character string of length two specifying the schema and table
names. If |
mode |
Character. Controls the return type. Options:
Can be set globally via |
overwrite |
Boolean. whether to overwrite the existing table if it exists. Defaults
to |
quiet |
A logical value. If |
start_measure |
A numeric value specifying the lower bound of the M range. |
end_measure |
A numeric value specifying the upper bound of the M range. |
ddbs_locate_along(): returns a point or multi-point, containing the point(s)
at the geometry with the given measure
ddbs_locate_between(): returns a geometry or geometry collection created by
filtering and interpolating vertices within a range of "M" values
Depends on the mode argument (or global preference set by ddbs_options):
duckspatial (default): A duckspatial_df (lazy spatial data frame) backed by dbplyr/DuckDB.
sf: An eagerly collected object in R memory, that will return the same data type as the
sf equivalent (e.g. sf or units vector).
When name is provided, the result is also written as a table or view in DuckDB and the function returns TRUE (invisibly).
## Not run:
## load package
library(duckspatial)
## read data (must contain M-enabled linestring geometries)
rivers_ddbs <- ddbs_open_dataset(
system.file("spatial/rivers.geojson",
package = "duckspatial")
)
## Calculate the length of the rivers
rivers_agg_ddbs <- rivers_ddbs |>
ddbs_union_agg("RIVER_NAME") |>
ddbs_length()
## Add M dimension to the rivers
rivers_m_ddbs <- rivers_agg_ddbs |>
ddbs_force_3d("length", dim = "M")
## Locate rivers with M between 10000 and 20000
ddbs_locate_between(rivers_m_ddbs, 10000, 20000)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.