0

I've created the following grid:

my_grid_geom = st_make_grid(CLC18, cellsize = 0.4)
my_grid = st_sf(geom = my_grid_geom)
plot(my_grid)

I would like to convert this grid now into a shapefile for further processing in ArcMap. How would I proceed with the conversion of such a polygon object? Seems trivial, but I'm stuck. Thanks!

4
  • 1
    Hard to be sure without any information about what my_grid really is, but st_write is the function for saving sf objects as files - including shapefiles, geopackages, geoJSON etc. Have you tried it? – Spacedman Dec 9 '20 at 21:33
  • Thanks much! This might do the trick indeed. “my_grid” is a simple rectangular tesselation grid, with a constant size of cells. A total of around 210 equal cells spread as polygons. I think st_write is exactly what I was looking for. Thanks! – perrier Dec 9 '20 at 23:51
  • Please write the solution as an answer. Other users find accepted answers more easy than questions without an answer. – user30184 Dec 13 '20 at 21:41
  • Noted with thanks. Done! – perrier Dec 14 '20 at 22:32
0

Herewith the solution to converting an st_make_grid into a shapefile:

my_grid_geom = st_make_grid(CLC18, cellsize = 0.4)
my_grid = st_sf(geom = my_grid_geom)
plot(my_grid)
st_write(my_grid,"my_grid.shp")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.