//Use google API to show POI HttpClient client = new HttpClient(); string baseUrl = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" + position.Coordinate.Latitude + "," + position.Coordinate.Longitude + "&radius=1000&keyword=hospital&key=AIzaSyBCccOYAea2ITvgqNpIHcutuExQwzQctCk"; string googleResult = await client.GetStringAsync(baseUrl); //Parse JSON data JObject obj = JObject.Parse(googleResult); JArray jarr = (JArray)obj["results"]; foreach(var item in jarr) { string name = (string)item.SelectToken("name"); double lt = (double)item.SelectToken("geometry.location.lat"); double lg = (double)item.SelectToken("geometry.location.lng"); //Create a small circle to mark the current location. Ellipse myCircle2 = new Ellipse(); myCircle2.Fill = new SolidColorBrush(Colors.Red); myCircle2.Height = 10; myCircle2.Width = 10; myCircle2.Opacity = 50; // Create a MapOverlay to contain the circle. MapOverlay myLocationOverlay2 = new MapOverlay(); myLocationOverlay2.Content = myCircle2; myLocationOverlay2.PositionOrigin = new Point(0.5, 0.5); GeoCoordinate myGeoCoordinate2 = new GeoCoordinate(lt, lg); myLocationOverlay2.GeoCoordinate = myGeoCoordinate2; // Create a MapLayer to contain the MapOverlay. MapLayer myLocationLayer2 = new MapLayer(); myLocationLayer2.Add(myLocationOverlay2); // Add the MapLayer to the Map. Bmap.Layers.Add(myLocationLayer2); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)