sedona_render_heatmap: Visualize a Sedona spatial RDD using a heatmap.

Description Usage Arguments See Also Examples

View source: R/viz.R

Description

Generate a heatmap of geometrical object(s) within a Sedona spatial RDD.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sedona_render_heatmap(
  rdd,
  resolution_x,
  resolution_y,
  output_location,
  output_format = c("png", "gif", "svg"),
  boundary = NULL,
  blur_radius = 10L,
  overlay = NULL,
  browse = interactive()
)

Arguments

rdd

A Sedona spatial RDD.

resolution_x

Resolution on the x-axis.

resolution_y

Resolution on the y-axis.

output_location

Location of the output image. This should be the desired path of the image file excluding extension in its file name.

output_format

File format of the output image. Currently "png", "gif", and "svg" formats are supported (default: "png").

boundary

Only render data within the given rectangular boundary. The 'boundary' parameter can be set to either a numeric vector of c(min_x, max_y, min_y, max_y) values, or with a bounding box object e.g., new_bounding_box(sc, min_x, max_y, min_y, max_y), or NULL (the default). If 'boundary' is NULL, then the minimum bounding box of the input spatial RDD will be computed and used as boundary for rendering.

blur_radius

Controls the radius of a Gaussian blur in the resulting heatmap.

overlay

A viz_op object containing a raster image to be displayed on top of the resulting image.

browse

Whether to open the rendered image in a browser (default: interactive()).

See Also

Other Sedona visualization routines: sedona_render_choropleth_map(), sedona_render_scatter_plot()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
library(sparklyr)
library(sparklyr.sedona)

sc <- spark_connect(master = "spark://HOST:PORT")

if (!inherits(sc, "test_connection")) {
  input_location <- system.file(
    file.path("extdata", "arealm-small.csv"), package = "sparklyr.sedona"
  )
  rdd <- sedona_read_dsv_to_typed_rdd(
    sc,
    location = input_location,
    type = "point"
  )

  sedona_render_heatmap(
    rdd,
    resolution_x = 800,
    resolution_y = 600,
    output_location = tempfile("arealm-small-"),
    output_format = "png",
    boundary = c(-91, -84, 30, 35),
    blur_radius = 10
  )
}

r-spark/sparklyr.sedona documentation built on Dec. 22, 2021, 11:56 a.m.