Hello
i want to calculate Distance in KM from two pincode.
i have code its asking for billing.
<DistanceMatrixResponse>
<status>REQUEST_DENIED</status>
<error_message>
You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started
</error_message>
</DistanceMatrixResponse>
have any alternate solution.
is it posible to calculate Distance in KM from two pincode in SQL Server.
protected void btnsubmit_Click(object sender, EventArgs e)
{
GetDistance(txtZip1.Text, txtZip2.Text);
}
public void GetDistance(string origin, string destination)
{
string url = @"https://maps.googleapis.com/maps/api/distancematrix/xml?key=AIzaSyD76RsJFYvlTD2Xxv1o8TqW9Ql_Lv7ph30&origins=" + origin + "&destinations=" + destination + "&sensor=false";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
WebResponse response = request.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader sreader = new StreamReader(dataStream);
string responsereader = sreader.ReadToEnd();
response.Close();
DataSet ds = new DataSet();
ds.ReadXml(new XmlTextReader(new StringReader(responsereader)));
if (ds.Tables.Count > 0)
{
if (ds.Tables["element"].Rows[0]["status"].ToString() == "OK")
{
lblDuration.Text = ds.Tables["duration"].Rows[0]["text"].ToString();
lblDistance.Text = ds.Tables["distance"].Rows[0]["text"].ToString();
}
}
}