Call the Google Maps API V3 API API from a Windows Forms app?

Google has this new new Google Maps v3 API , which is the "Javascript API".

Is it possible to call this API from a Windows Forms application written in Visual C # .net 3.5?

EDIT:
The goal is to convert addresses to lat / long format using Google Maps geocoding.

EDIT 2:
I would like to use the v3 API as it no longer requires an API key. API keys must be bound to a web server, which cannot be the case for a Windows Forms application.

+3
source share
3 answers

: , api .

REST API (XML/JSON/CSV).

http://maps.google.com/maps/geo?q=State+St,+Troy,+NY&output=csv&oe=utf8&sensor=false

:

200,6,42.730070,-73.690570

:

  • 200 - G_GEO_SUCCESS
  • 6 -
  • 42.730070 -
  • -73.690570 -

API System.Net, :

const string GeoCodeUrlFormat = "http://maps.google.com/maps/geo?q={0}&output=csv&oe=utf8&sensor=false";

string location = "State St, Troy, NY";
string url = String.Format(GeoCodeUrlFormat, HttpUtility.UrlEncode(location));

HttpRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
HttpResponse response = (HttpResponse)request.GetResponse(); // Can throw an exception
Stream responseStream = response.GetResponseStream();

using (StreamReader reader = new StreamReader(responseStream)
{
    string firstLine = reader.ReadLine();

    string[] lineParts = firstLine.Split();

    GeolocationResult result = GoogleMapper.MapGeolocationResult(lineParts);

    // TADA
}

, , , MapGeolocationResult, .

+8

WebBrowser API Google.

, , .

+1

# API Google? , : GDS Google Map WinForms Control. , Google . -, -, JavaScript HTML. .

JavaScript, WebBrowser API.

+1

Source: https://habr.com/ru/post/1713849/


All Articles