ICivicAddressResolver.ResolveAddress Method (GeoCoordinate)

.NET Framework (current version)
 

Resolves a GeoCoordinate to a civic address synchronously.

Namespace:   System.Device.Location
Assembly:  System.Device (in System.Device.dll)

Function ResolveAddress (
	coordinate As GeoCoordinate
) As CivicAddress

Parameters

coordinate
Type: System.Device.Location.GeoCoordinate

The latitude/longitude location to resolve to an address.

The following example shows how to call ResolveAddress.

Imports System.Device.Location
Module ResolveAddressSync

    Public Sub ResolveAddressSync()
        Dim watcher As GeoCoordinateWatcher
        watcher = New System.Device.Location.GeoCoordinateWatcher(GeoPositionAccuracy.High)
        Dim started As Boolean = False
        watcher.MovementThreshold = 1.0     'set to one meter
        started = watcher.TryStart(False, TimeSpan.FromMilliseconds(1000))

        Dim resolver As CivicAddressResolver = New CivicAddressResolver()
        If started Then
            If Not watcher.Position.Location.IsUnknown Then
                Dim address As CivicAddress = resolver.ResolveAddress(watcher.Position.Location)
                If Not address.IsUnknown Then
                    Console.WriteLine("Country: {0}, Zip: {1}",
                                address.CountryRegion,
                                address.PostalCode)
                Else
                    Console.WriteLine("Address unknown.")
                End If
            End If
        Else
            Console.WriteLine("GeoCoordinateWatcher timed out on start.")
        End If
    End Sub


    Public Sub Main()

        ResolveAddressSync()
        Console.WriteLine("Enter any key to quit.")
        Console.ReadLine()
    End Sub

End Module

.NET Framework
Available since 4.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: