public MapService GetService() { try { using (var client = new HttpClient()) { var response = client.GetAsync(ArcGisUrl + "?f=json").Result; if (response.IsSuccessStatusCode) { var responseContent = response.Content; var responseString = responseContent.ReadAsStringAsync().Result; var parser = new ArcGisOnlineParser(); var mapService = parser.ParseSpecification(responseString); return(mapService); } } } catch (Exception) { //handle error; throw; } return(null); }
public IEnumerable <Layer> GetQueriableLayers() { try { using (var client = new HttpClient()) { var response = client.GetAsync(ArcGisUrl + "layers?f=json&pretty=true").Result; if (response.IsSuccessStatusCode) { var responseContent = response.Content; var responseString = responseContent.ReadAsStringAsync().Result; var parser = new ArcGisOnlineParser(); var layers = parser.ParseQueriableLayers(responseString); return(layers); } } } catch (Exception) { //handle error; throw; } return(null); }
public string GetMapImage([FromUri] BoundingBox bbox) { try { using (var client = new HttpClient()) { var response = client.GetAsync(ArcGisUrl + "export?f=json&bbox=" + bbox).Result; if (response.IsSuccessStatusCode) { var responseContent = response.Content; var responseString = responseContent.ReadAsStringAsync().Result; var parser = new ArcGisOnlineParser(); var url = parser.ParseMapImageUrl(responseString); return(url); } } } catch (Exception) { //handle error; throw; } return(null); }