Page 1 of 1

Geolocation, less decimals in readings.

Posted: Wed Jul 24, 2019 9:14 am
by Lars Holtet

Hi,

Are there a way to get less decimals on the gelocation callings? Here i have lat/long and height.

Image


Geolocation, less decimals in readings.

Posted: Wed Jul 24, 2019 9:33 am
by Lars Holtet

Also, is there an easy way to report adress?


Geolocation, less decimals in readings.

Posted: Wed Jul 24, 2019 2:35 pm
by Serhii Kulibaba

Hello,

Of course, you can reduce the decimals with a simple JS codeprevar a = 1.23456789;
var b = Math.round(a * 100) / 100;/pre
here you will get 1.23 value in the variable "b". You can control a number of digits by changing 100 to 1000 (you will get 1.234) and so on


Geolocation, less decimals in readings.

Posted: Mon Jul 29, 2019 8:19 am
by Lars Holtet

Thanks! And where do i implement this?


Geolocation, less decimals in readings.

Posted: Mon Jul 29, 2019 8:23 am
by Serhii Kulibaba

Please add this code to the mapping your lattitude/longitude values to labels: https://docs.appery.io/docs/appbuilde...

Your code should be:prereturn Math.round(value * 100) / 100;/pre


Geolocation, less decimals in readings.

Posted: Mon Jul 29, 2019 12:45 pm
by Lars Holtet

Thanks! Worked like a charm!