-
Notifications
You must be signed in to change notification settings - Fork 117
TurfMeasurement#square #1019
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
TurfMeasurement#square #1019
Conversation
| */ | ||
| public static BoundingBox square(@NonNull BoundingBox boundingBox) { | ||
| double horizontalDistance = distance( | ||
| Point.fromLngLat(boundingBox.west(), boundingBox.south()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just use boundingBox.southwest() instead of creating a point
|
|
||
| if (horizontalDistance >= verticalDistance) { | ||
| double verticalMidpoint = (boundingBox.south() + boundingBox.north()) / 2; | ||
| return BoundingBox.fromCoordinates( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use BoundingBox.fromLngLats instead of fromCoordinates
| ); | ||
| double verticalDistance = distance( | ||
| Point.fromLngLat(boundingBox.west(), boundingBox.south()), | ||
| Point.fromLngLat(boundingBox.west(), boundingBox.north()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just use boundingBox.northeast() instead of creating a point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no northEast coordinate used
Port of https://turfjs.org/docs/#square