Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Position.fromCoordinate() to fromLngLat() #283

Closed
1ec5 opened this issue Jan 23, 2017 · 0 comments
Closed

Rename Position.fromCoordinate() to fromLngLat() #283

1ec5 opened this issue Jan 23, 2017 · 0 comments
Assignees
Labels
Milestone

Comments

@1ec5
Copy link
Contributor

1ec5 commented Jan 23, 2017

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.

/cc @zugaldia @cammace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants