nebula.gl icon indicating copy to clipboard operation
nebula.gl copied to clipboard

Improving of feature geometry translation

Open IlyaIzr opened this issue 3 years ago • 2 comments

To translate features Nebula used turf transfromTranslate function for each point of feature. When applied to polygons this could've create a huge shape distortion image image image

This approach helps to avoid such effect by first moving center point (with same function as turf/transformTranslate uses), and then building new geometry around new center point saving geometry proportions

Before: image After: image

IlyaIzr avatar Jun 27 '22 09:06 IlyaIzr

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 27 '22 09:06 CLAassistant

Looks like it broke translate-mode.test.ts

Akiyamka avatar Aug 15 '22 11:08 Akiyamka

closing because similar https://github.com/uber/nebula.gl/pull/808 was already merged in

IlyaIzr avatar Nov 25 '22 08:11 IlyaIzr

I found this PR while searching google about the same underlying problem: using TurfjstransformTranslate over long distances causes distortion. While I'm working with a different mapping framework, this solution inspired a similar solution. Thank you @IlyaIzr for saving me a ton of headache, and hopefully others searching on this problem.

doneel avatar Apr 05 '23 15:04 doneel