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
Position.fromCoordinate() should be deprecated in favor of a fromLngLat() method that takes the same parameters.
Position.fromCoordinate() accepts parameters in longitude, latitude order, consistent with GeoJSON’s Position object. Unfortunately, the Mapbox Android SDK’s LatLng object’s constructor accepts parameters in latitude, longitude order. As a consequence, map camera changes, annotations, anything involving user location, and offline maps all use latitude, longitude order while runtime styling and feature querying both use longitude, latitude order.
It’s quite easy to imagine a scenario where one order is required on one line and the reverse order is required on the following line. But without labeled parameters, it’s too easy for copy-pasta to occur between the two without any way for a code reviewer to spot the mistake. At least if the code reviewer sees LatLng on one line and LngLat on the next line, they’ll know to expect reversed parameters.
Position.fromCoordinate()
should be deprecated in favor of afromLngLat()
method that takes the same parameters.Position.fromCoordinate()
accepts parameters in longitude, latitude order, consistent with GeoJSON’sPosition
object. Unfortunately, the Mapbox Android SDK’sLatLng
object’s constructor accepts parameters in latitude, longitude order. As a consequence, map camera changes, annotations, anything involving user location, and offline maps all use latitude, longitude order while runtime styling and feature querying both use longitude, latitude order.It’s quite easy to imagine a scenario where one order is required on one line and the reverse order is required on the following line. But without labeled parameters, it’s too easy for copy-pasta to occur between the two without any way for a code reviewer to spot the mistake. At least if the code reviewer sees
LatLng
on one line andLngLat
on the next line, they’ll know to expect reversed parameters./cc @zugaldia @cammace
The text was updated successfully, but these errors were encountered: