gpt4 book ai didi

r - R : no applicable method for 'st_centroid' applied to an object of class "NULL" 错误

转载 作者:行者123 更新时间:2023-12-02 01:04:48 25 4
gpt4 key购买 nike

编辑:我后来意识到错误出在我的完整数据集中,而不是代码中。我很抱歉。这可能对其他任何人有用,也可能没有用。

我有一个 tibble,有一个名为“几何”的列,它是多边形(我使用的是 sf 空间包)。我正在尝试向作为每个多边形质心的 tibble 添加一列。但是,我收到一个错误:“mutate_impl(.data, dots) 中的错误: 评估错误:'st_centroid' 没有适用的方法应用于类“NULL”的对象。”我看过其他一些关于类似主题的帖子,但不太相似,我无法弄清楚。如果我错过了什么,我道歉!

我刚开始使用管道和 tidyverse,所以可能那里出了问题。任何帮助将不胜感激!

这是我的代码示例:

center1 = function(df){
质心 = st_centroid(df)
}

表 2 = x %>%
变异(center.1 =map(几何,center1))

这是我的数据的一个非常小的样本(只有一行)——代码中的变量 x(抱歉太长了!):我有 tidyverse、tibble、dplyr、purrr 和sf 加载。

x=structure(list(segnum = 428, system.time_start = 951350400000, 
data = list(structure(list(id = c("1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1"), system.index = c(22L,
23L, 188L, 189L, 355L, 520L, 687L, 854L, 855L, 1022L, 1023L,
1187L, 1348L, 1349L, 1508L, 1509L, 1664L, 1665L, 1817L, 1818L,
1967L, 1968L, 23672L, 23673L, 23674L, 23821L, 23822L, 23823L,
23970L, 23974L, 24118L, 24119L, 24120L, 24121L, 24266L, 24267L,
24268L, 24416L, 24417L, 24418L, 24567L, 24568L, 24569L, 24721L,
24722L, 24875L, 24876L, 24877L, 24878L, 25033L, 25034L, 25035L,
25190L, 25192L, 25193L, 25194L, 25195L, 25349L, 25351L, 25352L,
25353L, 25354L, 25510L, 25511L, 25514L, 25515L, 25516L, 25676L,
25677L, 25835L, 25839L, 25840L, 25841L, 25842L, 26002L, 26004L,
26005L, 26167L, 26168L, 26169L, 26332L, 26499L, 26500L, 26665L,
26832L, 26999L, 27165L, 27166L, 27167L, 27334L, 27335L, 27489L,
27490L, 27491L, 27492L, 27493L, 27494L, 27495L, 27496L, 27499L,
27500L, 27501L, 27502L, 27656L, 27657L, 27658L, 27659L, 27660L,
27661L, 27662L, 27663L, 27664L, 27665L, 27666L, 27667L, 27668L,
27669L, 27670L, 27823L, 27824L, 27832L, 27833L, 27834L),
b2_allPix = c(5705L, 5705L, 6080L, 6193L, 6707L, 6874L,
6874L, 5134L, 6874L, 5134L, 5134L, 4408L, 5658L, 4408L,
5658L, 5658L, 6077L, 5658L, 7352L, 6331L, 6312L, 4065L,
4640L, 5626L, 5626L, 4609L, 4609L, 4609L, 4561L, 4733L,
5211L, 5211L, 5513L, 4475L, 4675L, 5076L, 5764L, 5000L,
6284L, 3369L, 6669L, 5270L, 5270L, 7251L, 5270L, 6871L,
7251L, 4698L, 3321L, 6871L, 7276L, 5697L, 5018L, 6871L,
7276L, 7276L, 5697L, 5369L, 7082L, 7283L, 6991L, 6991L,
4657L, 5062L, 7342L, 5032L, 6991L, 5676L, 7120L, 3686L,
5421L, 5929L, 5945L, 5945L, 5366L, 5929L, 5634L, 5366L,
5366L, 5100L, 5664L, 5664L, 5013L, 6012L, 6012L, 6145L,
5628L, 5861L, 5861L, 6468L, 3531L, 5505L, 5505L, 5276L,
6539L, 6104L, 5905L, 5905L, 5355L, 4593L, 4593L, 5143L,
4956L, 5681L, 5505L, 5505L, 4405L, 6539L, 6539L, 6104L,
6104L, 5355L, 4509L, 4509L, 4305L, 4305L, 4309L, 3125L,
5681L, 5681L, 4262L, 4024L, 4024L), b2_cloudfilt = c(5705L,
5705L, 6080L, 6193L, 6707L, 6874L, 6874L, 5134L, 6874L,
5134L, 5134L, 4408L, 5658L, 4408L, 5658L, 5658L, 6077L,
5658L, 7352L, 6331L, 6312L, 4065L, 4640L, 5626L, 5626L,
4609L, 4609L, 4609L, 4561L, 4733L, 5211L, 5211L, 5513L,
4475L, 4675L, 5076L, 5764L, NA, 6284L, 3369L, NA, NA,
NA, 7251L, 5270L, 6871L, 7251L, 4698L, 3321L, 6871L,
7276L, 5697L, 5018L, 6871L, 7276L, 7276L, 5697L, 5369L,
7082L, 7283L, 6991L, 6991L, 4657L, 5062L, 7342L, 5032L,
6991L, 5676L, 7120L, 3686L, 5421L, 5929L, 5945L, 5945L,
5366L, 5929L, 5634L, 5366L, 5366L, 5100L, 5664L, 5664L,
5013L, 6012L, 6012L, 6145L, 5628L, 5861L, 5861L, 6468L,
3531L, 5505L, 5505L, 5276L, 6539L, 6104L, 5905L, 5905L,
5355L, 4593L, 4593L, 5143L, 4956L, 5681L, 5505L, 5505L,
4405L, 6539L, 6539L, 6104L, 6104L, 5355L, 4509L, 4509L,
4305L, 4305L, 4309L, 3125L, 5681L, 5681L, 4262L, 4024L,
4024L), .geo = c(NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA)), .Names = c("id", "system.index", "b2_allPix",
"b2_cloudfilt", ".geo"), row.names = c(NA, -123L), class = c("tbl_df",
"tbl", "data.frame"))), meanSR = 0.55649243697479, cloud.pct = 3.2520325203252,
id = structure(366L, .Label = c("1", "10", "100", "101",
"102", "103", "104", "105", "106", "107", "108", "109", "11",
"110", "111", "112", "113", "114", "115", "116", "117", "118",
"119", "12", "120", "121", "122", "123", "124", "125", "126",
"127", "128", "129", "13", "130", "131", "132", "133", "134",
"135", "136", "137", "138", "139", "14", "140", "141", "142",
"143", "144", "145", "146", "147", "148", "149", "15", "150",
"151", "152", "153", "154", "155", "156", "157", "158", "159",
"16", "160", "161", "162", "163", "164", "165", "166", "167",
"168", "169", "17", "170", "171", "172", "173", "174", "175",
"176", "177", "178", "179", "18", "180", "181", "182", "183",
"184", "185", "186", "187", "188", "189", "19", "190", "191",
"192", "193", "194", "195", "196", "197", "198", "199", "2",
"20", "200", "201", "202", "203", "204", "205", "206", "207",
"208", "209", "21", "210", "211", "212", "213", "214", "215",
"216", "217", "218", "219", "22", "220", "221", "222", "223",
"224", "225", "226", "227", "228", "229", "23", "230", "231",
"232", "233", "234", "235", "236", "237", "238", "239", "24",
"240", "241", "242", "243", "244", "245", "246", "247", "248",
"249", "25", "250", "251", "252", "253", "254", "255", "256",
"257", "258", "259", "26", "260", "261", "262", "263", "264",
"265", "266", "267", "268", "269", "27", "270", "271", "272",
"273", "274", "275", "276", "277", "278", "279", "28", "280",
"281", "282", "283", "284", "285", "286", "287", "288", "289",
"29", "290", "291", "292", "293", "294", "295", "296", "297",
"298", "299", "3", "30", "300", "301", "302", "303", "304",
"305", "306", "307", "308", "309", "31", "310", "311", "312",
"313", "314", "315", "316", "317", "318", "319", "32", "320",
"321", "322", "323", "324", "325", "326", "327", "328", "329",
"33", "330", "331", "332", "333", "334", "335", "336", "337",
"338", "339", "34", "340", "341", "342", "343", "344", "345",
"346", "347", "348", "349", "35", "350", "351", "352", "353",
"354", "355", "356", "357", "358", "359", "36", "360", "361",
"362", "363", "364", "365", "366", "367", "368", "369", "37",
"370", "371", "372", "373", "374", "375", "376", "377", "378",
"379", "38", "380", "381", "382", "383", "384", "385", "386",
"387", "388", "389", "39", "390", "391", "392", "393", "394",
"395", "396", "397", "398", "399", "4", "40", "400", "401",
"402", "403", "404", "405", "406", "407", "408", "409", "41",
"410", "411", "412", "413", "414", "415", "416", "417", "418",
"419", "42", "420", "421", "422", "423", "424", "425", "426",
"427", "428", "429", "43", "430", "431", "432", "433", "434",
"435", "436", "437", "438", "439", "44", "440", "441", "442",
"443", "444", "445", "446", "447", "448", "449", "45", "450",
"451", "452", "453", "454", "455", "456", "457", "458", "459",
"46", "460", "461", "462", "463", "464", "465", "466", "467",
"468", "469", "47", "470", "471", "472", "473", "474", "475",
"476", "477", "478", "479", "48", "480", "481", "482", "483",
"484", "485", "486", "487", "488", "489", "49", "490", "491",
"492", "493", "494", "495", "496", "497", "498", "499", "5",
"50", "500", "501", "502", "503", "504", "505", "506", "507",
"508", "509", "51", "510", "52", "53", "54", "55", "56",
"57", "58", "59", "6", "60", "61", "62", "63", "64", "65",
"66", "67", "68", "69", "7", "70", "71", "72", "73", "74",
"75", "76", "77", "78", "79", "8", "80", "81", "82", "83",
"84", "85", "86", "87", "88", "89", "9", "90", "91", "92",
"93", "94", "95", "96", "97", "98", "99"), class = "factor"),
geometry = structure(list(structure(list(structure(c(-2051264.75646429,
-2051024.48251152, -2051002.4414958, -2050977.59957488, -2050950.0334937,
-2050919.82841309, -2050426.63350973, -2050396.61394621,
-2050364.5207699, -2050330.43779493, -2050294.45403195, -2050256.66345569,
-2050217.16475952, -2050176.06109772, -2050133.45981607,
-2050089.47217153, -2050044.21304165, -2049997.80062458,
-2049477.28908854, -2048956.81814038, -2048910.06551106,
-2048862.42850701, -2048814.02798539, -2048764.98674045,
-2048715.42919199, -2048665.48106967, -2048615.26909408,
-2048564.92065519, -2048514.56348921, -2048245.84158915,
-2047977.12450694, -2047925.85639021, -2047874.84750678,
-2047824.2326378, -2047774.14552334, -2047724.71850899, -2047676.08219613,
-2047628.36509687, -2047581.69329448, -2047536.19011024,
-2047270.00730069, -2047003.81369106, -2046957.64763031,
-2046913.02148835, -2046870.0639856, -2046828.89902943, -2046789.64535677,
-2046752.41619159, -2046717.31891835, -2046684.45477224,
-2046653.91854718, -2046625.79832239, -2046476.28373961,
-2046454.19081583, -2046433.86652631, -2046196.23903498,
-2046068.15092823, -2046057.83521707, -2046019.21194622,
-2046003.77008064, -2045984.90510096, -2045962.68442177,
-2045640.22775462, -2045618.16478878, -2045593.66839789,
-2045566.80520336, -2045537.64826347, -2045506.27687464,
-2045472.77635583, -2045437.23781645, -2045399.75790861,
-2045360.43856422, -2044829.84163188, -2044679.25007272,
-2044675.22043016, -2044664.75025173, -2044651.57155634,
-2044635.72097256, -2044617.24255515, -2044520.42728011,
-2044498.931641, -2044474.81905145, -2044448.15919821, -2044419.02912975,
-2044387.51303362, -2044353.7019931, -2044317.693724, -2044279.59229225,
-2044239.50781313, -2044197.55613305, -2043749.94028576,
-2043713.70139376, -2043676.32637413, -2043637.89000017,
-2043180.14614949, -2043135.10232982, -2043088.89475354,
-2043041.64371266, -2042993.47221566, -2042944.5056672, -2042469.06283627,
-2041993.71141051, -2041651.30857901, -2041600.37452923,
-2041548.87649229, -2041496.95562071, -2041444.75422601,
-2041392.41538857, -2041340.08256551, -2041287.89919747,
-2041236.00831542, -2041184.55214867, -2041133.67173499,
-2041083.50653407, -2041034.19404522, -2040985.86943056,
-2040938.6651445, -2040892.71057069, -2040848.13166744, -2040805.05062241,
-2040763.58551777, -2040723.85000647, -2040685.9530008, -2040649.9983738,
-2040616.08467462, -2040584.30485835, -2040554.74603125,
-2040527.48921202, -2040502.6091097, -2040480.17391891, -2040460.24513297,
-2040442.87737529, -2040428.11824969, -2040416.00820989,
-2040406.58044868, -2040399.86080691, -2040395.86770263,
-2040394.61208067, -2040396.0973826, -2040400.31953731, -2040407.26697218,
-2040416.92064475, -2040429.254095, -2040444.23351779, -2040461.81785556,
-2040481.95891086, -2040504.60147847, -2040529.68349667,
-2040557.1362174, -2040586.88439467, -2040618.84649077, -2040652.93489984,
-2040689.05618791, -2040727.11134904, -2040766.99607668,
-2040808.60104956, -2040851.81223135, -2040896.51118319,
-2040942.57538838, -2040989.87858812, -2041038.29112763,
-2041087.6803115, -2041137.91076743, -2041480.37455016, -2041955.97970451,
-2042307.65750954, -2042595.23829723, -2042662.4009034, -2042662.22017707,
-2042664.13824425, -2042668.65738499, -2042675.7658212, -2042685.44502646,
-2042697.66977421, -2042712.40820357, -2042729.62190232,
-2042749.26600707, -2042771.28932013, -2042795.63444298,
-2042822.23792587, -2042851.03043314, -2042881.93692399,
-2042914.87684801, -2042949.76435513, -2042986.50851938,
-2043025.01357585, -2043555.62409379, -2043902.05831151,
-2044093.13391842, -2044233.12596013, -2044246.04229349,
-2044261.44221829, -2044279.28591176, -2044299.52723178,
-2044322.11383618, -2044346.9873181, -2044374.08335705, -2044403.3318852,
-2044434.65726857, -2044467.97850265, -2044503.20942184,
-2044540.25892226, -2044579.03119738, -2044619.42598568,
-2044991.64319953, -2045034.72922216, -2045079.30030591,
-2045125.23476847, -2045172.40720536, -2045220.68883237,
-2045269.94783711, -2045320.04973886, -2045370.85775576,
-2045704.9303356, -2045754.24974523, -2045803.96812463, -2045853.96033723,
-2045904.10055722, -2045954.2625863, -2046004.32017126, -2046054.14732177,
-2046103.61862749, -2046152.60957369, -2046200.99685469,
-2046484.29791654, -2046767.67035456, -2046816.16994679,
-2046863.79146971, -2046910.41077109, -2046955.90631158,
-2047000.15948152, -2047237.85603285, -2047475.60110901,
-2047713.33591387, -2047755.23123925, -2047795.7277542, -2047834.72480793,
-2047872.12547641, -2047907.83680332, -2047941.77003105,
-2047973.84082131, -2048003.96946477, -2048032.08107911,
-2048058.10579521, -2048207.6678615, -2048219.49631208, -2048245.45837976,
-2048306.10505101, -2048339.56105399, -2048378.0029585, -2048686.68727485,
-2048942.17522404, -2049208.53041711, -2049443.20864497,
-2049464.43260621, -2049488.26772432, -2049514.64541491,
-2049543.48977743, -2049574.71781362, -2049608.23966631,
-2049643.95887798, -2049681.77266833, -2049721.57222999,
-2049731.44629626, -2049772.09530851, -2049814.41537275,
-2049858.29049264, -2049903.60040951, -2049950.22093204,
-2049998.02427661, -2050046.87941758, -2050096.65244641,
-2050147.20693868, -2050198.40432803, -2050250.104286, -2050302.16510658,
-2050354.44409469, -2050406.79795725, -2050459.08319596,
-2050511.15650062, -2050562.87514193, -2050614.09736267,
-2050664.6827663, -2050714.49270176, -2050763.39064346, -2050811.24256555,
-2050857.91730923, -2050903.28694228, -2050947.22710969,
-2050989.61737451, -2051030.34154797, -2051069.28800795,
-2051106.3500049, -2051141.42595447, -2051174.41971592, -2051205.24085563,
-2051233.80489502, -2051260.03354202, -2051283.85490575,
-2051305.20369351, -2051324.02138974, -2051340.25641645,
-2051353.86427457, -2051364.80766589, -2051373.05659534,
-2051378.58845319, -2051381.38807699, -2051381.44779317,
-2051378.76743805, -2051373.35435829, -2051365.22339079,
-2051354.39682194, -2051340.90432662, -2051324.78288683,
-2051306.07669031, -2051284.83700944, -2051264.75646429,
3507767.74863639, 3508369.38225694, 3508420.40702135, 3508470.12836406,
3508518.3926793, 3508565.05086252, 3509282.37787564, 3509323.73501202,
3509363.50453499, 3509401.58258301, 3509437.86971193, 3509472.27115476,
3509504.69706915, 3509535.06277201, 3509563.28896065, 3509589.30191994,
3509613.03371476, 3509634.42236749, 3509858.35231876, 3510082.36270855,
3510101.10398687, 3510117.46735163, 3510131.41128827, 3510142.90042039,
3510151.90559957, 3510158.40397927, 3510162.37907282, 3510163.82079523,
3510162.72548879, 3510150.10388395, 3510137.503199, 3510133.77652814,
3510127.42029668, 3510118.45129973, 3510106.89323615, 3510092.7766459,
3510076.13882936, 3510057.02374876, 3510035.48191203, 3510011.57023932,
3509862.83959529, 3509714.12926924, 3509686.686377, 3509656.8045271,
3509624.56991128, 3509590.07550762, 3509553.42081239, 3509514.71155303,
3509474.05938321, 3509431.58156075, 3509387.40060944, 3509341.64396557,
3509083.0365321, 3509044.83118134, 3509032.42839277, 3508887.43995111,
3508809.2990829, 3508806.19313255, 3508970.12599247, 3509027.87614462,
3509084.60042361, 3509140.09612346, 3509880.48891173, 3509927.74213903,
3509973.78091383, 3510018.48002715, 3510061.71791341, 3510103.37698102,
3510143.34393226, 3510181.51007132, 3510217.77159996, 3510252.02989982,
3510690.52476793, 3510815.00951441, 3510842.18607523, 3510893.85572673,
3510944.90177956, 3510995.18235748, 3511044.55771178, 3511283.84077009,
3511333.11544703, 3511381.16374892, 3511427.84681345, 3511473.02972394,
3511516.58189923, 3511558.3774711, 3511598.29564798, 3511636.22106409,
3511672.04411285, 3511705.66126363, 3512045.00144965, 3512071.21909451,
3512095.79001438, 3512118.66505214, 3512377.40266854, 3512401.36828343,
3512423.00520283, 3512442.25709944, 3512459.07385487, 3512473.41169012,
3512599.54988398, 3512725.73843943, 3512816.68020058, 3512828.79024037,
3512838.21800158, 3512844.93764336, 3512848.93074764, 3512850.1863696,
3512848.70106767, 3512844.47891295, 3512837.53147809, 3512827.87780551,
3512815.54435526, 3512800.56493247, 3512782.9805947, 3512762.8395394,
3512740.1969718, 3512715.11495359, 3512687.66223286, 3512657.9140556,
3512625.95195949, 3512591.86355042, 3512555.74226235, 3512517.68710122,
3512477.80237358, 3512436.1974007, 3512392.98621891, 3512348.28726707,
3512302.22306188, 3512254.91986215, 3512206.50732264, 3512157.11813876,
3512106.88768284, 3512055.95363306, 3512004.45559611, 3511952.53472453,
3511900.33332983, 3511847.99449239, 3511795.66166933, 3511743.47830129,
3511691.58741924, 3511640.13125249, 3511589.25083882, 3511539.08563789,
3511489.77314905, 3511441.44853439, 3511394.24424832, 3511348.28967451,
3511303.71077126, 3511260.62972624, 3511219.16462159, 3511179.42911029,
3511141.53210462, 3511105.57747763, 3511071.66377845, 3511039.88396217,
3511010.32513508, 3510983.06831584, 3510958.18821352, 3510935.75302274,
3510915.8242368, 3510898.45647912, 3510883.69735351, 3510792.73940379,
3510666.48348438, 3510573.18097659, 3510410.62725267, 3510359.71088898,
3510346.30180244, 3510295.28628702, 3510244.43513991, 3510193.8808925,
3510143.75530242, 3510094.18901006, 3510045.31119817, 3509997.2492551,
3509950.12844288, 3509904.07157067, 3509859.19867475, 3509815.62670561,
3509773.46922323, 3509732.83610104, 3509693.83323959, 3509656.56229055,
3509621.12039177, 3509587.59991412, 3509148.97695164, 3508862.67745905,
3508423.94873738, 3507829.76561245, 3507780.58151901, 3507732.11762492,
3507684.49925328, 3507637.84954076, 3507592.28911916, 3507547.93580348,
3507504.90428726, 3507463.30584599, 3507423.24804936, 3507384.83448309,
3507348.16448108, 3507313.33286853, 3507280.42971674, 3507249.54011021,
3506979.62494181, 3506950.06706332, 3506922.80001327, 3506897.89823269,
3506875.42970528, 3506855.45577178, 3506838.03096249, 3506823.20284842,
3506811.01191141, 3506740.02987751, 3506730.83728866, 3506724.12978497,
3506719.92424862, 3506718.23126455, 3506719.05509384, 3506722.393663,
3506728.23856915, 3506736.5751012, 3506747.38227687, 3506760.6328955,
3506845.90812962, 3506931.22853819, 3506947.19258148, 3506965.61136752,
3506986.43687742, 3507009.61481779, 3507035.08476234, 3507180.09287715,
3507325.15306044, 3507470.229446, 3507497.25167022, 3507526.3283132,
3507557.38710731, 3507590.35085843, 3507625.13763783, 3507661.66098579,
3507699.83012649, 3507739.55019364, 3507780.72246622, 3507823.2446139,
3508081.88268562, 3508102.34172097, 3508116.84555356, 3508150.73210552,
3508152.30092485, 3508154.10650055, 3508021.24895246, 3507911.33513271,
3507523.93499175, 3506936.3127786, 3506887.04823446, 3506838.99265221,
3506792.28430949, 3506747.0576073, 3506703.44268329, 3506661.56503732,
3506621.54517028, 3506583.49823743, 3506547.53371697, 3506539.0809705,
3506506.08720906, 3506475.26606934, 3506446.70202996, 3506420.47338295,
3506396.65201922, 3506375.30323147, 3506356.48553524, 3506340.25050852,
3506326.64265041, 3506315.69925909, 3506307.45032963, 3506301.91847179,
3506299.11884799, 3506299.05913181, 3506301.73948693, 3506307.15256668,
3506315.28353419, 3506326.11010304, 3506339.60259835, 3506355.72403815,
3506374.43023467, 3506395.66991553, 3506419.38486425, 3506445.51007981,
3506473.97395479, 3506504.6984717, 3506537.59941677, 3506572.5866108,
3506609.56415632, 3506648.43070045, 3506689.0797127, 3506731.39977694,
3506775.27489683, 3506820.5848137, 3506867.20533623, 3506915.0086808,
3506963.86382177, 3507013.6368506, 3507064.19134287, 3507115.38873222,
3507167.08869019, 3507219.14951077, 3507271.42849888, 3507323.78236144,
3507376.06760015, 3507428.14090481, 3507479.85954612, 3507531.08176686,
3507581.66717049, 3507631.47710595, 3507680.37504765, 3507728.22696974,
3507767.74863639), .Dim = c(317L, 2L))), class = c("XY",
"POLYGON", "sfg"))), class = c("sfc_POLYGON", "sfc"), precision = 0, bbox = structure(c(-2051381.44779317,
3506299.05913181, -2040394.61208067, 3512850.1863696), .Names = c("xmin",
"ymin", "xmax", "ymax"), class = "bbox"), crs = structure(list(
epsg = 102009L, proj4string = "+proj=lcc +lat_1=20 +lat_2=60 +lat_0=40 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs"), .Names = c("epsg",
"proj4string"), class = "crs"), n_empty = 0L)), .Names = c("segnum",
"system.time_start", "data", "meanSR", "cloud.pct", "id", "geometry"
), row.names = c(NA, -1L), class = c("tbl_df", "tbl", "data.frame"
))

最佳答案

您的示例在 map 中使用了 table$geometry。相反,请使用 geometry

table2 = x %>%
mutate(center.1 = map(geometry, center1))

关于r - R : no applicable method for 'st_centroid' applied to an object of class "NULL" 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48452914/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com