TransWikia.com

How to contract geojson polygon

Geographic Information Systems Asked by gazdagergo on March 3, 2021

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.

contract

One Answer

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' })

Answered by gazdagergo on March 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP