【发布时间】:2017-11-01 18:01:11
【问题描述】:
我正在尝试获取地址。到目前为止,我使用
获取坐标 CLLocation loc = new CLLocation(anno.Coordinate.Latitude, anno.Coordinate.Longitude);
但是,我尝试了反向地理编码和地标。它们都不起作用。 以下示例未完成且格式不正确。我只是从swift复制。
async void ReverseGeocodeToConsoleAsync(CLLocation location)
{
var geoCoder = new CLGeocoder();
var placemarks = await
geoCoder.ReverseGeocodeLocationAsync(location);
var placemark = placemarks[0] as CLPlacemark;
var addressString = "";
//String to hold address
var locatedAtcountry = placemark.country;
var locatedAtcity = placemark.locality;
var locatedAtisocountry = placemark.ISOcountryCode;
if (placemark.ISOcountryCode == "TW") /*Address Format in Chinese*/
{
if (placemark.country != null)
{
addressString = placemark.country!
}
}
【问题讨论】:
标签: ios dictionary xamarin mkannotationview renderer