I am trying out the R package sf function st_buffer():

outbuf <- st_buffer(inpoly,10) 

and get a buffer which looks strange. The buffer seems to be gridded in some way and does not cover the original polys. What should I do to get a buffer 10 m around the polygons? I have validated the geometry with st_make_valid() before buffering and precision is set to 0.01.
inpoly - red, outbuf - blue

  • I've never seen anything like this before, and I can't reproduce it. Without knowing more about inpoly I think we're stuck. Can you either a) share that object with us, or the code used to create it or b) show as much information about it as you can, including size, coordinate system, position, etc?
    – Spacedman
    Dec 12, 2019 at 13:47
  • I expect your data is in longlat and not in metres, so try a buffer width of 1/10000 (but hope to god your crs is not set as longlat)
    – mdsumner
    Dec 12, 2019 at 14:10
  • It had to do with the precision of in poly. When I used st_precision(inpoly) <- 0.01 it was made in to squares when validating, later when using st_set_precision(inpoly,0.01) it works well. Thank you!
    – Erik
    Dec 12, 2019 at 14:28
  • @mdsumner I can't replicate anything like this with lat-long coordinates.
    – Spacedman
    Dec 12, 2019 at 15:56

1 Answer 1


It had to do with the precision and validation before buffering. I used the st_precision(inpoly) <- 0.01 and when validating it became grid like. When using st_set_precision(inpoly, 0.01) and validating, the polygon shape was OK. And then the buffering also went OK. I am new to R and thought the to ways of setting precision worked the same. (The inpoly plot was before valdating).

Your Answer

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

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