-
-
Save mahizsas/6559578 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void GoogleGeoCode(string address, out double lat, out double lon) | |
{ | |
string url = "http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=" + address; | |
var req = (HttpWebRequest)WebRequest.Create(url); | |
var reader = new StreamReader(req.GetResponse().GetResponseStream()); | |
var body = reader.ReadToEnd(); | |
lat = double.Parse(Regex.Match(body, @"""lat\"" : ([\d\.]+)").Groups[1].Value); | |
lon = double.Parse(Regex.Match(body, @"""lon"" : ([\d\.]+)").Groups[1].Value); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment