View source: R/spatial_index_op.R
sedona_build_index | R Documentation |
Given a Sedona spatial RDD, build the type of index specified on each of its partition(s).
sedona_build_index(
rdd,
type = c("quadtree", "rtree"),
index_spatial_partitions = TRUE
)
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. |
A spatial index object.
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")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.