PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 24 → Procedure RotasGoogleMaps, Retorna de dois endereços o tempo estimado, distância, norte, sul, as direçôes a serem tomadas e os endereços completos formatados pelo google
Procedure RotasGoogleMaps, Retorna de dois endereços o tempo estimado, distância, norte, sul, as direçôes a serem tomadas e os endereços completos formatados pelo google
Débuté par adrianoboller, 08 jan. 2016 18:41 - 7 réponses
Membre enregistré
2 907 messages
Popularité : +89 (91 votes)
Posté le 08 janvier 2016 - 18:41
Procedure WS_RotasGoogleMaps(enderecoOrigem is string, enderecoDestino is string) : string

IF enderecoOrigem = "" OR enderecoDestino = "" THEN
RESULT(Null)
END

//GloVoceEnderecoLongo is string
//GloVoceEndereco is string
//GloVoceNumero is string
//GloDestinoEnderecoLongo is string
//GloDestinoEndereco is string
//GloDestinoNumero is string
//GloValorBandeira01 is real
//GloValorBandeira02 is real
//GloTaxaRetorno is real
//GloTempoCarro is real
//GloDistanciaCarro is real
//GloNortelatitude is real
//GloNorteLongitute is real
//GloSullatitude is real
//GloSulLongitute is real
//GloTempoDestino is string
//GloPoligonalGoogle is string
//GloDistanciaDestino is string
//GloHtmlInstructions is string

//Limpa variaveis
GloVoceEnderecoLongo = "ERRO" //String
GloDestinoEnderecoLongo = "ERRO" //String
GloTempoDestino = "" //String
GloDistanciaDestino = "" //String
GloHtmlInstructions = "" //String
GloPoligonalGoogle = "" //String
GloDistanciaCarro = 0 //real
GloTempoCarro = 0 //real
GloNortelatitude = 0 //real
GloNorteLongitute = 0 //real
GloSullatitude = 0 //real
GloSulLongitute = 0 //real

HTTPCreateForm("GoogleMaps")
HTTPAddParameter("GoogleMaps","origin", enderecoOrigem)
HTTPAddParameter("GoogleMaps","destination", enderecoDestino)
HTTPAddParameter("GoogleMaps","language", "pt-BR")
HTTPAddParameter("GoogleMaps","region", "br")
HTTPAddParameter("GoogleMaps","units", "metric")
HTTPAddParameter("GoogleMaps","key","AIzaSyDbSVKYPwB1a-_vPbDzAr6LgAfIj4iW2hc")

cMyRequest is HTTPRequest
cMyRequest..URL = "https://maps.googleapis.com/maps/api/directions/xml"
cMyRequest..Method = httpGet

cMyResponse is httpResponse = HTTPSendForm("GoogleMaps", cMyRequest)

IF cMyResponse..StatusCode <> 200 THEN // Se não funcionou
RESULT(Null)
END

xmlGoogle is XMLDocument = XMLOpen(cMyResponse..Content, fromString)
IF NOT xmlGoogle.DirectionsResponse.status..Text ~= "OK" THEN
RESULT(Null)
END

//Lendo nos unicos
GloVoceEnderecoLongo = xmlGoogle.DirectionsResponse.route.leg.start_address
GloDestinoEnderecoLongo = xmlGoogle.DirectionsResponse.route.leg.end_address
GloTempoCarro = xmlGoogle.DirectionsResponse.route.leg.duration.value
GloTempoDestino = xmlGoogle.DirectionsResponse.route.leg.duration.text
GloDistanciaCarro = xmlGoogle.DirectionsResponse.route.leg.distance.value
GloDistanciaDestino = xmlGoogle.DirectionsResponse.route.leg.distance.text
GloPoligonalGoogle = xmlGoogle.DirectionsResponse.route.overview_polyline.points
GloNortelatitude = xmlGoogle.DirectionsResponse.route.bounds.northeast.lat
GloNorteLongitute = xmlGoogle.DirectionsResponse.route.bounds.northeast.lng
GloSullatitude = xmlGoogle.DirectionsResponse.route.bounds.southwest.lat
GloSulLongitute = xmlGoogle.DirectionsResponse.route.bounds.southwest.lng

//Loop nos nós do xml
Resultado is string
Contador is int = 1
FOR EACH legNode OF xmlGoogle.DirectionsResponse.route.leg
IF legNode..Name = "step" THEN
HTML is string = legNode.html_instructions
Distancia is int = legNode.distance.value
Resultado += Contador + ". " + HTML + " [" + Distancia + "]" + CR
Contador++
END
END

GloHtmlInstructions = Resultado

RESULT(Resultado)


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.blogspot.com.br/
Membre enregistré
2 907 messages
Popularité : +89 (91 votes)
Posté le 09 janvier 2016 - 19:25




--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.blogspot.com.br/
Membre enregistré
2 907 messages
Popularité : +89 (91 votes)
Posté le 09 janvier 2016 - 19:26
<?xml version="1.0" encoding="UTF-8"?>
<DirectionsResponse>
<status>OK</status>
<route>
<summary>Av. Victor Ferreira do Amaral</summary>
<leg>
<step>
<travel_mode>DRIVING</travel_mode>
<start_location>
<lat>-25.4189503</lat>
<lng>-49.2445516</lng>
</start_location>
<end_location>
<lat>-25.4189929</lat>
<lng>-49.2440539</lng>
</end_location>
<polyline>
<points>lsczClaqkHFcB</points>
</polyline>
<duration>
<value>10</value>
<text>1 min</text>
</duration>
<html_instructions>Siga na dire褯 <b>leste</b> na <b>R. Dr. Goulin</b> em dire褯 ࠦlt;b>Rua Flⷩo Dallegrave</b></html_instructions>
<distance>
<value>50</value>
<text>50 m</text>
</distance>
</step>
<step>
<travel_mode>DRIVING</travel_mode>
<start_location>
<lat>-25.4189929</lat>
<lng>-49.2440539</lng>
</start_location>
<end_location>
<lat>-25.4177243</lat>
<lng>-49.2437741</lng>
</end_location>
<polyline>
<points>tsczCh~pkHUGa@Ka@G[Eq@IuAK</points>
</polyline>
<duration>
<value>66</value>
<text>1 min</text>
</duration>
<html_instructions>Vire ࠦlt;b>esquerda</b> na <b>R. President Rodrigo Otⷩo</b></html_instructions>
<distance>
<value>144</value>
<text>0,1 km</text>
</distance>
<maneuver>turn-left</maneuver>
</step>
<step>
<travel_mode>DRIVING</travel_mode>
<start_location>
<lat>-25.4177243</lat>
<lng>-49.2437741</lng>
</start_location>
<end_location>
<lat>-25.4179433</lat>
<lng>-49.2411403</lng>
</end_location>
<polyline>
<points>vkczCp|pkHD_@@[@Y@S@U@e@@K@o@@UDy@@a@HsB@a@@c@</points>
</polyline>
<duration>
<value>54</value>
<text>1 min</text>
</duration>
<html_instructions>Vire ࠦlt;b>direita</b> na 1ʠrua transversal para <b>R. Augusto Stresser</b></html_instructions>
<distance>
<value>266</value>
<text>0,3 km</text>
</distance>
<maneuver>turn-right</maneuver>
</step>
<step>
<travel_mode>DRIVING</travel_mode>
<start_location>
<lat>-25.4179433</lat>
<lng>-49.2411403</lng>
</start_location>
<end_location>
<lat>-25.4280589</lat>
<lng>-49.2415964</lng>
</end_location>
<polyline>
<points>bmczCblpkHnAq@RKb@UHEr@_@jAm@`Ag@`@QPIf@QJEHAJAHAPA^@NBPD@@b@VvCrBZX`D|Bf@^ZV`Av@TNvA|@h@VVJXHXDfANV@T?T?VCTC`@Eb@IfAQfAS^M|Bm@ZKVKJGXK@AJENIj@U</points>
</polyline>
<duration>
<value>116</value>
<text>2 minutos</text>
</duration>
<html_instructions>Vire ࠦlt;b>direita</b> na <b>Av. Nossa Senhora da Luz</b></html_instructions>
<distance>
<value>1259</value>
<text>1,3 km</text>
</distance>
<maneuver>turn-right</maneuver>
</step>
<step>
<travel_mode>DRIVING</travel_mode>
<start_location>
<lat>-25.4280589</lat>
<lng>-49.2415964</lng>
</start_location>
<end_location>
<lat>-25.4282871</lat>
<lng>-49.2414666</lng>
</end_location>
<polyline>
<points>jlezC~npkHl@Y</points>
</polyline>
<duration>
<value>4</value>
<text>1 min</text>
</duration>
<html_instructions>Continue para <b>Av. Mal. Humberto de Alencar Castelo Branco</b></html_instructions>
<distance>
<value>29</value>
<text>29 m</text>
</distance>
</step>
<step>
<travel_mode>DRIVING</travel_mode>
<start_location>
<lat>-25.4282871</lat>
<lng>-49.2414666</lng>
</start_location>
<end_location>
<lat>-25.4276407</lat>
<lng>-49.2405798</lng>
</end_location>
<polyline>
<points>xmezCdnpkHJSBGBG@C@E?C?A?C?CAECCWGWEKCKEIGIEACEEGGGGGKKOKO</points>
</polyline>
<duration>
<value>28</value>
<text>1 min</text>
</duration>
<html_instructions>Curva acentuada ࠦlt;b>esquerda</b> na rampa de acesso a <b>Av. Victor Ferreira do Amaral</b></html_instructions>
<distance>
<value>142</value>
<text>0,1 km</text>
</distance>
</step>
<step>
<travel_mode>DRIVING</travel_mode>
<start_location>
<lat>-25.4276407</lat>
<lng>-49.2405798</lng>
</start_location>
<end_location>
<lat>-25.4300114</lat>
<lng>-49.2153913</lng>
</end_location>
<polyline>
<points>viezCrhpkHEIEKMg@I_@G]CSAQ?Y@c@NmCJkC?WZ_GF_AR_DR}CJ}CFiABo@BYBUZyE@[VyDH_BJ_BFmAHkA@cABi@B]Bc@L{BFeADgAFiAXoFR}DV{DBc@TcEFwAFqBBq@Do@Bi@B_@f@uJP_DJkBHeBNoCNgC</points>
</polyline>
<duration>
<value>229</value>
<text>4 minutos</text>
</duration>
<html_instructions>Continue para <b>Av. Victor Ferreira do Amaral</b></html_instructions>
<distance>
<value>2553</value>
<text>2,6 km</text>
</distance>
</step>
<step>
<travel_mode>DRIVING</travel_mode>
<start_location>
<lat>-25.4300114</lat>
<lng>-49.2153913</lng>
</start_location>
<end_location>
<lat>-25.4363978</lat>
<lng>-49.2186964</lng>
</end_location>
<polyline>
<points>pxezCdkkkHlBp@`A\hA`@hAd@`@P^N`A`@h@Rl@Vn@Xp@Xr@Zn@Xn@Xp@Zn@XbBt@`Bt@l@Xl@Zp@Vp@X</points>
</polyline>
<duration>
<value>88</value>
<text>1 min</text>
</duration>
<html_instructions>Vire ࠦlt;b>direita</b> na <b>R. Prof. Nivaldo Braga</b></html_instructions>
<distance>
<value>784</value>
<text>0,8 km</text>
</distance>
<maneuver>turn-right</maneuver>
</step>
<step>
<travel_mode>DRIVING</travel_mode>
<start_location>
<lat>-25.4363978</lat>
<lng>-49.2186964</lng>
</start_location>
<end_location>
<lat>-25.4404691</lat>
<lng>-49.2094845</lng>
</end_location>
<polyline>
<points>n`gzCz_lkHdAaDbAaDd@mAd@mA`@sAb@sA`@mA`@mAd@oAd@oAjCcIfAaDfAaDdAaD^eA</points>
</polyline>
<duration>
<value>194</value>
<text>3 minutos</text>
</duration>
<html_instructions>Vire ࠦlt;b>esquerda</b> na <b>R. Clⷩo Molinari</b><div style="font-size:0.9em">O destino estarᡠ esquerda</div></html_instructions>
<distance>
<value>1030</value>
<text>1,0 km</text>
</distance>
<maneuver>turn-left</maneuver>
</step>
<duration>
<value>789</value>
<text>13 minutos</text>
</duration>
<distance>
<value>6257</value>
<text>6,3 km</text>
</distance>
<start_location>
<lat>-25.4189503</lat>
<lng>-49.2445516</lng>
</start_location>
<end_location>
<lat>-25.4404691</lat>
<lng>-49.2094845</lng>
</end_location>
<start_address>R. Dr. Goulin, 1661 - Alto da Gl󲩡, Curitiba - PR, 80040-280, Brasil</start_address>
<end_address>R. Clⷩo Molinari, 1029 - Cap䯠da Imbuia, Curitiba - PR, 82810-210, Brasil</end_address>
</leg>
<copyrights>Dados cartogr⧩cos ɲ016 Google</copyrights>
<overview_polyline>
<points>lsczClaqkHFcBUGcASmAOuAKD_@Bu@Bi@FwBRqF@c@nAq@v@a@jE{Br@[r@Wp@Gn@DRFzDjC|DvCzC~BvA|@h@Vp@T`BTl@@l@Cv@IjB[fBa@xCy@b@Sv@]xAo@N[FUAO[Kc@Ia@W]a@W_@KUWgAKq@Ak@PqDJcDb@_If@}HRgFf@yHn@uKPyCDmB\cGz@_QZ_F\{GJcDHyA|@uPt@iNnDnArCfAlDvAdKpE`H`DbBp@hCcIjA{CdAgDnC{H`KoZ</points>
</overview_polyline>
<bounds>
<southwest>
<lat>-25.4404691</lat>
<lng>-49.2445516</lng>
</southwest>
<northeast>
<lat>-25.4177243</lat>
<lng>-49.2094845</lng>
</northeast>
</bounds>
</route>
<geocoded_waypoint>
<geocoder_status>OK</geocoder_status>
<type>street_address</type>
<place_id>ChIJTSl-2zTk3JQRv7Rz9W0v58w</place_id>
</geocoded_waypoint>
<geocoded_waypoint>
<geocoder_status>OK</geocoder_status>
<type>street_address</type>
<place_id>Ek5SLiBDbMOhdmlvIE1vbGluYXJpLCAxMDI5IC0gQ2Fww6NvIGRhIEltYnVpYSwgQ3VyaXRpYmEgLSBQUiwgODI4MTAtMjEwLCBCcmFzaWw</place_id>
</geocoded_waypoint>
</DirectionsResponse>


--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.blogspot.com.br/
Membre enregistré
2 907 messages
Popularité : +89 (91 votes)
Posté le 09 janvier 2016 - 19:28
Resultado:

R. Dr. Goulin, 1661 - Alto da Glória, Curitiba - PR, 80040-280, Brasil
----

1. Siga na direção leste na R. Dr. Goulin em direção à Rua Flávio Dallegrave [50] metros
2. Vire à esquerda na R. President Rodrigo Otávio [144] metros
3. Vire à direita na 1ª rua transversal para R. Augusto Stresser [266] metros
4. Vire à direita na Av. Nossa Senhora da Luz [1259] metros
5. Continue para Av. Mal. Humberto de Alencar Castelo Branco [29] metros
6. Curva acentuada à esquerda na rampa de acesso a Av. Victor Ferreira do Amaral [142] metros
7. Continue para Av. Victor Ferreira do Amaral [2553] metros
8. Vire à direita na R. Prof. Nivaldo Braga [784] metros
9. Vire à esquerda na R. Clávio Molinari O destino estará à esquerda [1030] metros

----
R. Clávio Molinari, 1029 - Capão da Imbuia, Curitiba - PR, 82810-210, Brasil

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.blogspot.com.br/
Membre enregistré
2 907 messages
Popularité : +89 (91 votes)
Posté le 09 janvier 2016 - 19:30
:merci:

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.blogspot.com.br/
Membre enregistré
2 907 messages
Popularité : +89 (91 votes)
Posté le 11 janvier 2016 - 16:26
Esse exemplo gerado com a ajuda do Fernando

Meu muito obrigado!

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.blogspot.com.br/
Membre enregistré
2 907 messages
Popularité : +89 (91 votes)
Posté le 20 juillet 2016 - 18:45
Prezados,

Como colocar eventos no controle de mapa no mobile:





:merci:

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 9949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/
Membre enregistré
2 907 messages
Popularité : +89 (91 votes)
Posté le 25 avril 2017 - 20:43
COMPLEMENTO:

https://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/1693-mapadditinerary-versao-21-ilimitada-multi-points-para-rotas-2310/read.awp

--
Adriano José Boller
______________________________________________
Consultor e Representante Oficial da
PcSoft no Brasil
+55 (41) 99949 1800
adrianoboller@gmail.com
skype: adrianoboller
http://wxinformatica.com.br/