I m using Google s DistanceMatrix API from a VB.net desktop app using HttpWebRequest. I pass it a URL containing two locations (Expressed as Longitude and Latitude) and it gives me driving distances in miles and minutes using real streets. (Actually meters and seconds but I convert it.)
It works great from my desktop. The most significant part of my code is below. But I m not a web / internet / networking guy, and I m doing this by example. So far I don t have to know how it works and I m cool with that.
THE PROBLEM: Google says they have usage limits. Personally I don t approach those limits but my app may be distributed to many, and if a lot of others use it, together we will. In fact some users might go over the limits from a single workstation. I am willing to pay for extra usage if needed, but I don t know if I would be required to do so in this situation.
THE QUESTION: I ve looked thoroughly, (or at least I think I have) and as far as I can see Google doesn t document exactly how they monitor usage in this scenario. The documentation seems to assume it will always be used from a web server, and there are some references in the documentation that it can t be used from certain domains. But this is a windows forms app, so is it really "by domain"? What domain? Is it the service provider s domain? Or is it by IP Address? And importantly, will each user be counted separately in this situation or will it be somehow tied to the app itself wherever it may reside?
如果我看上去.子,就医。 但是,在这方面是否有任何帮助?
我的法典的相关职能如下,也在此为本文提供谷歌文件页。
http://code.google.com/apis/maps/documentation/distancematrix/
Public Function GetHTML(ByVal URL As String, Optional ByVal UserName As String = "", Optional ByVal Password As String = "") As String
Try
Dim reader As StreamReader
Dim Request As HttpWebRequest = HttpWebRequest.Create(URL)
The following line empowers some downloads to work.
If UserName <> "" Then
Request.Credentials = New NetworkCredential(UserName, Password)
End If
Request.AllowAutoRedirect = True
Request.CookieContainer = CookieJar
Dim Response As HttpWebResponse = Request.GetResponse()
reader = New StreamReader(Response.GetResponseStream())
Response.Close()
Return reader.ReadToEnd()
Catch
Return ""
End Try
End Function