Also, the Javascript version of my code works perfectly, the only
problem being that annoying dialog that IE spits out.

On Jun 24, 10:51 am, Kyle <[email protected]> wrote:
> I have tried the Javascript delay suggestion with the stack, but the
> problem still lies with the Javascript being such a large process that
> IE still sends out the "do you want to continue running this script"
> dialog.
>
> So instead, I've been trying to use the HttpWebRequest functions in VB
> to retrieve the Xml files from google. (See Code Below). There are a
> few issues I'm having though that I can't seem to get past. Is there
> any examples out there of someone doing exactly what I'm trying to do
> in C# or VB? I can't seem to find much on this.
>
> 1 - I only seem to be able to retrieve a route for the first element
> in my For Each Loop
> 2 - Some directions return this error
>
> "System.Net.WebException: The remote server returned an error: (414)
> Request-URI Too Large. at System.Net.HttpWebRequest.GetResponse()"
>
> My VB Code:
>
> For Each row As DataRow In dtFindNearestFacilities.Rows
>   Try
>     Dim wRequest As HttpWebRequest
>     Dim wResponse As HttpWebResponse
>     Dim reader As StreamReader
>     Dim result As String
>
>     Dim xmlRequest As New StringBuilder()
>     xmlRequest.Append("origin=" & RDABranchAddress)
>     xmlRequest.Append("&destination=" & row.Item("af_Address") & " " &
> row.Item("af_City") & ", " & row.Item("af_State") & " " +
> row.Item("af_ZipCode"))
>     xmlRequest.Append("&sensor=false")
>
>     GoogleMapsLink = GoogleMapsLink + xmlRequest.ToString()
>     wRequest = DirectCast(WebRequest.Create(GoogleMapsLink),
> HttpWebRequest)
>     wResponse = DirectCast(wRequest.GetResponse(), HttpWebResponse)
>     reader = New StreamReader(wResponse.GetResponseStream())
>
>     Dim xmlDoc As New XmlDocument
>     xmlDoc.PreserveWhitespace = True
>     xmlDoc.LoadXml(reader.ReadToEnd)
>
>     Dim xmlNodeList As XmlNodeList =
> xmlDoc.GetElementsByTagName("step")
>     Dim totalDistance As Decimal = 0
>     For Each node As XmlNode In xmlNodeList
>       Dim routeDistance As Decimal =
> node.Item("distance").Item("value").InnerText
>       totalDistance = totalDistance + routeDistance
>     Next
>
>     totalDistance = Math.Round(((totalDistance / 1000) * 0.6214), 1)
>
>
>
> > instead of using javascript, at this stage you could write server code
> > on your aspx page to use the Directions Web service, do the
> > calculations on the server, and return the branches and distances to
> > the client.
>
> > see the following 
> > documentation:http://code.google.com/apis/maps/documentation/directions/- 
> > Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.

Reply via email to