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? – bugmenot123 Jan 20 at 7:46
  • 1
    See turfjs.org/docs/#buffer, negative values are allowed. – J. Monticolo Jan 20 at 9:12

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, privacy policy and cookie policy

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