-
Notifications
You must be signed in to change notification settings - Fork 953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
transform-translate does not preserve geometric angles and distances #2774
Comments
Thanks @hadbn This seems like a limitation of tranformTranslate. rhumb-translating individual points is bound to distort especially away from the equator. Best illustration I can think of is the red and blue lines are both 8000km long: Another probable example of this is at #2419 So, your PR seems like a good approach. However I don't think the user should have to opt in. The corrected behaviour should be the default. Will get a second opinion though. What do you think @mfedderly @JamesLMilner @rowanwins. Can we just fix the bug and not treat this as something the user needs to opt in to? Perhaps we would need to clarify in the docs that translation uses the centroid as the reference point. Or is this somehow the expected behaviour? |
Did you have a chance to discuss that, @smallsaucepan @mfedderly @JamesLMilner and @rowanwins ? |
Haven't heard further from anyone else. My inclination is for us to do two things:
Would you be happy with the approach described in point 1? For point 2 I'd like to see something like the below on the website eventually - map and / or globe indicating support for planar or spherical calculations. Maybe as text as well below the description. Note that we generate both the README.md files and the website content, so we can add some special handling to the parsing of the JSDoc description contents. https://github.com/Turfjs/turf/blob/master/packages/turf-transform-translate/README.md Perhaps something like this could work? /**
* Moves any geojson Feature or Geometry of a specified distance along a Rhumb Line
* on the provided direction angle.
*
* [method:planar]
* [method:spherical]
*
* @function
* ... transformTranslate would currently only be [method:planar]. This is something we ultimately hope to apply to all Turf functions. |
When using this function, the translation is performed on each point independently, without considering the geometry of the feature as a whole.
As a result, the translation of a circle, for example, will no longer be a circle, which can be prejudicial.
Reproduced with Turf version 7.1 running at https://turf-sandbox.netlify.app/ with the following code :
It would be useful to add a parameter to the function, allowing the user to decide whether or not to keep the geometric properties of the feature given as input.
The text was updated successfully, but these errors were encountered: