I'm looking for a .NET library or wrapper for Google Maps, that contains all the types of responses as C# classes.
I want to be able to do something like:
var url = "http://maps.googleapis.com/maps/api/geocode/json?address=Wellington&sensor=false";
//Utility functions would be ideal
string jsonResponse = GoogleMaps.GetJson(url);
string jsonResponse = GoogleMaps.GeocodeAddress("Wellington");
I would like to be able to use the results like:
GeocodeResponse r = JsonConvert.DeserializeObject<GeocodeResponse>(jsonResponse); //I am using Json.NET
if(r.status.Equals("OK"))
{
DoSomethingWith(r.result.formatted_address); //intellisense documentation for all the bits in the result would be great
}
Does such a thing exist?
This is sort of like these questions:
which is the best .net library for google maps api?
Best .NET Wrapper for Google Maps or Yahoo Maps?
However the answers there are not what I am meaning, I'm not looking for a drag and drop map control.
A web page or application displays a map using the Maps JavaScript API.
As mentioned, you won't be charged for your Google Maps API usage until you turn on auto-billing. The free trial limits you to $300 in credit over 90 days. API users also get $200 of credit per month toward API requests, equal to 100,000 static map requests or around 28,000 dynamic map requests per month.
This API is still in development but may provide you with what you are looking for:
http://code.google.com/p/gmaps-api-net/
.NET wrapper libraries for the Google Maps API :
gmaps-api-net is outdated (at this time of answering) - the last update for the Directions API was made in 2016.
Usage example for GoogleApi:
using GoogleApi.Entities.Common;
using GoogleApi.Entities.Maps.Directions.Request;
using GoogleApi.Entities.Maps.Directions.Response;
public void GetRoute()
{
DirectionsRequest request = new DirectionsRequest();
request.Key = "AIzaSyAJgBs8LYok3rt15rZUg4aUxYIAYyFzNcw";
request.Origin = new Location("Brasov");
request.Destination = new Location("Merghindeal");
var response = GoogleApi.GoogleMaps.Directions.Query(request);
Console.WriteLine(response.Routes.First().Legs.First().DurationInTraffic);
Console.WriteLine(response.Routes.First().Legs.First().Distance);
Console.WriteLine(response.Routes.First().Legs.First().Steps);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With