0

I'm trying to convert this list of polygons, named all_buffers, into a shapefile. I'd like each polygon to be its own feature in the shapefile. Everything I've tried has only exported one single polygon.

I'm not 100% sure what the polygons will look like, as I wrote a code to create them and need to plot them out to see if I have the correct output of polygons.

Here is one example of code that leads to a shapefile with a single polygon in the output:

# convert list to to sf object
all_buffers_df <- as.data.frame(all_buffers)
all_buffers_sf <- st_sf(all_buffers_df)

# Write the sf object to a shapefile
st_write(all_buffers_sf, output_shapefile)

Here is the output of dput(all_buffers[1:3])

list(structure(list(structure(list(structure(c(1643236.4086072, 
1643238.48985526, 1643240.90097465, 1643331.86535965, 1643332.12136799, 
1643491.9559765, 1643540.07354953, 1643541.07809514, 1643542.45620144, 
1643544.20359104, 1643546.31484036, 1643548.78339648, 1643551.60159745, 
1643841.6391826, 1643880.02768436, 1643862.74577757, 1643862.70783685, 
1643863.02018494, 1643863.68192662, 1643864.69116521, 1643866.04500806, 
1643903.30422821, 1643903.247472, 1643903.41383696, 1643903.91480187, 
1643904.74899362, 1643905.91412575, 1643907.4070047, 1643909.22353862, 
1643911.35874849, 1643913.80678186, 1643916.56092884, 1643919.61364051, 
1643922.95654959, 1643926.58049341, 1643930.47553897, 1643934.63101025, 
1643939.03551737, 1643943.67698789, 1643948.54269986, 1643953.6193167, 
1643958.89292377, 1643964.34906646, 1643969.97278987, 1643975.74867977, 
1643981.66090485, 1643987.69326009, 1643993.82921125, 1644000.0519401, 
1644006.34439058, 1644012.68931551, 1644019.0693239, 1644025.46692859, 
1644031.86459419, 1644038.24478514, 1644044.59001378, 1644050.88288829, 
1644057.10616033, 1644063.24277234, 1644069.27590429, 1644075.1890198, 
1644080.96591142, 1644086.5907451, 1644092.04810356, 1644097.32302855, 
1644102.40106187, 1644107.26828499, 1644111.91135719, 1644116.31755213, 
1644120.47479273, 1644124.37168429, 1644127.9975457, 1644131.34243872, 
1644134.39719524, 1644137.15344238, 1644139.60362545, 1644141.74102869, 
1644143.5597936, 1644145.05493509, 1644146.22235508, 1644147.05885374, 
1644147.5621383, 1644147.73082929, 1644147.79021236, 1644147.58002816, 
1644146.9475896, 1644145.89508505, 1644144.42615639, 1644107.63552073, 
1644124.73035412, 1644124.75473163, 1644124.36394607, 1644123.55932507, 
1644080.92227123, 1644079.85680313, 1644078.466711, 1644076.75575718, 
1644074.72857245, 1644072.39064348, 1644069.74829798, 1643780.32038485, 
1643732.54475991, 1643731.69910241, 1643730.5743334, 1643729.17305785, 
1643727.49852112, 1643725.55460144, 1643723.34580095, 1643556.57204004, 
1643468.31116325, 1643415.86842324, 1643413.83925947, 1643411.4952172, 
1643408.84272127, 1643405.88904199, 1643402.6422752, 1643399.11132005, 
1643395.30585465, 1643391.23630951, 1643386.91383897, 1643382.35029063, 
1643377.55817286, 1643372.55062051, 1643367.34135894, 1643361.94466637, 
1643356.37533476, 1643350.64862926, 1643344.78024638, 1643338.78627095, 
1643332.68313202, 1643326.48755789, 1643320.21653019, 1643313.88723738, 
1643307.51702759, 1643301.12336115, 1643294.72376263, 1643288.3357729, 
1643281.976901, 1643275.66457614, 1643269.41609997, 1643263.24859914, 
1643257.17897832, 1643251.22387394, 1643245.39960851, 1643239.72214595, 
1643234.20704778, 1643228.86943051, 1643223.72392417, 1643218.78463224, 
1643214.06509297, 1643209.57824229, 1643205.33637836, 1643201.35112782, 
1643197.63341396, 1643194.19342679, 1643191.04059507, 1643188.18356049, 
1643185.63015399, 1643183.38737427, 1643181.46136864, 1643179.85741614, 
1643178.5799131, 1643177.63236107, 1643177.01735721, 1643176.73658722, 
1643176.79082066, 1643177.17990888, 1643177.90278542, 1643178.95746893, 
1643180.34106858, 1643182.04979204, 1643236.4086072, 243269.326850644, 
243275.539407347, 243281.631529932, 243494.604529177, 243495.199546814, 
243863.994530239, 244262.430265543, 244269.166085889, 244275.835509451, 
244282.417835576, 244288.892633946, 244295.239807988, 244301.439657251, 
244895.030051468, 245162.946393988, 245693.383455872, 245699.92775685, 
245706.464709768, 245712.975578585, 245719.441702018, 245725.844547036, 
245881.364510288, 246193.575732921, 246199.97339852, 246206.353589471, 
246212.698818115, 246218.991692621, 246225.214964657, 246231.351576667, 
246237.384708624, 246243.297824133, 246249.074715755, 246254.699549432, 
246260.156907886, 246265.431832876, 246270.5098662, 246275.377089322, 
246280.020161521, 246284.426356458, 246288.583597061, 246292.480488621, 
246296.106350029, 246299.451243052, 246302.50599957, 246305.262246708, 
246307.712429784, 246309.849833017, 246311.668597932, 246313.163739422, 
246314.331159408, 246315.167658072, 246315.670942631, 246315.839633615, 
246315.673268656, 246315.172303746, 246314.338111998, 246313.172979871, 
246311.680100913, 246309.863567001, 246307.728357127, 246305.280323755, 
246302.526176772, 246299.473465105, 246296.130556024, 246292.506612211, 
246288.611566643, 246284.45609537, 246280.051588249, 246275.410117729, 
246270.544405758, 246265.467788913, 246260.194181849, 246254.738039157, 
246249.114315743, 246243.338425844, 246237.426200771, 246231.393845523, 
246225.257894366, 246219.035165516, 246212.74271504, 246206.397790107, 
246200.017781716, 246193.620177026, 245866.95875686, 245859.771141828, 
245852.608320546, 245845.495077866, 245838.456027088, 245684.891935232, 
245160.196754918, 245153.071697909, 245145.957323847, 245138.87780291, 
244841.310484664, 244835.04081447, 244828.835040508, 244822.709958987, 
244816.682147719, 244810.767921248, 244804.983286699, 244212.640646117, 
243817.036398995, 243811.214631001, 243805.440290011, 243799.726749426, 
243794.087241829, 243788.534828346, 243783.082368389, 243398.276305639, 
243191.632973258, 243019.945559645, 243013.87593883, 243007.920834446, 
243002.096569019, 242996.419106456, 242990.904008288, 242985.566391015, 
242980.420884675, 242975.481592744, 242970.762053477, 242966.275202803, 
242962.033338868, 242958.048088327, 242954.330374473, 242950.890387303, 
242947.737555582, 242944.880521003, 242942.327114498, 242940.084334778, 
242938.158329146, 242936.554376649, 242935.27687361, 242934.329321575, 
242933.71431772, 242933.433547727, 242933.487781166, 242933.876869388, 
242934.59974593, 242935.654429436, 242937.038029092, 242938.746752548, 
242940.775916313, 242943.119958588, 242945.772454517, 242948.726133793, 
242951.972900587, 242955.503855736, 242959.309321138, 242963.378866276, 
242967.701336811, 242972.26488515, 242977.057002926, 242982.064555276, 
242987.273816847, 242992.670509417, 242998.239841024, 243003.966546519, 
243009.8349294, 243015.828904838, 243021.932043761, 243028.127617892, 
243034.398645591, 243040.727938407, 243047.09814819, 243053.491814636, 
243059.891413151, 243066.27940288, 243072.638274786, 243078.950599645, 
243085.199075811, 243091.366576648, 243269.326850644), dim = c(172L, 
2L))), class = c("XY", "POLYGON", "sfg"))), n_empty = 0L, precision = 0, crs = structure(list(
    input = "NAD83(HARN) / Washington South (ftUS) + EGM96 height", 
    wkt = "COMPOUNDCRS[\"NAD83(HARN) / Washington South (ftUS) + EGM96 height\",\n    PROJCRS[\"NAD83(HARN) / Washington South (ftUS)\",\n        BASEGEOGCRS[\"NAD83(HARN)\",\n            DATUM[\"NAD83 (High Accuracy Reference Network)\",\n                ELLIPSOID[\"GRS 1980\",6378137,298.257222101,\n                    LENGTHUNIT[\"metre\",1]],\n                ID[\"EPSG\",6152]],\n            PRIMEM[\"Greenwich\",0,\n                ANGLEUNIT[\"Degree\",0.0174532925199433]]],\n        CONVERSION[\"unnamed\",\n            METHOD[\"Lambert Conic Conformal (2SP)\",\n                ID[\"EPSG\",9802]],\n            PARAMETER[\"Latitude of false origin\",45.3333333333333,\n                ANGLEUNIT[\"Degree\",0.0174532925199433],\n                ID[\"EPSG\",8821]],\n            PARAMETER[\"Longitude of false origin\",-120.5,\n                ANGLEUNIT[\"Degree\",0.0174532925199433],\n                ID[\"EPSG\",8822]],\n            PARAMETER[\"Latitude of 1st standard parallel\",45.8333333333333,\n                ANGLEUNIT[\"Degree\",0.0174532925199433],\n                ID[\"EPSG\",8823]],\n            PARAMETER[\"Latitude of 2nd standard parallel\",47.3333333333333,\n                ANGLEUNIT[\"Degree\",0.0174532925199433],\n                ID[\"EPSG\",8824]],\n            PARAMETER[\"Easting at false origin\",1640416.66666667,\n                LENGTHUNIT[\"US survey foot\",0.304800609601219],\n                ID[\"EPSG\",8826]],\n            PARAMETER[\"Northing at false origin\",0,\n                LENGTHUNIT[\"US survey foot\",0.304800609601219],\n                ID[\"EPSG\",8827]]],\n        CS[Cartesian,2],\n            AXIS[\"(E)\",east,\n                ORDER[1],\n                LENGTHUNIT[\"US survey foot\",0.304800609601219,\n                    ID[\"EPSG\",9003]]],\n            AXIS[\"(N)\",north,\n                ORDER[2],\n                LENGTHUNIT[\"US survey foot\",0.304800609601219,\n                    ID[\"EPSG\",9003]]]],\n    VERTCRS[\"EGM96 height\",\n        VDATUM[\"EGM96 geoid\"],\n        CS[vertical,1],\n            AXIS[\"gravity-related height (H)\",up,\n                LENGTHUNIT[\"metre\",1,\n                    ID[\"EPSG\",9001]]]]]"), class = "crs"), class = c("sfc_POLYGON", 
"sfc"), bbox = structure(c(xmin = 1643176.73658722, ymin = 242933.433547727, 
xmax = 1644147.79021236, ymax = 246315.839633615), class = "bbox")), 
    structure(list(structure(list(structure(c(1643236.4086072, 
    1643238.48985526, 1643240.90097465, 1643331.86535965, 1643332.12136799, 
    1643491.9559765, 1643540.07354953, 1643541.07809514, 1643542.45620144, 
    1643544.20359104, 1643546.31484036, 1643548.78339648, 1643551.60159745, 
    1643841.6391826, 1643880.02768436, 1643862.74577757, 1643862.70783685, 
    1643863.02018494, 1643863.68192662, 1643864.69116521, 1643866.04500806, 
    1643903.30422821, 1643903.247472, 1643903.41383696, 1643903.91480187, 
    1643904.74899362, 1643905.91412575, 1643907.4070047, 1643909.22353862, 
    1643911.35874849, 1643913.80678186, 1643916.56092884, 1643919.61364051, 
    1643922.95654959, 1643926.58049341, 1643930.47553897, 1643934.63101025, 
    1643939.03551737, 1643943.67698789, 1643948.54269986, 1643953.6193167, 
    1643958.89292377, 1643964.34906646, 1643969.97278987, 1643975.74867977, 
    1643981.66090485, 1643987.69326009, 1643993.82921125, 1644000.0519401, 
    1644006.34439058, 1644012.68931551, 1644019.0693239, 1644025.46692859, 
    1644031.86459419, 1644038.24478514, 1644044.59001378, 1644050.88288829, 
    1644057.10616033, 1644063.24277234, 1644069.27590429, 1644075.1890198, 
    1644080.96591142, 1644086.5907451, 1644092.04810356, 1644097.32302855, 
    1644102.40106187, 1644107.26828499, 1644111.91135719, 1644116.31755213, 
    1644120.47479273, 1644124.37168429, 1644127.9975457, 1644131.34243872, 
    1644134.39719524, 1644137.15344238, 1644139.60362545, 1644141.74102869, 
    1644143.5597936, 1644145.05493509, 1644146.22235508, 1644147.05885374, 
    1644147.5621383, 1644147.73082929, 1644147.79021236, 1644147.58002816, 
    1644146.9475896, 1644145.89508505, 1644144.42615639, 1644107.63552073, 
    1644124.73035412, 1644124.75473163, 1644124.36394607, 1644123.55932507, 
    1644080.92227123, 1644079.85680313, 1644078.466711, 1644076.75575718, 
    1644074.72857245, 1644072.39064348, 1644069.74829798, 1643780.32038485, 
    1643732.54475991, 1643731.69910241, 1643730.5743334, 1643729.17305785, 
    1643727.49852112, 1643725.55460144, 1643723.34580095, 1643556.57204004, 
    1643468.31116325, 1643415.86842324, 1643413.83925947, 1643411.4952172, 
    1643408.84272127, 1643405.88904199, 1643402.6422752, 1643399.11132005, 
    1643395.30585465, 1643391.23630951, 1643386.91383897, 1643382.35029063, 
    1643377.55817286, 1643372.55062051, 1643367.34135894, 1643361.94466637, 
    1643356.37533476, 1643350.64862926, 1643344.78024638, 1643338.78627095, 
    1643332.68313202, 1643326.48755789, 1643320.21653019, 1643313.88723738, 
    1643307.51702759, 1643301.12336115, 1643294.72376263, 1643288.3357729, 
    1643281.976901, 1643275.66457614, 1643269.41609997, 1643263.24859914, 
    1643257.17897832, 1643251.22387394, 1643245.39960851, 1643239.72214595, 
    1643234.20704778, 1643228.86943051, 1643223.72392417, 1643218.78463224, 
    1643214.06509297, 1643209.57824229, 1643205.33637836, 1643201.35112782, 
    1643197.63341396, 1643194.19342679, 1643191.04059507, 1643188.18356049, 
    1643185.63015399, 1643183.38737427, 1643181.46136864, 1643179.85741614, 
    1643178.5799131, 1643177.63236107, 1643177.01735721, 1643176.73658722, 
    1643176.79082066, 1643177.17990888, 1643177.90278542, 1643178.95746893, 
    1643180.34106858, 1643182.04979204, 1643236.4086072, 243269.326850644, 
    243275.539407347, 243281.631529932, 243494.604529177, 243495.199546814, 
    243863.994530239, 244262.430265543, 244269.166085889, 244275.835509451, 
    244282.417835576, 244288.892633946, 244295.239807988, 244301.439657251, 
    244895.030051468, 245162.946393988, 245693.383455872, 245699.92775685, 
    245706.464709768, 245712.975578585, 245719.441702018, 245725.844547036, 
    245881.364510288, 246193.575732921, 246199.97339852, 246206.353589471, 
    246212.698818115, 246218.991692621, 246225.214964657, 246231.351576667, 
    246237.384708624, 246243.297824133, 246249.074715755, 246254.699549432, 
    246260.156907886, 246265.431832876, 246270.5098662, 246275.377089322, 
    246280.020161521, 246284.426356458, 246288.583597061, 246292.480488621, 
    246296.106350029, 246299.451243052, 246302.50599957, 246305.262246708, 
    246307.712429784, 246309.849833017, 246311.668597932, 246313.163739422, 
    246314.331159408, 246315.167658072, 246315.670942631, 246315.839633615, 
    246315.673268656, 246315.172303746, 246314.338111998, 246313.172979871, 
    246311.680100913, 246309.863567001, 246307.728357127, 246305.280323755, 
    246302.526176772, 246299.473465105, 246296.130556024, 246292.506612211, 
    246288.611566643, 246284.45609537, 246280.051588249, 246275.410117729, 
    246270.544405758, 246265.467788913, 246260.194181849, 246254.738039157, 
    246249.114315743, 246243.338425844, 246237.426200771, 246231.393845523, 
    246225.257894366, 246219.035165516, 246212.74271504, 246206.397790107, 
    246200.017781716, 246193.620177026, 245866.95875686, 245859.771141828, 
    245852.608320546, 245845.495077866, 245838.456027088, 245684.891935232, 
    245160.196754918, 245153.071697909, 245145.957323847, 245138.87780291, 
    244841.310484664, 244835.04081447, 244828.835040508, 244822.709958987, 
    244816.682147719, 244810.767921248, 244804.983286699, 244212.640646117, 
    243817.036398995, 243811.214631001, 243805.440290011, 243799.726749426, 
    243794.087241829, 243788.534828346, 243783.082368389, 243398.276305639, 
    243191.632973258, 243019.945559645, 243013.87593883, 243007.920834446, 
    243002.096569019, 242996.419106456, 242990.904008288, 242985.566391015, 
    242980.420884675, 242975.481592744, 242970.762053477, 242966.275202803, 
    242962.033338868, 242958.048088327, 242954.330374473, 242950.890387303, 
    242947.737555582, 242944.880521003, 242942.327114498, 242940.084334778, 
    242938.158329146, 242936.554376649, 242935.27687361, 242934.329321575, 
    242933.71431772, 242933.433547727, 242933.487781166, 242933.876869388, 
    242934.59974593, 242935.654429436, 242937.038029092, 242938.746752548, 
    242940.775916313, 242943.119958588, 242945.772454517, 242948.726133793, 
    242951.972900587, 242955.503855736, 242959.309321138, 242963.378866276, 
    242967.701336811, 242972.26488515, 242977.057002926, 242982.064555276, 
    242987.273816847, 242992.670509417, 242998.239841024, 243003.966546519, 
    243009.8349294, 243015.828904838, 243021.932043761, 243028.127617892, 
    243034.398645591, 243040.727938407, 243047.09814819, 243053.491814636, 
    243059.891413151, 243066.27940288, 243072.638274786, 243078.950599645, 
    243085.199075811, 243091.366576648, 243269.326850644), dim = c(172L, 
    2L))), class = c("XY", "POLYGON", "sfg"))), n_empty = 0L, precision = 0, crs = structure(list(
        input = "NAD83(HARN) / Washington South (ftUS) + EGM96 height", 
        wkt = "COMPOUNDCRS[\"NAD83(HARN) / Washington South (ftUS) + EGM96 height\",\n    PROJCRS[\"NAD83(HARN) / Washington South (ftUS)\",\n        BASEGEOGCRS[\"NAD83(HARN)\",\n            DATUM[\"NAD83 (High Accuracy Reference Network)\",\n                ELLIPSOID[\"GRS 1980\",6378137,298.257222101,\n                    LENGTHUNIT[\"metre\",1]],\n                ID[\"EPSG\",6152]],\n            PRIMEM[\"Greenwich\",0,\n                ANGLEUNIT[\"Degree\",0.0174532925199433]]],\n        CONVERSION[\"unnamed\",\n            METHOD[\"Lambert Conic Conformal (2SP)\",\n                ID[\"EPSG\",9802]],\n            PARAMETER[\"Latitude of false origin\",45.3333333333333,\n                ANGLEUNIT[\"Degree\",0.0174532925199433],\n                ID[\"EPSG\",8821]],\n            PARAMETER[\"Longitude of false origin\",-120.5,\n                ANGLEUNIT[\"Degree\",0.0174532925199433],\n                ID[\"EPSG\",8822]],\n            PARAMETER[\"Latitude of 1st standard parallel\",45.8333333333333,\n                ANGLEUNIT[\"Degree\",0.0174532925199433],\n                ID[\"EPSG\",8823]],\n            PARAMETER[\"Latitude of 2nd standard parallel\",47.3333333333333,\n                ANGLEUNIT[\"Degree\",0.0174532925199433],\n                ID[\"EPSG\",8824]],\n            PARAMETER[\"Easting at false origin\",1640416.66666667,\n                LENGTHUNIT[\"US survey foot\",0.304800609601219],\n                ID[\"EPSG\",8826]],\n            PARAMETER[\"Northing at false origin\",0,\n                LENGTHUNIT[\"US survey foot\",0.304800609601219],\n                ID[\"EPSG\",8827]]],\n        CS[Cartesian,2],\n            AXIS[\"(E)\",east,\n                ORDER[1],\n                LENGTHUNIT[\"US survey foot\",0.304800609601219,\n                    ID[\"EPSG\",9003]]],\n            AXIS[\"(N)\",north,\n                ORDER[2],\n                LENGTHUNIT[\"US survey foot\",0.304800609601219,\n                    ID[\"EPSG\",9003]]]],\n    VERTCRS[\"EGM96 height\",\n        VDATUM[\"EGM96 geoid\"],\n        CS[vertical,1],\n            AXIS[\"gravity-related height (H)\",up,\n                LENGTHUNIT[\"metre\",1,\n                    ID[\"EPSG\",9001]]]]]"), class = "crs"), class = c("sfc_POLYGON", 
    "sfc"), bbox = structure(c(xmin = 1643176.73658722, ymin = 242933.433547727, 
    xmax = 1644147.79021236, ymax = 246315.839633615), class = "bbox")), 
    structure(list(structure(list(structure(c(1643236.4086072, 
    1643238.48985526, 1643240.90097465, 1643331.86535965, 1643332.12136799, 
    1643491.9559765, 1643540.07354953, 1643541.07809514, 1643542.45620144, 
    1643544.20359104, 1643546.31484036, 1643548.78339648, 1643551.60159745, 
    1643841.6391826, 1643880.02768436, 1643862.74577757, 1643862.70783685, 
    1643863.02018494, 1643863.68192662, 1643864.69116521, 1643866.04500806, 
    1643903.30422821, 1643903.247472, 1643903.41383696, 1643903.91480187, 
    1643904.74899362, 1643905.91412575, 1643907.4070047, 1643909.22353862, 
    1643911.35874849, 1643913.80678186, 1643916.56092884, 1643919.61364051, 
    1643922.95654959, 1643926.58049341, 1643930.47553897, 1643934.63101025, 
    1643939.03551737, 1643943.67698789, 1643948.54269986, 1643953.6193167, 
    1643958.89292377, 1643964.34906646, 1643969.97278987, 1643975.74867977, 
    1643981.66090485, 1643987.69326009, 1643993.82921125, 1644000.0519401, 
    1644006.34439058, 1644012.68931551, 1644019.0693239, 1644025.46692859, 
    1644031.86459419, 1644038.24478514, 1644044.59001378, 1644050.88288829, 
    1644057.10616033, 1644063.24277234, 1644069.27590429, 1644075.1890198, 
    1644080.96591142, 1644086.5907451, 1644092.04810356, 1644097.32302855, 
    1644102.40106187, 1644107.26828499, 1644111.91135719, 1644116.31755213, 
    1644120.47479273, 1644124.37168429, 1644127.9975457, 1644131.34243872, 
    1644134.39719524, 1644137.15344238, 1644139.60362545, 1644141.74102869, 
    1644143.5597936, 1644145.05493509, 1644146.22235508, 1644147.05885374, 
    1644147.5621383, 1644147.73082929, 1644147.79021236, 1644147.58002816, 
    1644146.9475896, 1644145.89508505, 1644144.42615639, 1644107.63552073, 
    1644124.73035412, 1644124.75473163, 1644124.36394607, 1644123.55932507, 
    1644080.92227123, 1644079.85680313, 1644078.466711, 1644076.75575718, 
    1644074.72857245, 1644072.39064348, 1644069.74829798, 1643780.32038485, 
    1643732.54475991, 1643731.69910241, 1643730.5743334, 1643729.17305785, 
    1643727.49852112, 1643725.55460144, 1643723.34580095, 1643556.57204004, 
    1643468.31116325, 1643415.86842324, 1643413.83925947, 1643411.4952172, 
    1643408.84272127, 1643405.88904199, 1643402.6422752, 1643399.11132005, 
    1643395.30585465, 1643391.23630951, 1643386.91383897, 1643382.35029063, 
    1643377.55817286, 1643372.55062051, 1643367.34135894, 1643361.94466637, 
    1643356.37533476, 1643350.64862926, 1643344.78024638, 1643338.78627095, 
    1643332.68313202, 1643326.48755789, 1643320.21653019, 1643313.88723738, 
    1643307.51702759, 1643301.12336115, 1643294.72376263, 1643288.3357729, 
    1643281.976901, 1643275.66457614, 1643269.41609997, 1643263.24859914, 
    1643257.17897832, 1643251.22387394, 1643245.39960851, 1643239.72214595, 
    1643234.20704778, 1643228.86943051, 1643223.72392417, 1643218.78463224, 
    1643214.06509297, 1643209.57824229, 1643205.33637836, 1643201.35112782, 
    1643197.63341396, 1643194.19342679, 1643191.04059507, 1643188.18356049, 
    1643185.63015399, 1643183.38737427, 1643181.46136864, 1643179.85741614, 
    1643178.5799131, 1643177.63236107, 1643177.01735721, 1643176.73658722, 
    1643176.79082066, 1643177.17990888, 1643177.90278542, 1643178.95746893, 
    1643180.34106858, 1643182.04979204, 1643236.4086072, 243269.326850644, 
    243275.539407347, 243281.631529932, 243494.604529177, 243495.199546814, 
    243863.994530239, 244262.430265543, 244269.166085889, 244275.835509451, 
    244282.417835576, 244288.892633946, 244295.239807988, 244301.439657251, 
    244895.030051468, 245162.946393988, 245693.383455872, 245699.92775685, 
    245706.464709768, 245712.975578585, 245719.441702018, 245725.844547036, 
    245881.364510288, 246193.575732921, 246199.97339852, 246206.353589471, 
    246212.698818115, 246218.991692621, 246225.214964657, 246231.351576667, 
    246237.384708624, 246243.297824133, 246249.074715755, 246254.699549432, 
    246260.156907886, 246265.431832876, 246270.5098662, 246275.377089322, 
    246280.020161521, 246284.426356458, 246288.583597061, 246292.480488621, 
    246296.106350029, 246299.451243052, 246302.50599957, 246305.262246708, 
    246307.712429784, 246309.849833017, 246311.668597932, 246313.163739422, 
    246314.331159408, 246315.167658072, 246315.670942631, 246315.839633615, 
    246315.673268656, 246315.172303746, 246314.338111998, 246313.172979871, 
    246311.680100913, 246309.863567001, 246307.728357127, 246305.280323755, 
    246302.526176772, 246299.473465105, 246296.130556024, 246292.506612211, 
    246288.611566643, 246284.45609537, 246280.051588249, 246275.410117729, 
    246270.544405758, 246265.467788913, 246260.194181849, 246254.738039157, 
    246249.114315743, 246243.338425844, 246237.426200771, 246231.393845523, 
    246225.257894366, 246219.035165516, 246212.74271504, 246206.397790107, 
    246200.017781716, 246193.620177026, 245866.95875686, 245859.771141828, 
    245852.608320546, 245845.495077866, 245838.456027088, 245684.891935232, 
    245160.196754918, 245153.071697909, 245145.957323847, 245138.87780291, 
    244841.310484664, 244835.04081447, 244828.835040508, 244822.709958987, 
    244816.682147719, 244810.767921248, 244804.983286699, 244212.640646117, 
    243817.036398995, 243811.214631001, 243805.440290011, 243799.726749426, 
    243794.087241829, 243788.534828346, 243783.082368389, 243398.276305639, 
    243191.632973258, 243019.945559645, 243013.87593883, 243007.920834446, 
    243002.096569019, 242996.419106456, 242990.904008288, 242985.566391015, 
    242980.420884675, 242975.481592744, 242970.762053477, 242966.275202803, 
    242962.033338868, 242958.048088327, 242954.330374473, 242950.890387303, 
    242947.737555582, 242944.880521003, 242942.327114498, 242940.084334778, 
    242938.158329146, 242936.554376649, 242935.27687361, 242934.329321575, 
    242933.71431772, 242933.433547727, 242933.487781166, 242933.876869388, 
    242934.59974593, 242935.654429436, 242937.038029092, 242938.746752548, 
    242940.775916313, 242943.119958588, 242945.772454517, 242948.726133793, 
    242951.972900587, 242955.503855736, 242959.309321138, 242963.378866276, 
    242967.701336811, 242972.26488515, 242977.057002926, 242982.064555276, 
    242987.273816847, 242992.670509417, 242998.239841024, 243003.966546519, 
    243009.8349294, 243015.828904838, 243021.932043761, 243028.127617892, 
    243034.398645591, 243040.727938407, 243047.09814819, 243053.491814636, 
    243059.891413151, 243066.27940288, 243072.638274786, 243078.950599645, 
    243085.199075811, 243091.366576648, 243269.326850644), dim = c(172L, 
    2L))), class = c("XY", "POLYGON", "sfg"))), n_empty = 0L, precision = 0, crs = structure(list(
        input = "NAD83(HARN) / Washington South (ftUS) + EGM96 height", 
        wkt = "COMPOUNDCRS[\"NAD83(HARN) / Washington South (ftUS) + EGM96 height\",\n    PROJCRS[\"NAD83(HARN) / Washington South (ftUS)\",\n        BASEGEOGCRS[\"NAD83(HARN)\",\n            DATUM[\"NAD83 (High Accuracy Reference Network)\",\n                ELLIPSOID[\"GRS 1980\",6378137,298.257222101,\n                    LENGTHUNIT[\"metre\",1]],\n                ID[\"EPSG\",6152]],\n            PRIMEM[\"Greenwich\",0,\n                ANGLEUNIT[\"Degree\",0.0174532925199433]]],\n        CONVERSION[\"unnamed\",\n            METHOD[\"Lambert Conic Conformal (2SP)\",\n                ID[\"EPSG\",9802]],\n            PARAMETER[\"Latitude of false origin\",45.3333333333333,\n                ANGLEUNIT[\"Degree\",0.0174532925199433],\n                ID[\"EPSG\",8821]],\n            PARAMETER[\"Longitude of false origin\",-120.5,\n                ANGLEUNIT[\"Degree\",0.0174532925199433],\n                ID[\"EPSG\",8822]],\n            PARAMETER[\"Latitude of 1st standard parallel\",45.8333333333333,\n                ANGLEUNIT[\"Degree\",0.0174532925199433],\n                ID[\"EPSG\",8823]],\n            PARAMETER[\"Latitude of 2nd standard parallel\",47.3333333333333,\n                ANGLEUNIT[\"Degree\",0.0174532925199433],\n                ID[\"EPSG\",8824]],\n            PARAMETER[\"Easting at false origin\",1640416.66666667,\n                LENGTHUNIT[\"US survey foot\",0.304800609601219],\n                ID[\"EPSG\",8826]],\n            PARAMETER[\"Northing at false origin\",0,\n                LENGTHUNIT[\"US survey foot\",0.304800609601219],\n                ID[\"EPSG\",8827]]],\n        CS[Cartesian,2],\n            AXIS[\"(E)\",east,\n                ORDER[1],\n                LENGTHUNIT[\"US survey foot\",0.304800609601219,\n                    ID[\"EPSG\",9003]]],\n            AXIS[\"(N)\",north,\n                ORDER[2],\n                LENGTHUNIT[\"US survey foot\",0.304800609601219,\n                    ID[\"EPSG\",9003]]]],\n    VERTCRS[\"EGM96 height\",\n        VDATUM[\"EGM96 geoid\"],\n        CS[vertical,1],\n            AXIS[\"gravity-related height (H)\",up,\n                LENGTHUNIT[\"metre\",1,\n                    ID[\"EPSG\",9001]]]]]"), class = "crs"), class = c("sfc_POLYGON", 
    "sfc"), bbox = structure(c(xmin = 1643176.73658722, ymin = 242933.433547727, 
    xmax = 1644147.79021236, ymax = 246315.839633615), class = "bbox")))
8
  • 3
    Instead of an off-site link to a ~40MB rds , perhaps consider including a small reproducible sample from your list of polygons ( all_buffers, I assume) to your question , output of dput(all_buffers[1:3]) might do. This should attract more positive feedback (as in less down-votes and more helpful comments and answers). Links to GDrive are likely dead in near future, rendering answers less useful for future readers. It also helps you to understand the data structure to better focus your question and perhaps spot few anomalies. Commented May 1 at 9:06
  • 2
    I have downloaded your file. It seems to be a list of 8233 of identical copies of the same polygon. These are already in sfc format, so if for some reason you want them all as a single sf you could do something like library(sf); dplyr::bind_rows(lapply(all_buffers, sf::st_as_sf)). However, there seems to have been a problem with your creation of all_buffers given that they are all identical. Commented May 1 at 12:10
  • 2
    I suspect 'all buffers' was created in a for, length 8233, with all_buffers[[i]] <- some_related_poly[[1]], set-up. This is something I've done many times, and eventually moved away from using 'i' to things more distinguishible from 1 when within brackets. Commented May 1 at 12:54
  • @allancameron thank you. That is what I was trying to verify by plotting the polygon file to get a look at the polygons, as I specified in my question I was not sure. I now see that there was an issue with the creation of the file, and that there are other ways to check this than plotting. Commented May 1 at 16:57
  • @margusl I am not advanced in stack overflow and there are no guidelines that discourage linking a file when writing a question here. Apologies that this is not an accepted practice. I will edit my question to provide you with a small, reproducible example. However, I believe the question still stands despite the linked file, as I searched other stack overflow questions and other sites and did not find any workable solution. Commented May 1 at 17:03

1 Answer 1

2

You can combine sfc objects into a single sfc with c(), as you have a whole list of those, you could do do.call(what = c, all_buffers).

I don't know how you verified that (all?) your exports include just a single polygon, but it usually helps if you plot as you go. For example in this case you are dealing with a list of identical polygons that depending on how/what you were looking for, might appear as one. By visualizing early and more often you'd probably spot such anomalies soon after they sneak in.

library(sf)
#> Linking to GEOS 3.13.1, GDAL 3.10.2, PROJ 9.5.1; sf_use_s2() is TRUE

# all_buffers <- list(structure( ... ))
# check buffers, identical bboxes and coordinates look suspicious ... 
str(all_buffers)
#> List of 3
#>  $ :sfc_POLYGON of length 1; first list element: List of 1
#>   ..$ : num [1:172, 1:2] 1643236 1643238 1643241 1643332 1643332 ...
#>   ..- attr(*, "class")= chr [1:3] "XY" "POLYGON" "sfg"
#>  $ :sfc_POLYGON of length 1; first list element: List of 1
#>   ..$ : num [1:172, 1:2] 1643236 1643238 1643241 1643332 1643332 ...
#>   ..- attr(*, "class")= chr [1:3] "XY" "POLYGON" "sfg"
#>  $ :sfc_POLYGON of length 1; first list element: List of 1
#>   ..$ : num [1:172, 1:2] 1643236 1643238 1643241 1643332 1643332 ...
#>   ..- attr(*, "class")= chr [1:3] "XY" "POLYGON" "sfg"

# combine list into a single sfc
( all_buffers_sfc <- do.call(what = c, all_buffers) )
#> Geometry set for 3 features 
#> Geometry type: POLYGON
#> Dimension:     XY
#> Bounding box:  xmin: 1643177 ymin: 242933.4 xmax: 1644148 ymax: 246315.8
#> Projected CRS: NAD83(HARN) / Washington South (ftUS) + EGM96 height
#> POLYGON ((1643236 243269.3, 1643238 243275.5, 1...
#> POLYGON ((1643236 243269.3, 1643238 243275.5, 1...
#> POLYGON ((1643236 243269.3, 1643238 243275.5, 1...

# visualize, looks like a set of identical overlapping polygons
mapview::mapview(st_sf(all_buffers_sfc))

mapview screenshot

# check if all polygons are indeed identical
st_equals_exact(all_buffers_sfc, par = 0, sparse = FALSE)
#>      [,1] [,2] [,3]
#> [1,] TRUE TRUE TRUE
#> [2,] TRUE TRUE TRUE
#> [3,] TRUE TRUE TRUE

# write as GeoPackage
st_write(all_buffers_sfc, "all_buffers.gpkg")
#> Writing layer `all_buffers' to data source `all_buffers.gpkg' using driver `GPKG'
#> Writing 3 features with 0 fields and geometry type Polygon.
fs::file_info("all_buffers.gpkg")[,1:5]
#> # A tibble: 1 × 5
#>   path             type         size permissions modification_time  
#>   <fs::path>       <fct> <fs::bytes> <fs::perms> <dttm>             
#> 1 all_buffers.gpkg file         108K rw-         2025-05-02 10:32:03
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.