Skip to content

arex388/Arex388.GoogleMaps

Repository files navigation

Arex388.GoogleMaps

A C# client for Google Maps API.

Yet another implementation of the Google Maps API. To use, just create an instance of GoogleMapsClient and pass in an HttpClient instance along with your API key. The original documentation can be found here. For more information please visit arex388.com.

Available as a NuGet package here.

Important

v2.1.0

Version 2.1.0 is the same as v2.0.0, except it removes all code marked as deprecated in v2.0.0, so it is a version with breaking changes.

v2.0.0

Version 2.0.0 is a rewrite of the client implementation and sets up the package for breaking changes in 2.1.0. Specifically, all Get* methods are deprecated and will be removed in 2.1.0. Switch to the new methods as directed to benefit from the memory and performance improvements.

How to Use

You can either create an instance of GoogleMapsClient or inject it using the IGoogleMapsClient interface through dependency injection. A dependency injection package is now available to make it easy to do that.

var googleMaps = new GoogleMapsClient(
    httpClient,
    "{key}"
);

Distance Matrix

var distanceMatrix = await googleMaps.DistanceMatrixAsync(
    "1600 Pennsylvania Ave NW, Washington, DC 20500",
    "East Capitol St NE & First St SE, Washington, DC 20004"
);

Elevation

var elevation = await googleMaps.ElevationAsync(
    "38.897675,-77.036547"
);

Geocode

var geocode = await googleMaps.GeocodeAsync(
    "1600 Pennsylvania Ave NW, Washington, DC 20500"
);

Reverse Geocode

var reverseGeocode = await googleMaps.ReverseGeocodeAsync(
    "38.897675,-77.036547"
);

Time Zone

var timeZone = await googleMaps.TimeZoneAsync(
    "38.897675,-77.036547"
);

About

Google Maps API Implementation in C#

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages