sedona_save_spatial_rdd {apache.sedona}R Documentation

Save a Spark dataframe containing exactly 1 spatial column into a file.

Description

Export serialized data from a Spark dataframe containing exactly 1 spatial column into a file.

Usage

sedona_save_spatial_rdd(
  x,
  spatial_col,
  output_location,
  output_format = c("wkb", "wkt", "geojson")
)

Arguments

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.

Value

No return value.

See Also

Other Sedona RDD data interface functions: sedona_read_dsv_to_typed_rdd(), sedona_read_geojson(), sedona_read_shapefile_to_typed_rdd(), sedona_write_wkb()

Examples

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"
  )
}


[Package apache.sedona version 1.6.0 Index]