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

WIP: bounds across the antimeridian #13871

Closed
wants to merge 2 commits into from
Closed

Conversation

tobrun
Copy link
Member

@tobrun tobrun commented Feb 4, 2019

This PR is more a question/discussion than an actual fix, it attempts to fix the issue from #13672:

ezgif com-video-to-gif

This issue is that I'm unable to define a crossing antimerdian bounds that plays well with Transform::setLatLngBounds. After briefly looking into the possibilities, I believe that creating such
bounds, with constructor Bounds(sw, ne), can in theory be done with:

  • Bounds(LatLng(-20;-170), LatLng(20;170)) // by switching the sw/ne order
  • Bounds(LatLng(-20;170), LatLng(20;190)) // going over max longitude = crosses IDL

The former approach is taken with gl-js as shown here but not possible on gl-native as this generates an invalid bounds by definition here (though this could be changed?).

For now, this has led me down the road to try optimizing for the latter case in this PR.


Current state of this PR works well for my specific setup:

ezgif com-video-to-gif 49

But I'm very sure that this line will impact other parts of the code and thus not a correct change.

Would someone be able to 👀 this and provide some feedback/context?

cc @ansis @ryanhamley @brunoabinader @tmpsantos

@tobrun tobrun added ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold Core The cross-platform C++ core, aka mbgl question labels Feb 4, 2019
@tobrun tobrun self-assigned this Feb 4, 2019
@tmpsantos
Copy link
Contributor

The former approach is taken with gl-js as shown here but not possible on gl-native as this generates an invalid bounds by definition here (though this could be changed?).

I'm not so sure that this will generate invalid bounds. Perhaps the issue is we are always creating Bounds with Wrapped coordinates.

https://github.com/mapbox/mapbox-gl-native/blob/master/include/mbgl/util/geo.hpp#L32

@tobrun
Copy link
Member Author

tobrun commented Feb 7, 2019

For both suggested cases from OP the bounds aren't being wrapped:

image

screenshot from 2019-02-07 14-12-38

note that latter returns false for crossesAntimeridian while the former doesn't

@brunoabinader
Copy link
Member

Fixed in #13958.

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 ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants