Mapbox-gl-js: setCenter ignores latitude

Created on 14 Jul 2016  路  2Comments  路  Source: mapbox/mapbox-gl-js

mapbox-gl-js version:
0.21.0

JSBin Link: http://jsbin.com/kakesehole/edit?html,output

Steps to Trigger Behavior

  1. Create a default map
  2. Use map.setCenter, passing an array of [long, lat] like specified.

    Expected Behavior

    The map is centered on your given long, lat.

    Actual Behavior

    The map is centered on the given longitude, but the latitude is 0.

Most helpful comment

When you call setCenter([0, 50]), the map is at zoom level 0, at which point the range of possible center latitudes is constrained by the height of the viewport. If you switch the order of calls such that the zoom is set to 5 first, it will work as you expect.

All 2 comments

When you call setCenter([0, 50]), the map is at zoom level 0, at which point the range of possible center latitudes is constrained by the height of the viewport. If you switch the order of calls such that the zoom is set to 5 first, it will work as you expect.

@jfirebaugh this should be documented. I wasted a day debugging the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

samanpwbb picture samanpwbb  路  3Comments

bgentry picture bgentry  路  3Comments

rasagy picture rasagy  路  3Comments

PBrockmann picture PBrockmann  路  3Comments

aendrew picture aendrew  路  3Comments