I don't know whether this meets with your requirements.but I'm using
this to take driving distance
public bool GetDisAndDuration(string src, string des, out float dis,
out float dur,string TraType)
{
dis = 0.0f;
dur = 0.0f;
string url = "
http://maps.googleapis.com/maps/api/distancematrix/xml?origins=" + src
+ "&destinations=" + des + "&mode=" + TraType + "&sensor=false"; //
driving
WebRequest req = HttpWebRequest.Create(url);
WebResponse response = req.GetResponse();
Stream responseStream = response.GetResponseStream();
XmlReader rdr = XmlReader.Create(responseStream);
XmlDocument xml = new XmlDocument();
xml.Load(rdr);
XmlNode node =
xml.SelectSingleNode("/DistanceMatrixResponse/status");
if (node.InnerText.Equals("OK"))
{
XmlNode node1 =
xml.SelectSingleNode("DistanceMatrixResponse/row/element/status");
if (node1.InnerText.Equals("OK"))
{
XmlNode duration_node =
xml.SelectSingleNode("DistanceMatrixResponse/row/element/duration/value");
XmlNode distance_node =
xml.SelectSingleNode("DistanceMatrixResponse/row/element/distance/value");
dis = float.Parse(distance_node.InnerText);
dur = float.Parse(duration_node.InnerText);
return true;
}
}
return false;
}
On 10/19/12, Barry Hunter <[email protected]> wrote:
> On Fri, Oct 19, 2012 at 3:42 PM, ishara <[email protected]> wrote:
>
>> so its better to find out some different supplier rather than using
>> google
>> api ?
>>
>
> Not 'better'. But required. You need to find a different provider.
>
> You can NOT use Google Distance Matrix API as per your requirements.
>
>
>
>> cos our business requirement is different, we have been using google api
>> to get the driving distance , and we were really happy about it
>>
>
> Similly if you not displaying a map, you are not allowed to use the
> Directions API either.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps API V2" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.