Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

LatLngBounds hull generation #11758

Closed
LukasPaczos opened this issue Apr 23, 2018 · 2 comments
Closed

LatLngBounds hull generation #11758

LukasPaczos opened this issue Apr 23, 2018 · 2 comments
Labels
Core The cross-platform C++ core, aka mbgl

Comments

@LukasPaczos
Copy link
Contributor

LukasPaczos commented Apr 23, 2018

Currently, LatLngBounds objects in core are built with mbgl::LatLngBounds:hull, which is not trasitioning well into Earth that is not an Euclidean space. This results in wrapped bounds that cross antimeridian being represented incorrectly.
One of the ways to fix the issue would be unwrapping passed LatLngs for the shortest path before creating LatLngBounds object, however, it exposes inconsistency and makes tests fail.
Refs. #11733.

@osana
Copy link
Contributor

osana commented Apr 23, 2018

convex hull can be used over a sphere but shortest distance between two points has to be properly defined.

At the moment LatLngBounds.hull uses LatLngBounds.extend() for its implementation which
assumes shortest distance to be calculated as in Euclidean space:

sw = LatLng(std::min(point.latitude(), sw.latitude()),
                     std::min(point.longitude(), sw.longitude()));
ne = LatLng(std::max(point.latitude(), ne.latitude()),
                    std::max(point.longitude(), ne.longitude()));

shortest distance between points on a sphere should look at the shortest span between two geo points

void extend(const LatLng& point) {

cc @tobrun , @LukasPaczos

@LukasPaczos
Copy link
Contributor Author

This isn't actionable/not required after #11807 landed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Core The cross-platform C++ core, aka mbgl
Projects
None yet
Development

No branches or pull requests

2 participants