C# 轻触wp8中的地点标记时显示地点名称
我正试图用google places API在window phone 8地图控件上显示距离我当前位置1公里以内的地方。我正在使用JSON解析获取纬度、经度和名称。现在,我希望在用户点击任意位置圆时,该名称像工具提示一样显示 //使用GoogleAPI显示POIC# 轻触wp8中的地点标记时显示地点名称,c#,windows-phone-8,C#,Windows Phone 8,我正试图用google places API在window phone 8地图控件上显示距离我当前位置1公里以内的地方。我正在使用JSON解析获取纬度、经度和名称。现在,我希望在用户点击任意位置圆时,该名称像工具提示一样显示 //使用GoogleAPI显示POI HttpClient client = new HttpClient(); string baseUrl = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?l
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);
//解析JSON数据
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);
}