IEnumerator getMap() { // Google maps static map api: https://developers.google.com/maps/documentation/static-maps/intro // Google maps styling wizard: https://mapstyle.withgoogle.com/ url = "https://maps.googleapis.com/maps/api/staticmap?center=" + GPSController.Instance.userWorldLocation.z + "," + GPSController.Instance.userWorldLocation.x + "&zoom=" + Zoom + "&size=" + width + "x" + height + "&scale=" + scale + "&maptype=" + selectedMapType + "&key=" + Application.googleApiKey + mapStyle; foreach (GameObject go in MarkerController.Instance.markers) { if (go.GetComponent <Marker>().data.visible) { url += "&markers=color:red%7Clabel:M%7C" + go.GetComponent <Marker>().data.worldCoords.z + "," + go.GetComponent <Marker>().data.worldCoords.x; } } if (GPSController.Instance.userLocationStable) { wwwController wCtrl = gameObject.AddComponent <wwwController>(); yield return(StartCoroutine(wCtrl.wwwRequest(url))); image.texture = wCtrl.www.texture; Destroy(wCtrl); } yield return(null); }
private IEnumerator getSearchResults(string url) { wwwController wCtrl = gameObject.AddComponent <wwwController>(); yield return(StartCoroutine(wCtrl.wwwRequest(url))); yield return(StartCoroutine(JSONDecodeGoogleSearchResponse(wCtrl.www.text))); Destroy(wCtrl); }
// set elevation to worldCords Vector3 variable IEnumerator getGoogleElevation() { string url = "https://maps.googleapis.com/maps/api/elevation/json?locations=" + userWorldCoords.z.ToString() + "," + userWorldCoords.x.ToString() + "&key=" + googleApiKey; wwwController wCtrl = gameObject.AddComponent <wwwController>(); yield return(StartCoroutine(wCtrl.wwwRequest(url))); userWorldCoords.y = JSONDecodeGoogleElevation(wCtrl.www.text); Destroy(wCtrl); }