I am using GMap.net library and I get the address, but I get the result I don't want.
example : the address i took out
2QRR+26 Cầu Giấy, Hà Nội
Expected actual address :
108 Nguyễn Phong Sắc, Dịch Vọng, Cầu Giấy, Hà Nội
This is the location information I got on the website google map : https://i.stack.imgur.com/cqgpw.png
This is my code :
private void gmap_OnMapClick(PointLatLng pointClick, MouseEventArgs e)
{
var address = getAddressFromMap(pointClick);
if (address != null)
{
rtbResultAddressGG.Text = "\nAddress : " + address[0];
}
else
{
MessageBox.Show("Unable to get the address !", "");
}
}
private List<String> getAddressFromMap(PointLatLng point)
{
StringBuilder stringBuilder = new StringBuilder();
List<Placemark> placemarks = null;
var sttCode = GMapProviders.GoogleMap.GetPlacemarks(point, out placemarks);
if (sttCode == GeoCoderStatusCode.OK && placemarks != null)
{
List<String> address = new List<string>();
foreach (var placemark in placemarks)
{
address.Add(placemark.Address);
}
return address;
}
return null;
}