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

Truncate lat long to 6 digits #476

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/metadata-service/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ class WithRes8LatLgn extends Model {
try {
const res8 = cellToParent(new BN(this.location).toString("hex"), 8);
const [latRes8, longRes8] = cellToLatLng(res8);
this._lat = latRes8;
this._long = longRes8;
if (latRes8) {
this._lat = Number(latRes8.toFixed(6));
}
if (longRes8) {
this._long = Number(longRes8.toFixed(6));
}
} catch (e: any) {
console.error("Invalid location", e);
}
Expand Down
Loading