如何在Windows Phone 8.1中使用查询API获取附近的位置 [英] How to get nearby locations using query API in windows phone 8.1

查看:60
本文介绍了如何在Windows Phone 8.1中使用查询API获取附近的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此查询api 如何在Windows Phone 8.1中将附近的地方放到我们的mapcontrol中.当我从上面的链接放置代码时,它显示404错误(即找不到资源).

Using this query api how to get the nearby places in to our mapcontrol in windows phone 8.1. When I placed the code from the above link it shows the 404 error (i.e resource not found).

我有必应地图键.但是如何放置访问标识.数据源的命名方式.请帮助我.

I got bing maps key. But how to place the access id. How the data source are named. Please help me.

string BingMapsKey = "MY_BING_MAPS_KEY";

string DataSourceID = "20181f26d9e94c81acdf9496133d4f23";


string dataSourceName = "petrolbunk";
string dataEntityName = "petrolbunk";
string accessId = DataSourceID;
string bingMapsKey = BingMapsKey;
double SearchLatitude = 47.63674;
double SearchLongitude = -122.30413;
double Radius = 3;

string requestUrl1 = string.Format("http://spatial.virtualearth.net/REST/v1/data/{0}/{1}/{2}" + "?spatialFilter=nearby({3},{4},{5})&key={6}", accessId, dataSourceName,
dataEntityName, SearchLatitude, SearchLongitude, Radius, bingMapsKey);

HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

HttpResponseMessage response = await client.GetAsync(requestUrl1);
if (response.IsSuccessStatusCode)
{
    var data = response.Content.ReadAsStringAsync();

上面的网址布局是否正确?如何在我们的地图控件中显示它们.

Is the above url layout is correct. How to display them in our map control.

推荐答案

查看您的帐户,看来没有任何数据源可通过

Taking a look into your account it doesn't look like there is any data source that can be accessed at

http://spatial.virtualearth.net/REST/v1/数据/20181f26d9e94c81acdf9496133d4f23/petrolbunk/petrolbunk

您是否创建了数据源?如果有,请在Bing Maps门户中,转至数据源"->查看数据源"信息.找到您要访问的数据源并复制完整的URL(您无需将其分解为多个部分,即accessId,数据源名称,实体名称).

Have you created a data source? If you have, in the Bing Maps portal, go to Data Sources -> View Data source information. Find the data source you want to access and copy the complete URL (you don't need to break it up into pieces i.e. accessId, data source name, entity name).

如果要访问Bing Maps中的兴趣点数据源之一,请查看NAVTEQNA数据源:

If you want to access one of the point of interest data sources in Bing Maps, then take a look at the NAVTEQNA data source: https://msdn.microsoft.com/en-us/library/hh478192.aspx

这篇关于如何在Windows Phone 8.1中使用查询API获取附近的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆