You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
-[MGLMapView showAnnotations:] should span the antimeridian #8708
It isn’t possible to zoom all the way out to the point where the Prime Meridian, antimeridian, and 179° east are all visible at the same time. The map is constrained to avoid showing multiple “copies” of the world simultaneously and to avoid showing anything beyond 85.051129° north or south (due to Web Mercator projection). In the sample application provided above, the map view is 375 points wide and 563 points tall. At this aspect ratio, attempting to show all three annotations would require breaking both of those constraints.
@1ec5 I understand that in this particular case it's not possible to fit all annotations, but the problem in another side. you can move annotation (0, 0) close to other annotations so that it can fit. And in this case it will not work also, it will show only two of them which close to 180 longitude. You should take into account span of longitude and latitude instead of calculating min/max of longitudes.
try to change array of annotations to these and you will see that it doesn't work correct:
it's possible now to fit all three markers, but showAnnotations show only two of them.
In my opinion you should calculate span of latitude/longutude, set center and zoom appropriately
changed the title [-]Unable to show all longitudes in portrait orientation[/-][+]-[MGLMapView showAnnotations:] should span the antimeridian[/+]on Apr 13, 2017
That’s a good point, @ab-rdarts! I’ve retitled this issue to reflect the fact that -showAnnotations: should be able to straddle the antimeridian if necessary. (Another use case would be showing a single polyline annotation corresponding to the borders of Russia.) This would require mbgl::Map::cameraForLatLngs() to be able to straddle the antimeridian as well.
Activity
1ec5 commentedon Apr 13, 2017
It isn’t possible to zoom all the way out to the point where the Prime Meridian, antimeridian, and 179° east are all visible at the same time. The map is constrained to avoid showing multiple “copies” of the world simultaneously and to avoid showing anything beyond 85.051129° north or south (due to Web Mercator projection). In the sample application provided above, the map view is 375 points wide and 563 points tall. At this aspect ratio, attempting to show all three annotations would require breaking both of those constraints.
[-]showAnnotations works in wrong way[/-][+]Unable to show all longitudes in portrait orientation[/+]jfirebaugh commentedon Apr 13, 2017
@1ec5 Should we close this as working as designed then?
ab-rdarts commentedon Apr 13, 2017
@1ec5 I understand that in this particular case it's not possible to fit all annotations, but the problem in another side. you can move annotation (0, 0) close to other annotations so that it can fit. And in this case it will not work also, it will show only two of them which close to 180 longitude. You should take into account span of longitude and latitude instead of calculating min/max of longitudes.
try to change array of annotations to these and you will see that it doesn't work correct:
it's possible now to fit all three markers, but showAnnotations show only two of them.
In my opinion you should calculate span of latitude/longutude, set center and zoom appropriately
[-]Unable to show all longitudes in portrait orientation[/-][+]-[MGLMapView showAnnotations:] should span the antimeridian[/+]1ec5 commentedon Apr 13, 2017
That’s a good point, @ab-rdarts! I’ve retitled this issue to reflect the fact that
-showAnnotations:should be able to straddle the antimeridian if necessary. (Another use case would be showing a single polyline annotation corresponding to the borders of Russia.) This would requirembgl::Map::cameraForLatLngs()to be able to straddle the antimeridian as well.1ec5 commentedon Apr 14, 2017
Fixed in #8744.