../..
WebURL = "http://maps.googleapis.com/maps/api/distancematrix/xml?origins=<START_LOCATION>&destinations=<END_LOCATION>&mode=driving&language=us-EN&sensor=false&units=metric"
WebURL=WebURL.Replace("<START_LOCATION>", AnteriorLat.Trim & "," & Anteriorlong.Trim )
WebURL=WebURL.Replace("<END_LOCATION>", ActualLat.Trim & "," & Actuallong.Trim )
job1.Initialize( "Job_GetDistance", Me)
Try
job1.PostString(WebURL,"")
Catch
ToastMessageShow(jsc_tools.tr("No se pudo acceder obtener posición.") & job1.ErrorMessage ,True)
End Try
end sub
Sub JobDone (Job As HttpJob)
Dim ResultGoogle As String=""
Dim ResultGoogle2 As String=""
Dim StartData As Int =0
Dim EndData As Int=0
Dim DataLatLng As String =""
Dim SQlString As String =""
If Job.Success = True Then
Select Job.JobName
Case "Job_GetDistance"
ResultGoogle = Job.GetString
ResultGoogle=ResultGoogle.ToLowerCase
ResultGoogle2=ResultGoogle
StartData=ResultGoogle.IndexOf("<distance>")
EndData=ResultGoogle.IndexOf("</distance>")
' Log(ResultGoogle)
Try
ResultGoogle=ResultGoogle.SubString2(StartData + 10, EndData -1)
EndData=ResultGoogle.IndexOf("</value>")
ResultGoogle=ResultGoogle.SubString2(12,EndData)
ResultGoogle=ResultGoogle.replace("<value>","")
ResultGoogle=ResultGoogle.replace("</value>","")
ResultGoogle=ResultGoogle.replace(CRLF,"")
Catch
ResultGoogle="0"
End Try
Log (ResultGoogle) 'distance
StartData=ResultGoogle2.IndexOf("<duration>")
EndData=ResultGoogle2.IndexOf("</duration>"
Log(ResultGoogle2) 'duration
Try
ResultGoogle2=ResultGoogle2.SubString2(StartData + 10, EndData -1)
EndData=ResultGoogle2.IndexOf("</value>")
ResultGoogle2=ResultGoogle2.SubString2(12,EndData)
ResultGoogle2=ResultGoogle2.replace("<value>","")
ResultGoogle2=ResultGoogle2.replace("</value>","")
ResultGoogle2=ResultGoogle2.replace(CRLF,"")
Catch
ResultGoogle2="0"
End Try
Log (ResultGoogle2)