Skip to content

Commit

Permalink
Truncate lat long to 6 digits (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass authored Nov 8, 2023
1 parent 76804c3 commit fe7f5a0
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit fe7f5a0

Please sign in to comment.