Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Edit:</strong> Looks like the api key is no longer required.</p> <p>You can use the <a href="http://code.google.com/apis/maps/documentation/geocoding/#GeocodingResponses" rel="noreferrer">REST APIs</a> and parse the response (XML/JSON/CSV).</p> <pre><code>http://maps.google.com/maps/geo?q=State+St,+Troy,+NY&amp;output=csv&amp;oe=utf8&amp;sensor=false </code></pre> <p>Would output:</p> <pre><code>200,6,42.730070,-73.690570 </code></pre> <p>Which is:</p> <ul> <li><strong>200</strong> - G_GEO_SUCCESS</li> <li><strong>6</strong> - Street level accuracy</li> <li><strong>42.730070</strong> - Latitude</li> <li><strong>-73.690570</strong> - Longitude</li> </ul> <p>If you are not familiar with the System.Net APIs, they would go something like this:</p> <pre><code>const string GeoCodeUrlFormat = "http://maps.google.com/maps/geo?q={0}&amp;output=csv&amp;oe=utf8&amp;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 } </code></pre> <p>Obviously there's no error handling, it doesn't support multiple return values and I haven't actually implemented MapGeolocationResult, but it should give you a start.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload