Address Lookup

The Geocoding API supports searching for an address, in which case the API will responds with the place or places that match the address.

The example below shows how you can use the GeocodeAsync method to search for the address of our Vejle office:

@using Skybrud.Social.Google.Geocoding
@using Skybrud.Social.Google.Geocoding.Models
@using Skybrud.Social.Google.Geocoding.Responses
@inherits Microsoft.AspNetCore.Mvc.Razor.RazorPage<Skybrud.Social.Google.GoogleHttpService>

@{

    // Make the request to the Geocoding API
    GeocodingResultListResponse response = await Model
        .Geocoding()
        .GeocodeAsync("Spinderigade 11a, 7100 Vejle");

    // Iterate through the result
    foreach (GeocodingResult result in response.Body.Results) {

        <p>
            <strong>@result.PlaceId</strong><br />
            @result.FormattedAddress <small>(@string.Join(", ", result.Types))</small>
        </p>

    }

}