Get The Street Address Using GPS Co-ordinates In Windows 10 UWP

Create new Windows 10 project and choose the map control from toolbox list.

Geo Location API allows easy to access a device’s current location. Here we will see how to get the longitude and latitude co-ordinates of the device.

Firstly, enable the location capabilities to allow the device to access the location like the following screen,


Next add the namespace in you code page.

  1. using Windows.Devices.Geolocation;  
  2. using Windows.Services.Maps;  
Create new instance for Geolocator using that we can retrieve the position of our device. Then add the location coordinates points to our map control.

Write the following code to set your position to the map control.
  1. var geolocator = new Geolocator();  
  2. var position = await geolocator.GetGeopositionAsync();  
  3. mymap.Center = position.Coordinate.Point;  
  4. mymap.ZoomLevel = 15;  
Set the map zoom level according to your needs and you will get the co-ordinates of the current position.

Next we are going to get the current street address of the position using the coordinates.

You will get the following details also:


  • BuildingFloor
  • BuildingName
  • BuildingRoom
  • BuildingWing
  • Continent
  • Country
  • CountryCode
  • District
  • FormattedAddress
  • Neighborhood
  • PostCode
  • Region
  • RegionCode
  • Street
  • StreetNumber
  • Town

Write the following code to get the address of the street.

  1. var mapLocation = await MapLocationFinder.FindLocationsAtAsync(position.Coordinate.Point);  
  2. if (mapLocation.Status == MapLocationFinderStatus.Success)  
  3. {  
  4.    string address = mapLocation.Locations[0].Address.StreetNumber + " " + mapLocation.Locations[0].Address.Street;  
  5. }  
  6. else  
  7. {  
  8.    dialog.Content = "Not Found";  
  9. }  
Now run the app and see the output like the following screen.

Run Program


Up Next
    Ebook Download
    View all
    View all