![](/img/trans.png)
[英]In C#, how do I get a nearest place from Bing Maps from a longitude and latitude value?
[英]Search bing maps with latitude and longitude - c#
當前,無論何時選擇位置,我都會調用以下方法。
我不想通過傳遞城市名稱作為參數來搜索,而是想使用緯度和經度來搜索位置。
我將檢索所選城市的經度和緯度。
我將如何修改此代碼以獲得此代碼?
謝謝
private void xgrdLocation_SelectedItemChanged(object sender, SelectedItemChangedEventArgs e)
{
this.Cursor = Cursors.AppStarting;
lblFooter.Content = "Searching ...";
pushpin = new MapPushpin();
if (xgrdLocation.SelectedItem != null)
{
City selectedCity = xgrdLocation.SelectedItem as City;
//GeocodeService.Location point = new GeocodeService.Location();
pushpin.Text = selectedCity.CityName;
searchDataProvider.Search(pushpin.Text);
//lblSelectedCity.Content = selectedCity.CityName;
}
}
如果您想獲取經度/緯度值所在的城市,則可以使用反向地理編碼。 Bing Maps REST位置API具有此功能。 https://msdn.microsoft.com/en-us/library/ff701710.aspx
您還可以在這里找到有關如何在.NET中使用REST服務的文檔: https : //msdn.microsoft.com/zh-cn/library/jj819168.aspx
不確定,但是看起來您可能正在應用程序中使用舊的舊SOAP服務來進行地理編碼。 避免使用SOAP服務,因為它們過時,緩慢並且即將終止生命。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.