Geolocation 反向地理定位器将地址返回为';南极洲';
试图使用GetAddressesForPositionAsync()查找坐标也可以指向的可能地址列表。我使用esri ArcGIS mapping调用该地图,并将其添加到mapview中Geolocation 反向地理定位器将地址返回为';南极洲';,geolocation,xamarin.forms,arcgis,esri,Geolocation,Xamarin.forms,Arcgis,Esri,试图使用GetAddressesForPositionAsync()查找坐标也可以指向的可能地址列表。我使用esri ArcGIS mapping调用该地图,并将其添加到mapview中 Esri.ArcGISRuntime.Mapping.Map myMap = new Esri.ArcGISRuntime.Mapping.Map(SpatialReference.Create(4326)); myMapView = new Esri.ArcGISRuntime.Xamarin.Forms.M
Esri.ArcGISRuntime.Mapping.Map myMap = new Esri.ArcGISRuntime.Mapping.Map(SpatialReference.Create(4326));
myMapView = new Esri.ArcGISRuntime.Xamarin.Forms.MapView();
geoCoder = new Geocoder();
//assign the map to a mapview
myMapView.Map = myMap;
然后使用事件处理程序等待用户双击屏幕
//event handler
myMapView.GeoViewDoubleTapped += new EventHandler<Esri.ArcGISRuntime.Xamarin.Forms.GeoViewInputEventArgs>(geotappedMap);
//the location for the pin and sent to geothings()
double Lat = ((((Esri.ArcGISRuntime.Xamarin.Forms.GeoViewInputEventArgs)e).Location.X));
double Lng = ((((Esri.ArcGISRuntime.Xamarin.Forms.GeoViewInputEventArgs)e).Location.Y));
myLocation = new MapPoint(Lat, Lng);
该函数运行时没有问题,除非调用后标签更新为值“antractia”。有人知道这是为什么或如何发生的吗?您可以添加传递到MapPoint的Lat和Lng值吗。此外,更新该点的空间参考有助于获得更好的结果。是否可以添加传递到MapPoint的Lat和Lng值。此外,将空间参照更新到该点有助于获得更好的结果。
public async void geothings(Object sender, EventArgs e, Position p)
{
try
{
var possibleAddresses = await geoCoder.GetAddressesForPositionAsync(p);
foreach (var address in possibleAddresses)
_label2.Text += "\n\n" + address;
}
catch (Exception ex)
{
await MainPage.DisplayAlert("Error Getting Address", ex.Message, "Close");
}
}