.NET Library for Google Maps API support
Asked Answered
E

2

12

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:

However the answers there are not what I am meaning, I'm not looking for a drag and drop map control.

Engross answered 13/3, 2011 at 7:59 Comment(0)
C
3

This API is still in development but may provide you with what you are looking for:

http://code.google.com/p/gmaps-api-net/

Cracy answered 14/3, 2011 at 9:15 Comment(1)
gmaps-api-net (now on GitHub) is outdatedInnuendo
I
3

.NET wrapper libraries for the Google Maps API :

  1. GoogleApi
  2. google-maps

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);
}
Innuendo answered 30/4, 2020 at 20:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.