将 sf table 中的不同点投影到不同的 UTM 投影中(使用 R)?

Projecting different points in an sf table into different UTM projections (using R)?

我在 R 中的 sf 对象中有多个点,称为 pixel.zones,我在下面包含了一个示例。实际文件有超过 100,000 个点,但我将在此处包括 2 个以保存 space :) table 中的每个项目都有一列指定所需的点投影(我在一个大区域,因此不同的点位于不同的 UTM 区域)。我想将每个点的坐标重新投影到相应的 UTM 带中。

我知道 sfst_transform(),但我不确定如何使 sf 对象中的不同点具有不同的投影。任何帮助都会很棒,最好使用 sf,但如果需要,我可以将任何内容更改为 sp

pixel.zones=structure(list(id = c("1", "1"), system.index = c(1L, 3534L), 
    b2_allPix = c(6206L, 1524L), b2_cloudfilt_strong = c(6206L, 
    1524L), b2_cloudfilt_weak = c(6206L, 1524L), system.time_start = c(954547200000, 
    954547200000), .geo = c(NA, NA), zone.num = c(7, 6), zone.espg = c(26907, 
    26906), geometry = structure(list(`1` = structure(c(-142.326683967925, 
    67.144791660576), class = c("XY", "POINT", "sfg")), `2` = structure(c(-147.528084912676, 
    66.2989583273184), class = c("XY", "POINT", "sfg"))), .Names = c("1", 
    "2"), class = c("sfc_POINT", "sfc"), precision = 0, bbox = structure(c(-147.528084912676, 
    66.2989583273184, -142.326683967925, 67.144791660576), .Names = c("xmin", 
    "ymin", "xmax", "ymax"), class = "bbox"), crs = structure(list(
        epsg = 4326L, proj4string = "+proj=longlat +datum=WGS84 +no_defs"), .Names = c("epsg", 
    "proj4string"), class = "crs"), n_empty = 0L)), .Names = c("id", 
"system.index", "b2_allPix", "b2_cloudfilt_strong", "b2_cloudfilt_weak", 
"system.time_start", ".geo", "zone.num", "zone.espg", "geometry"
), row.names = c(NA, -2L), class = c("sf", "tbl_df", "tbl", "data.frame"
), sf_column = "geometry", agr = structure(c(NA_integer_, NA_integer_, 
NA_integer_, NA_integer_, NA_integer_, NA_integer_, NA_integer_, 
NA_integer_, NA_integer_), .Names = c("id", "system.index", "b2_allPix", 
"b2_cloudfilt_strong", "b2_cloudfilt_weak", "system.time_start", 
".geo", "zone.num", "zone.espg"), .Label = c("constant", "aggregate", 
"identity"), class = "factor"))

或许可以拆分数据框,然后根据不同的EPSG编码进行相应的变换。

library(tidyverse)
library(sf)

pixel.zones_list <- pixel.zones %>%
  split(f = .$zone.espg) %>%
  map(~st_transform(., crs = unique(.$zone.espg)))