View source: R/data_interface.R
spark_write_geojson | R Documentation |
Functions to write geospatial data into a variety of formats from Spark DataFrames.
spark_write_geojson
: to GeoJSON
spark_write_geoparquet
: to GeoParquet
spark_write_raster
: to raster tiles after using RS output functions (RS_AsXXX
)
spark_write_geojson(
x,
path,
mode = NULL,
options = list(),
partition_by = NULL,
...
)
spark_write_geoparquet(
x,
path,
mode = NULL,
options = list(),
partition_by = NULL,
...
)
spark_write_raster(
x,
path,
mode = NULL,
options = list(),
partition_by = NULL,
...
)
x |
A Spark DataFrame or dplyr operation |
path |
The path to the file. Needs to be accessible from the cluster. Supports the ‘"hdfs://"’, ‘"s3a://"’ and ‘"file://"’ protocols. |
mode |
A For more details see also https://spark.apache.org/docs/latest/sql-programming-guide.html for your version of Spark. |
options |
A list of strings with additional options. |
partition_by |
A |
... |
Optional arguments; currently unused. |
Other Sedona DF data interface functions:
spark_read_shapefile()
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`")
)
spark_write_geojson(
tbl %>% dplyr::mutate(id = 1),
output_location = "/tmp/pts.geojson"
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.