Skip to content
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

Feat [transform-translate] handles geometry preservation #2775

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hadbn
Copy link

@hadbn hadbn commented Dec 17, 2024

Adds the option aroundCenter to the function transformTranslate. When used, transformTranslate, will translate the centroid of the geometry. The points of the geometry will be reconstructed using (in pseudo-code):

centroidOriginal = centroid(geometry)
translatedCentroid = translate(centroid) //here using rhumbdestination and the translation parameters
for each point of geometry {
    distanceToCentroid = distance(centroidOriginal , point)
    bearingFromCentroid = bearing(centroidOriginal , point)
    translatedPoint = destination(translatedCentroid, distanceToCentroid, bearingFromCentroid)
}

This allows for instance to have a circle as a result of the translation of a circle, instead of the highly deformed shape we can observe.
The difference between using the option or not is only mainly visible for "big geometry" (when the earth curvature plays a role).

In this example the black circle is translated. aroundCenter is set to true for the blue geometry, and to false for the red one.
image

All tests are updated to take this evolution into account.

Resolves #2774

…eometric properties of the feature given as input or to run the translation point by point.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

transform-translate does not preserve geometric angles and distances
1 participant