Svrnty.GeoManagement.Google 0.2.3

dotnet add package Svrnty.GeoManagement.Google --version 0.2.3
                    
NuGet\Install-Package Svrnty.GeoManagement.Google -Version 0.2.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Svrnty.GeoManagement.Google" Version="0.2.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Svrnty.GeoManagement.Google" Version="0.2.3" />
                    
Directory.Packages.props
<PackageReference Include="Svrnty.GeoManagement.Google" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Svrnty.GeoManagement.Google --version 0.2.3
                    
#r "nuget: Svrnty.GeoManagement.Google, 0.2.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Svrnty.GeoManagement.Google@0.2.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Svrnty.GeoManagement.Google&version=0.2.3
                    
Install as a Cake Addin
#tool nuget:?package=Svrnty.GeoManagement.Google&version=0.2.3
                    
Install as a Cake Tool

Svrnty.GeoManagement.Google

Google Geocoding API provider implementation for the Svrnty.GeoManagement library.

Installation

Add reference to this project or install via NuGet (when published).

Configuration

Using appsettings.json

{
  "GoogleGeoManagement": {
    "ApiKey": "your-google-api-key-here",
    "Language": "en",
    "Region": "us"
  }
}

Register in Dependency Injection

using Svrnty.GeoManagement.Google.Extensions;

// In your Program.cs or Startup.cs
builder.Services.AddGoogleGeoManagement(
    builder.Configuration.GetSection("GoogleGeoManagement"));

Manual Configuration

builder.Services.AddGoogleGeoManagement(options =>
{
    options.ApiKey = "your-google-api-key-here";
    options.Language = "en";
    options.Region = "us";
});

Usage

using Svrnty.GeoManagement.Abstractions.Abstractions;
using Svrnty.GeoManagement.Abstractions.Models;

public class MyService
{
    private readonly IGeoManagementProvider _geoProvider;

    public MyService(IGeoManagementProvider geoProvider)
    {
        _geoProvider = geoProvider;
    }

    public async Task Example()
    {
        // Forward geocoding - address to coordinates
        var address = new Address(
            Line1: "1600 Amphitheatre Parkway",
            Line2: null,
            City: "Mountain View",
            Subdivision: "CA",
            PostalCode: "94043",
            Country: "US",
            Location: null,
            Note: null);

        var geoPoint = await _geoProvider.GetGeoPointAsync(address);
        Console.WriteLine($"Coordinates: {geoPoint?.Latitude}, {geoPoint?.Longitude}");

        // Reverse geocoding - coordinates to address
        var location = new GeoPoint(37.4224764, -122.0842499);
        var foundAddress = await _geoProvider.ReverseGeocodeAsync(location);
        Console.WriteLine($"Address: {foundAddress?.GetFormattedAddress()}");

        // Normalize address
        var normalized = await _geoProvider.NormalizeAddressAsync(address);
        Console.WriteLine($"Normalized: {normalized?.GetFormattedAddress()}");

        // Normalize from string
        var normalizedFromString = await _geoProvider.NormalizeAddressAsync(
            "1600 Amphitheatre Parkway, Mountain View, CA");
        Console.WriteLine($"Normalized: {normalizedFromString?.GetFormattedAddress()}");
    }
}

Configuration Options

  • ApiKey (required): Your Google Maps API key
  • Language (optional): Language code for results (e.g., "en", "fr", "de")
  • Region (optional): Region code for biasing results (e.g., "us", "uk", "ca")

Requirements

  • .NET 8.0
  • Google Maps API key with Geocoding API enabled
  • Internet connection for API calls

Error Handling

The provider returns null for operations that fail (e.g., invalid address, API errors, network issues). All errors are logged using ILogger<GeoManagementGoogleProvider>.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.3 201 10/8/2025
0.2.2 192 10/8/2025
0.2.1 182 10/8/2025
0.2.0 193 10/8/2025
0.1.0 188 10/6/2025
0.1.0-test2 182 10/6/2025