// Load predefined locations from the CORE
 private void LoadPredefinedPinLocation()
 {
     foreach (CORE.LocationInfo L in CORE.LOCATION_DATABASE)
     {
         tempPinCoord.Add(CORE.ECEFCoordinateFromLatLong(L.coord, CORE.EARTH_PREFAB_RADIUS));
     }
 }
    private IEnumerator LoadGPS()
    {
        if (!Input.location.isEnabledByUser)
        {
            Debug.Log("Location service is not enabled: Using default location - UK.");

            tempPinCoord.Add(CORE.ECEFCoordinateFromLatLong(CORE.USER_LATLONG, CORE.EARTH_PREFAB_RADIUS));
            LoadPredefinedPinLocation();
            GeneratePins();
            ComputeRotation();
            dataInitialised        = true;
            CORE.PIN_ASSIGNED_FLAG = true;
            yield break;
        }

        // Initialise location service
        Input.compass.enabled = true;
        Input.location.Start();

        int maxWait = 20;

        // Use default value if failed
        while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
        {
            yield return(new WaitForSeconds(1));

            maxWait--;
        }

        if (maxWait < 1)
        {
            Debug.Log("Timeout: Using default location - UK.");
            yield return(false);
        }

        if (Input.location.status == LocationServiceStatus.Failed)
        {
            Debug.Log("Unable to get location information: Using default location - UK.");
            yield return(false);
        }
        else
        {
            // Use values from the GPS
            CORE.USER_LATLONG = new Vector2(Input.location.lastData.latitude, Input.location.lastData.longitude);

            // Add current location to the list for futher computation
            tempPinCoord.Add(CORE.ECEFCoordinateFromLatLong(CORE.USER_LATLONG, CORE.EARTH_PREFAB_RADIUS));

            // Add featured location values to the list
            LoadPredefinedPinLocation();

            // Generate pins based on given values
            GeneratePins();

            // Compute the rotation required for rotating the current location to the top
            ComputeRotation();

            // Generate labels
            GenerateLabels();

            dataInitialised        = true;
            CORE.PIN_ASSIGNED_FLAG = true;
        }

        Input.location.Stop();

        yield return(null);
    }