View source: R/data_interface.R
sedona_save_spatial_rdd | R Documentation |
Export serialized data from a Spark dataframe containing exactly 1 spatial column into a file.
sedona_save_spatial_rdd(
x,
spatial_col,
output_location,
output_format = c("wkb", "wkt", "geojson")
)
x |
A Spark dataframe object in sparklyr or a dplyr expression representing a Spark SQL query. |
spatial_col |
The name of the spatial column. |
output_location |
Location of the output file. |
output_format |
Format of the output. |
No return value.
Other Sedona RDD data interface functions:
sedona_read_dsv_to_typed_rdd()
,
sedona_read_geojson()
,
sedona_read_shapefile_to_typed_rdd()
,
sedona_write_wkb()
library(sparklyr)
library(apache.sedona)
sc <- spark_connect(master = "spark://HOST:PORT")
if (!inherits(sc, "test_connection")) {
tbl <- dplyr::tbl(
sc,
dplyr::sql("SELECT ST_GeomFromText('POINT(-71.064544 42.28787)') AS `pt`")
)
sedona_save_spatial_rdd(
tbl %>% dplyr::mutate(id = 1),
spatial_col = "pt",
output_location = "/tmp/pts.wkb",
output_format = "wkb"
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.