Skip to content

Remove trailing zeros from coordinates#424

Merged
cammace merged 4 commits into
masterfrom
cam-338-fix
Apr 14, 2017
Merged

Remove trailing zeros from coordinates#424
cammace merged 4 commits into
masterfrom
cam-338-fix

Conversation

@cammace

@cammace cammace commented Mar 30, 2017

Copy link
Copy Markdown

closes #338

@cammace cammace self-assigned this Mar 30, 2017
*/
private Position(double longitude, double latitude, double altitude) {
// Used to remove any trailing zeros and prevent a coordinate being over 7 significant figures.
DecimalFormat decimalFormat = new DecimalFormat("0.######");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this same logic is used in several place, how about exposing it as static utility method?

}

public static String formatCoordinate(double coordinate) {
// Used to remove any trailing zeros and prevent a coordinate being over 7 significant figures.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cammace Let's make it a javadoc instead.

public static String formatCoordinate(double coordinate) {
// Used to remove any trailing zeros and prevent a coordinate being over 7 significant figures.
DecimalFormat decimalFormat = new DecimalFormat("0.######", new DecimalFormatSymbols(Locale.US));
return String.format(Locale.US, "%s",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cammace We have a constant for the default locale already.

@zugaldia zugaldia mentioned this pull request Apr 14, 2017
@cammace cammace merged commit d1a263f into master Apr 14, 2017
@cammace cammace deleted the cam-338-fix branch April 14, 2017 17:28
@cammace cammace mentioned this pull request Apr 15, 2017
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When building the directions API call we add trailing zeros to digits

2 participants