sedona_build_index: Build an index on a Sedona spatial RDD.

Description Usage Arguments Value Examples

View source: R/spatial_index_op.R

Description

Given a Sedona spatial RDD, build the type of index specified on each of its partition(s).

Usage

1
2
3
4
5
sedona_build_index(
  rdd,
  type = c("quadtree", "rtree"),
  index_spatial_partitions = TRUE
)

Arguments

rdd

The spatial RDD to be indexed.

type

The type of index to build. Currently "quadtree" and "rtree" are supported.

index_spatial_partitions

If the RDD is already partitioned using a spatial partitioner, then index each spatial partition within the RDD instead of partitions within the raw RDD associated with the underlying spatial data source. Default: TRUE. Notice this option is irrelevant if the input RDD has not been partitioned using with a spatial partitioner yet.

Value

A spatial index object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
library(sparklyr)
library(apache.sedona)

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

if (!inherits(sc, "test_connection")) {
  input_location <- "/dev/null" # replace it with the path to your input file
  rdd <- sedona_read_shapefile_to_typed_rdd(
    sc,
    location = input_location,
    type = "polygon"
  )
  sedona_build_index(rdd, type = "rtree")
}

apache.sedona documentation built on Oct. 11, 2021, 9:06 a.m.