function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Force.comForce.com 

Get Lat/Lon using salesforce standard javascript library

Hi,

 

http://na7.salesforce.com/mobileclient/api/mobileforce.js

With the help of the above javascript library, I was getting the latitudes and longitides of the mobile device (iPhone). However, the values of lat/lon which the app is pulling is something like this:

 

14.94669000000000, -88.239319000000000.

 

I need to get better accuracy into the red zeros. Is it possible to capture more than 6 decimal points ?

 

Thanks,

Pragati


 

 

SRKSRK

U can  try this

function maxDecimalValue(precision, scale){
   
returnMath.pow(10,precision-scale)-Math.pow(10,-scale);
}

precision must be positive

maxDecimalValue(5,3)=10^(5-3)-10^-3=100-1/1000=99.999
maxDecimalValue
(1,0)=10^1-10^0=10-1=9
maxDecimalValue
(1,-1)=10^(1+1)-10^1=100-10=90
maxDecimalValue
(2,-3)=10^(2+3)-10^3=100000-1000=99000
Force.comForce.com

Hi SRK,

 

Thanks a lot for quick response. 

I am not able to understand why we should use maxDecimalValue method. I need to get the exact Latitude and longitude values of the device. How will I get the correct value using the method you suggested ?

 

Thanks,

Pragati

SRKSRK

I am sry i thought that javascript var is not able to hold values after decimal & bcoz of that u r not getting exact Latitude and longitude

Force.comForce.com

Hi SRK,

 

Please suggest what should I do to get more than 6 decimal values of Lat/Lon

 

Thanks,

Pragati