Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How show name of place on the map?

KymusKymus Member ✭✭

Can I show name of place on the map like this
I use Xamarin.Forms.Maps. And if I can how I can do it?

Answers

  • ColeXColeX Member, Xamarin Team Xamurai
    edited October 27

    First you need to get the position of the place , and then use Xamarin.Essentials: Geocoding , you can get placemark (contains place name) from the coordinate .

    Simple usage

    var lat = 47.673988;
    var lon = -122.121513;
    
    var placemarks = await Geocoding.GetPlacemarksAsync(lat, lon);
    
    var placemark = placemarks?.FirstOrDefault();
    if (placemark != null)
    {
        var geocodeAddress =
            $"AdminArea:       {placemark.AdminArea}\n" +
            $"CountryCode:     {placemark.CountryCode}\n" +
            $"CountryName:     {placemark.CountryName}\n" +
            $"FeatureName:     {placemark.FeatureName}\n" +
            $"Locality:        {placemark.Locality}\n" +
            $"PostalCode:      {placemark.PostalCode}\n" +
            $"SubAdminArea:    {placemark.SubAdminArea}\n" +
            $"SubLocality:     {placemark.SubLocality}\n" +
            $"SubThoroughfare: {placemark.SubThoroughfare}\n" +
            $"Thoroughfare:    {placemark.Thoroughfare}\n";
    
        Console.WriteLine(geocodeAddress);
    }
    
    
  • KymusKymus Member ✭✭

    @ColeX So after used Xamarin.Essentials: Geocoding I can see name of this place on the map? Becouse I think with Geocoding I can find only information about place, but dont add name of place on the map. If I think wrong, please, tell me about it

  • ColeXColeX Member, Xamarin Team Xamurai
  • KymusKymus Member ✭✭

    @ColeX NO, I dont want to use information window for place. I want to show all names of places on the map like in Google Map. I sent photo what I want

  • ColeXColeX Member, Xamarin Team Xamurai

    I notice the map shows place name by default , what specific place name do you want to show ?

Sign In or Register to comment.