crs_transform: Perform a CRS transformation.

View source: R/spatial_rdd.R

crs_transformR Documentation

Perform a CRS transformation.

Description

Transform data within a spatial RDD from one coordinate reference system to another. This uses the lon/lat order since v1.5.0. Before, it used lat/lon

Usage

crs_transform(x, src_epsg_crs_code, dst_epsg_crs_code, strict = FALSE)

Arguments

x

The spatial RDD to be processed.

src_epsg_crs_code

Coordinate reference system to transform from (e.g., "epsg:4326", "epsg:3857", etc).

dst_epsg_crs_code

Coordinate reference system to transform to. (e.g., "epsg:4326", "epsg:3857", etc).

strict

If FALSE (default), then ignore the "Bursa-Wolf Parameters Required" error.

Value

The transformed SpatialRDD.

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_geojson_to_typed_rdd(
    sc,
    location = input_location, type = "polygon"
  )
  crs_transform(
    rdd,
    src_epsg_crs_code = "epsg:4326", dst_epsg_crs_code = "epsg:3857"
  )
}


apache.sedona documentation built on Oct. 12, 2023, 5:11 p.m.