sedona_build_index: Build an index on a Sedona spatial RDD.

View source: R/spatial_index_op.R

sedona_build_indexR Documentation

Build an index on a Sedona spatial RDD.

Description

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

Usage

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

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 Sept. 11, 2024, 5:24 p.m.