obito1406 obito1406 - 2 years ago 214
C# Question

google maps API for C#

im really new in to using APIs so after looking on google maps Api page im not sure if there are APIs designed to be used for C#. I dont need a google maps to be show on my app all i need to know if i can use the google maps API on C#.
This is the one i will like to use

Ive look for it on many places but all i could find was alternatives to using Gmaps but thats not what i want.

┬┐It is possible to use it?

Answer Source

Sure you can.

There is no dedicated library I'm aware of. But you can just send HTTP-Requests to the google maps API and then work with the results. You could use WebRequest to forge requests to the google api.

This would be a simple example. You would have to build up the GET parameters eg. origin=...&destination=...&key=YOUR_API_KEY + parse the JSON response to do something with it.

string url = @",+NY&destination=MetLife+Stadium+1+MetLife+Stadium+Dr+East+Rutherford,+NJ+07073&key=YOUR_API_KEY";

WebRequest request = WebRequest.Create(url);

WebResponse response = request.GetResponse();

Stream data = response.GetResponseStream();

StreamReader reader = new StreamReader(data);

    // json-formatted string from maps api
string responseFromServer = reader.ReadToEnd();

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download