Hi,
public bool GeocodeAddress()
{
//string sURL = "http://maps.google.com/maps/geo?q=" + GP.Address + "&output=xml&key=" + GoogleAPIKey;
//string sURL = "http://maps.googleapis.com/maps/geo?q=" + GP.Address + "&output=xml&key=" + GoogleAPIKey;
string address = txtaddress1.Text + "," + txtaddress2.Text + "," + txtcity.Text + "," + ddlstate.SelectedItem.Text + "," + ddlcountry.SelectedItem.Text;
WebResponse response = null;
string sURL = "http://maps.googleapis.com/maps/api/geocode/xml?address=" +address+ "&sensor=false";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(sURL);
request.Method = "GET";
response = request.GetResponse();
System.Xml.XPath.XPathDocument document = new System.Xml.XPath.XPathDocument(response.GetResponseStream());
System.Xml.XPath.XPathNavigator navigator = document.CreateNavigator();
System.Xml.XPath.XPathNodeIterator statusIterator = navigator.Select("/GeocodeResponse/status");
while (statusIterator.MoveNext())
{
if (statusIterator.Current.Value == "OK")
{
System.Xml.XPath.XPathNodeIterator resultIterator = navigator.Select("/GeocodeResponse/result");
while (resultIterator.MoveNext())
{
System.Xml.XPath.XPathNodeIterator formattedAddressIterator = resultIterator.Current.Select("formatted_address");
System.Xml.XPath.XPathNodeIterator geometryIterator = resultIterator.Current.Select("geometry");
while (geometryIterator.MoveNext())
{
System.Xml.XPath.XPathNodeIterator locationIterator = geometryIterator.Current.Select("location");
while (locationIterator.MoveNext())
{
System.Xml.XPath.XPathNodeIterator latIterator = locationIterator.Current.Select("lat");
while (latIterator.MoveNext())
{
Latitude =Convert.ToDouble(latIterator.Current.Value);
}
System.Xml.XPath.XPathNodeIterator lngIterator = locationIterator.Current.Select("lng");
while (lngIterator.MoveNext())
{
Longitude = Convert.ToDouble(lngIterator.Current.Value);
}
}
System.Xml.XPath.XPathNodeIterator locationTypeIterator = geometryIterator.Current.Select("location_type");
while (locationTypeIterator.MoveNext())
{
}
}
}
return true;
}
}
return false;
}
Hi in the above code i am getting latitude ang longitude this is working fine in localhost but in live it is returning the latitude and longitude as zero.I tried to get response from code it is returning as OVER_QUERY_LIMIT You have exceeded your daily request quota for this API.What is the reason