| ddbs_as_format | R Documentation |
Convert spatial geometries to common interchange formats using DuckDB spatial serialization functions.
ddbs_as_text() – Convert geometries to Well-Known Text (WKT)
ddbs_as_wkb() – Convert geometries to Well-Known Binary (WKB)
ddbs_as_hexwkb() – Convert geometries to hexadecimal Well-Known Binary (HEXWKB)
ddbs_as_geojson() – Convert geometries to GeoJSON
ddbs_as_text(x, conn = NULL)
ddbs_as_wkb(x, conn = NULL)
ddbs_as_hexwkb(x, conn = NULL)
ddbs_as_geojson(x, conn = NULL)
x |
Input spatial data. Can be:
Data is returned from this object. |
conn |
A connection object to a DuckDB database. If |
These functions are thin wrappers around DuckDB spatial serialization
functions (ST_AsText, ST_AsWKB, ST_AsHEXWKB, and ST_AsGeoJSON).
They are useful for exporting geometries into widely supported formats for interoperability with external spatial tools, databases, and web services.
Depending on the function:
ddbs_as_text() returns a character vector of WKT geometries
ddbs_as_wkb() returns a list of raw vectors (binary WKB)
ddbs_as_hexwkb() returns a character vector of HEXWKB strings
ddbs_as_geojson() returns a character vector of GeoJSON strings
## Not run:
library(duckspatial)
argentina_ddbs <- ddbs_open_dataset(
system.file("spatial/argentina.geojson", package = "duckspatial")
)
ddbs_as_text(argentina_ddbs)
ddbs_as_wkb(argentina_ddbs)
ddbs_as_hexwkb(argentina_ddbs)
ddbs_as_geojson(argentina_ddbs)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.