我有一个shapefile,其中坐标是(我认为)NAD_1983_StatePlane_New_York_Long_Island_FIPS_3104_Feet(请参阅此处的空间参考 )。
我想使用 sf 包读取 shapefile,然后将 MULTIPOLYGON 几何图形转换为纬度/经度坐标。
具体来说,我想转换为:
纽约长岛国家平面投影见:http ://spatialreference.org/ref/esri/102718/
例子:
library(tidyverse)
library(sf)
x<-
structure(list(Borough = "MN", Block = 1L, Lot = 201L, ZipCode = 10004L,
Address = "1 ELLIS ISLAND", UnitsRes = 0L, YearBuilt = 1900L,
XCoord = 972790L, YCoord = 193648L, geometry = structure(list(
structure(list(list(structure(c(973154.711799994, 973733.157600001,
973685.917400002, 973648.663599998, 973648.052399993,
973525.341800004, 973489.243000001, 973434.629199997,
973338.158999994, 973282.610799998, 973265.806400001,
973246.2016, 973221.928200006, 973190.808799997, 973150.042600006,
973064.464000002, 973003.781800002, 973005.960199997,
972911.979800001, 972812.709000006, 972728.686399996,
972671.738399997, 972693.988600001, 972697.255999997,
973180.850199997, 973178.983400002, 973156.266399994,
973078.467999995, 972940.609200001, 972792.169799998,
972726.197400004, 972696.944999993, 972695.077199996,
972499.959600002, 972248.203799993, 972136.797000006,
972147.688600004, 972141.775800005, 972405.979200006,
972333.160400003, 972499.959600002, 972676.084199995,
972860.2456, 972904.511000007, 972936.564400002, 972963.794,
973154.711799994, 194614.331599995, 194006.278799996,
193958.042199999, 193712.475600004, 193711.894199997,
193713.444399998, 193713.755799994, 193713.755799994,
193619.152199998, 193672.832800001, 193687.926599994,
193707.220599994, 193730.870800003, 193761.989800006,
193801.512400001, 193885.534199998, 193945.282800004,
193949.0176, 194040.508599997, 194138.845400006, 194053.889799997,
193996.007799998, 193973.445800006, 193970.179000005,
193471.335999995, 193469.468199998, 193449.708000004,
193380.777600005, 193251.3222, 193107.862000003, 193043.755999997,
193014.815200001, 193016.3706, 193216.468199998, 193474.136399999,
193588.033199996, 193598.302200004, 193603.904200003,
193869.974000007, 193941.548800007, 194116.750200003,
194301.772200003, 194476.966399997, 194434.790399998,
194403.671399996, 194430.277799994, 194614.331599995), .Dim = c(47L,
2L)))), class = c("XY", "MULTIPOLYGON", "sfg"))), n_empty = 0L, crs = structure(list(
epsg = 4326L, proj4string = "+proj=longlat +datum=WGS84 +no_defs"), .Names = c("epsg",
"proj4string"), class = "crs"), class = c("sfc_MULTIPOLYGON",
"sfc"), precision = 0, bbox = structure(c(972136.797000006,
193014.815200001, 973733.157600001, 194614.331599995), .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")))), .Names = c("Borough",
"Block", "Lot", "ZipCode", "Address", "UnitsRes", "YearBuilt",
"XCoord", "YCoord", "geometry"), 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("Borough",
"Block", "Lot", "ZipCode", "Address", "UnitsRes", "YearBuilt",
"XCoord", "YCoord"), .Label = c("constant", "aggregate", "identity"
), class = "factor"), row.names = 1L, class = c("sf", "data.frame"
))
class(x)
[1] "sf" "data.frame"
不工作:
st_transform(select(x,geometry),4326)
Simple feature collection with 1 feature and 0 fields
geometry type: MULTIPOLYGON
dimension: XY
bbox: xmin: 972136.8 ymin: 193014.8 xmax: 973733.2 ymax: 194614.3
epsg (SRID): 4326
proj4string: +proj=longlat +datum=WGS84 +no_defs
geometry
1 MULTIPOLYGON(((973154.71179...