private void Start() { // Get map corners Vector2 topLeft = OnlineMaps.instance.topLeftPosition; Vector2 bottomRight = OnlineMaps.instance.bottomRightPosition; // Create OSM Overpass request where highway is primary or residential string requestData = String.Format("node({0},{1},{2},{3});way(bn)[{4}];(._;>;);out;", bottomRight.y, topLeft.x, topLeft.y, bottomRight.x, "'highway'~'primary|residential'"); // Send request and subscribe to complete event OnlineMapsOSMAPIQuery.Find(requestData).OnComplete += OnComplete; }
private void SendRequest() { if (osmRequest != null || string.IsNullOrEmpty(requestData)) { return; } osmRequest = OnlineMapsOSMAPIQuery.Find(requestData); osmRequest.OnComplete += OnBuildingRequestComplete; if (OnRequestSent != null) { OnRequestSent(); } lastRequestTime = Time.time; requestData = null; }
private void LoadNewBuildings() { Vector2 tl = OnlineMapsUtils.TileToLatLong(topLeft, api.zoom); Vector2 br = OnlineMapsUtils.TileToLatLong(bottomRight, api.zoom); string requestData = String.Format("node({0},{1},{2},{3});way(bn)[{4}];(._;>;);out;", br.y, tl.x, tl.y, br.x, "'building'"); if (OnPrepareRequest != null) { requestData = OnPrepareRequest(requestData, tl, br); } OnlineMapsOSMAPIQuery.Find(requestData).OnComplete += OnBuildingRequestComplete; if (OnRequestSent != null) { OnRequestSent(); } }