0

Hi I am working on an Indoor application for IOS application.I am trying to get latitudes,longitudes and altitudes.When I test the device the starting altitude value comes around

3.67853-first floor(starting point)

3.665541-second floor

3.538336-Ground floor

From the above values it is hard to know which floor the user is.Is there a way to get the correct altitude.

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
    {
        // 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();
}
zyonneo
  • 1,319
  • 5
  • 25
  • 63
  • What do you mean by 'get the correct altitude'? Why are the above posted alts wrong? Hard to guess without knowing your use case - maybe i did not got you? – nilsK Oct 17 '18 at 12:14
  • @nilsK Hey In the second floor the value becomes less and while going to ground floor also the value decreases.With respect to ground.Somehow set ground to 0 and from there value increases – zyonneo Oct 17 '18 at 12:31
  • Double check your gps signal quality/accuracy. Are you sure, these are 'good' positions? Also check if your altitude values are [MSL or AGL](https://en.wikipedia.org/wiki/Altitude). Seems you want AGL, but i don't know, if you can force your device to return AGL via configuration. – nilsK Oct 17 '18 at 12:58
  • Yes but for indoor GPS values are not accurate right.For unity is there any was to get the AGL?Without that we cannot know which level the user is currently in. – zyonneo Oct 17 '18 at 13:18
  • 1
    Yes, accuracy indoor is a problem. I am not into unity and i believe this has more to do with your device / gps-driver then a framework or programming language - but this is guessing, not knowing! Coming from a company that develops telematik software i have some experience with gps, thats why i could say something to your problem - i dont have a solution for you, sorry. Just wanted to share some thoughts :) – nilsK Oct 17 '18 at 13:58

0 Answers0