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" />
<PackageReference Include="Svrnty.GeoManagement.Google" />
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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
#tool nuget:?package=Svrnty.GeoManagement.Google&version=0.2.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
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 | Versions 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.
-
net8.0
- GoogleApi (>= 5.8.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Svrnty.GeoManagement.Abstractions (>= 0.2.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.