|
Accueil → WINDEV 25 → WX - MapAddItinerary, versão 21 ilimitada multi points para rotas |
WX - MapAddItinerary, versão 21 ilimitada multi points para rotas |
Débuté par BOLLER, 27 sep. 2016 16:17 - 4 réponses |
| |
| | | |
|
| |
Membre enregistré 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 27 septembre 2016 - 16:17 |
Prezados,
MapAddItinerary, versão 21 ilimitada multi points para rotas
QRY_Menor_Distancia SELECT ParticipantesEvento.ParticipantesEventoID AS ParticipantesEventoID, ParticipantesEvento.Nombre AS Nombre, ParticipantesEvento.Calle AS Calle, ParticipantesEvento.Nro AS Nro, ParticipantesEvento.Ciudad AS Ciudad, ParticipantesEvento.Pais AS Pais, ParticipantesEvento.EventoID AS EventoID, ParticipantesEvento.Sector AS Sector, ParticipantesEvento.Telefono AS Telefono, ParticipantesEvento.Celular AS Celular, ParticipantesEvento.LATITUD AS LATITUD, ParticipantesEvento.LONGITUD AS LONGITUD, ParticipantesEvento.DISTANCIA AS DISTANCIA FROM ParticipantesEvento WHERE ParticipantesEvento.EventoID = {ParamEventoID} ORDER by DISTANCIA Asc
Example Multi Points Procedure WIN_Mapa(gnCodPasajero is 8-byte int)
gPosicionPasajero is geoPosition arryGeo is array of geoPosition gDestFinal is geoPosition gDestFinalMaker is Marker gDestFinal..Latitude = -0.185570 gDestFinal..Longitude = -78.502635 gDestFinalMaker..Position = gDestFinal gDestFinalMaker..Image = "map.png" MapAddMarker(MAP_NoName1,gDestFinalMaker)
MapDisplayPosition(MAP_NoName1,MYPSOITION) gPosicionChofer is Marker gPosicionChofer..Position = MYPSOITION gPosicionChofer..Image = "car.png" MapAddMarker(MAP_NoName1,gPosicionChofer)
ArrayAdd(arryGeo,gPosicionChofer..Position)
HExecuteQuery(QRY_Menor_Distancia,hQueryDefault,5)
FOR ALL QRY_Menor_Distancia
gPosicionCliente is Marker gPosicionPasajero..Latitude = QRY_Menor_Distancia.LATITUD gPosicionPasajero..Longitude = QRY_Menor_Distancia.LONGITUD gPosicionCliente..Position = gPosicionPasajero gPosicionCliente..Image = "client.png" MapAddMarker(MAP_NoName1,gPosicionCliente) ArrayAdd(arryGeo,gPosicionCliente..Position)
END
ArrayAdd(arryGeo,gDestFinalMaker..Position)
FOR i = 2 TO arryGeo..Occurrence
MapAddItinerary(MAP_NoName1,[arryGeo[(i-1)],arryGeo[i]],itineraryCar,iDarkBlue,70,8)
END
MAP_NoName1..Zoom = 12
ArrayDelete(arryGeo,1)
MapFollowMovement(MAP_NoName1,20,MovimentaMapa)
-- 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é 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 27 septembre 2016 - 16:25 |
VERSAO 21 OU SUPERIOR
-- 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é 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 25 avril 2017 - 20:33 |
TUTORIAL GOOGLE MAPS
Crie essas variaveis globais
GloVoceEnderecoLongo, GloDestinoEnderecoLongo, GloTempoDestino, GloDistanciaDestino, GloHtmlInstructions, GloPoligonalGoogle are string GloDistanciaCarro, GloTempoCarro, GloNortelatitude, GloNorteLongitute, GloSullatitude, GloSulLongitute are real
Entre no site do Google API
https://console.developers.google.com/apis/library
ative e gere a sua chave
Então faça essa tela tanto faz se for no windev, webdev ou no windev mobile:
No open da janela
MapLicenseGgl("AIzaSyBfqZjwujZVv9rKB1ShyFY4merJFC_409k")
---
Botão Buscar()
RotasGoogleMaps(EDT_ENDEREÇO,EDT_ENDEREÇO) EDT_Latitude = GloNortelatitude EDT_Longitude = GloNorteLongitute
Info(GloVoceEnderecoLongo, GloDestinoEnderecoLongo, GloTempoDestino, GloDistanciaDestino, GloHtmlInstructions, GloPoligonalGoogle,... GloDistanciaCarro, GloTempoCarro, GloNortelatitude, GloNorteLongitute, GloSullatitude, GloSulLongitute)
---
Botão Add Market( )
MyPosition is geoPosition MyPosition..Latitude = EDT_Latitude MyPosition..Longitude = EDT_Longitude
MyMarker is Marker MyMarker..Position = MyPosition
MapAddMarker(MAP_Google, MyMarker)
MAP_Google..Zoom = 15
MapDisplayPosition(MAP_Google, MyPosition)
---
Botao + Zoom( )
MAP_Google..Zoom += 5 ToastDisplay(MAP_Google..Zoom,toastLong,vaMiddle,haCenter)
---
Botao - Zoom( )
MAP_Google..Zoom += 5 ToastDisplay(MAP_Google..Zoom,toastLong,vaMiddle,haCenter)
---
Botao Localizar( )
MapDeleteAll(MAP_Google)
RotasGoogleMaps(EDT_ENDEREÇO,EDT_ENDEREÇO) EDT_Latitude = GloNortelatitude EDT_Longitude = GloNorteLongitute
MyPosition is geoPosition MyPosition..Latitude = EDT_Latitude MyPosition..Longitude = EDT_Longitude
MyMarker is Marker MyMarker..Position = MyPosition
MapAddMarker(MAP_Google, MyMarker)
MAP_Google..Zoom = 15
MapDisplayPosition(MAP_Google, MyPosition)
---
Botão Limpar market ()
MapDeleteAll(MAP_Google)
---
PROCEDURE PRINCIPAL
Procedure RotasGoogleMaps(enderecoOrigem is string, enderecoDestino is string) : string
IF enderecoOrigem = "" OR enderecoDestino = "" THEN RESULT(Null) END
enderecoOrigem = NoSpace(NoAccent(Replace(enderecoOrigem," ","+"))) enderecoDestino = NoSpace(NoAccent(Replace(enderecoDestino," ","+")))
GloVoceEnderecoLongo = "ERRO" GloDestinoEnderecoLongo = "ERRO" GloTempoDestino = "" GloDistanciaDestino = "" GloHtmlInstructions = "" GloPoligonalGoogle = "" GloDistanciaCarro = 0 GloTempoCarro = 0 GloNortelatitude = 0 GloNorteLongitute = 0 GloSullatitude = 0 GloSulLongitute = 0
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","AIzaSyBfqZjwujZVv9rKB1ShyFY4merJFC_409k")
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 RESULT(Null) END
UrlRota is string = "http://maps.googleapis.com/maps/api/directions/xml?origin="+enderecoOrigem+"&destination="+enderecoDestino+"&sensor=false&mode=driving"
HTTPRequest(UrlRota)
Resultado is string = HTTPGetResult(httpResult)
xmlGoogle is xmlDocument = XMLOpen(Resultado, fromString)
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
Resultado = "" 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)
RESULTADO:
<?xml version="1.0" encoding="UTF-8"?> <DirectionsResponse> <status>OK</status> <route> <summary>R. Sena Madureira</summary> <leg> <step> <travel_mode>DRIVING</travel_mode> <start_location> <lat>-23.5929086</lat> <lng>-46.6475838</lng> </start_location> <end_location> <lat>-23.5929086</lat> <lng>-46.6475838</lng> </end_location> <polyline> <points>t~~nCjzu{G</points> </polyline> <duration> <value>0</value> <text>1 min</text> </duration> <html_instructions>Head on <b>R. Sena Madureira</b></html_instructions> <distance> <value>0</value> <text>1 m</text> </distance> </step> <duration> <value>0</value> <text>1 min</text> </duration> <distance> <value>0</value> <text>1 m</text> </distance> <start_location> <lat>-23.5929086</lat> <lng>-46.6475838</lng> </start_location> <end_location> <lat>-23.5929086</lat> <lng>-46.6475838</lng> </end_location> <start_address>R. Sena Madureira, 1225 - Vila Clementino, São Paulo - SP, Brazil</start_address> <end_address>R. Sena Madureira, 1225 - Vila Clementino, São Paulo - SP, Brazil</end_address> </leg> <copyrights>Map data ©2017 Google</copyrights> <overview_polyline> <points>t~~nCjzu{G</points> </overview_polyline> <bounds> <southwest> <lat>-23.5929086</lat> <lng>-46.6475838</lng> </southwest> <northeast> <lat>-23.5929086</lat> <lng>-46.6475838</lng> </northeast> </bounds> </route> <geocoded_waypoint> <geocoder_status>OK</geocoder_status> <type>street_address</type> <place_id>ChIJzcgV3yBazpQRLAflt-kNk6A</place_id> </geocoded_waypoint> <geocoded_waypoint> <geocoder_status>OK</geocoder_status> <type>street_address</type> <place_id>ChIJzcgV3yBazpQRLAflt-kNk6A</place_id> </geocoded_waypoint> </DirectionsResponse>
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/Message modifié, 25 avril 2017 - 20:57 |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 3 655 messages Popularité : +175 (223 votes) |
|
Posté le 25 avril 2017 - 20:53 |
-- Adriano José Boller ______________________________________________ Consultor e Representante Oficial da PcSoft no Brasil +55 (41) 99949 1800 adrianoboller@gmail.com skype: adrianoboller http://wxinformatica.com.br/ |
| |
| |
| | | |
|
| | |
| |
Posté le 14 février 2018 - 15:33 |
Atenção, o key está comentado, crie o seu key na página correspondente do google maps directions api e substitua, se não, NÃO FUNCIONA ! |
| |
| |
| | | |
|
| | | | |
| | |
|