I'd like to convert the big red area to a smaller one (blue) by shifting their borders parallelly by a certain distance to inner direction. This is not equivalent to scale as the result shape will look different.

Do you know an existing out-of-the-box function for contract? I tried to find one e.g. on turf but I did not manage to.


  • 2
    That's a buffer with a negative value. Sorry, no time for a proper answer right now, could you do that? Jan 20, 2021 at 7:46
  • 1
    See turfjs.org/docs/#buffer, negative values are allowed. Jan 20, 2021 at 9:12

1 Answer 1


Awesome guys, thanks for the answers. Buffer works like a charm:

import buffer from '@turf/buffer'
import { polygon } from '@turf/helpers'


buffer(polygon([[[lng1, lat1], [lng2, lat2], ... ]]), -3, { units: 'kilometers' })

Your Answer

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

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