Hi I am using the below code to the get the Latitudes and Longitudes form an IOS device.The problem is I am getting only upto four points.So I read in blogs we need to use double to get more decimal points and Unity API only supports 4 decimal points or upto 6 decimal points for latitudes .In order to get accurate Lat/Long values we require more decimal points.(Eg:8.8382738239232032,120.23232328347823782323).How to get more decimal values.
void Start ()
{
StartCoroutine(Getdata());
}
IEnumerator Getdata()
{
// First, check if user has location service enabled
if (!Input.location.isEnabledByUser)
yield break;
// Start service before querying location
Input.location.Start();
// Wait until service initializes
int maxWait = 20;
while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
{
yield return new WaitForSeconds(1);
maxWait--;
}
// Service didn't initialize in 20 seconds
if (maxWait < 1)
{
print("Timed out");
yield break;
}
// Connection has failed
if (Input.location.status == LocationServiceStatus.Failed)
{
print("Unable to determine device location");
yield break;
}
else
{
double aa= Input.location.lastData.latitude;
Debug.Log("Double Latitude="+aa);
latitudes = double.Parse(Input.location.lastData.latitude.ToString("R"));
longitudes = double.Parse(Input.location.lastData.longitude.ToString("R"));
altitudes = double.Parse(Input.location.lastData.altitude.ToString("R"));
deviceinfo = SystemInfo.deviceModel;
// Access granted and location value could be retrieved
Locationinformation.text = "Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp;
print("Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp);
}
// Stop service if there is no need to query location updates continuously
Input.location.Stop();
}