APICalls() { Debug.Log("API Calls being made"); osmMapData = await Task.Run(() => api.GetOsmMap()); //working mapBounds = await Task.Run(() => api.GetMapBounds()); //working Debug.Log("Datapoint getting"); dataPointId = await Task.Run(() => api.GetPointLocations()); models = await Task.Run(() => api.GetModels()); try { histMapContainer = api.GetHistMap(); historyMapData = histMapContainer.MapData; historyMap = gWorld.LoadDataIntoTexture(historyMapData); } catch (Exception e) { Debug.Log("Historical map not found: " + e); // This means there was no historical map in the db } goForApi = true; }
/// <summary> /// Sets the map bounds from an api call /// </summary> private void GetMapBounds() { var mapBounds = api.GetMapBounds(); BotRight = new Vector2((float)mapBounds[0]["longitude"], (float)mapBounds[0]["latitude"]); TopLeft = new Vector2((float)mapBounds[1]["longitude"], (float)mapBounds[1]["latitude"]); }