Returns the distance in meters and in seconds between two points according to the directions service of google maps.
1 google.route.getRoute
<google.route.getRoute avoid='avoid'>
<lat_p1 /> +
<lng_p1 /> +
<lat_p2 /> +
<lng_p2 /> +
</google.route.getRoute>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aavoid | String | Indicates that the calculated route(s) should avoid the indicated features. This parameter supports the following arguments
|
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Elat_p1 | String | Latitude point 1. | |||
Elng_p1 | String | Length point 1. | |||
Elat_p2 | String | Latitude point 2. | |||
Elng_p2 | String | Length point 2. |
Ver tambien
To more information of the directions service of google directions.
Example
Calculate the distance in car between two points:
Copy
<xsql-script name=''> <body> <set name="lat1">41.324748</set> <set name="lng1">2.092209</set> <set name="lat2">41.401536</set> <set name="lng2">2.134781</set> <println> <google.route.getRoute> <lat1 /> <lng1 /> <lat2 /> <lng2 /> </google.route.getRoute> </println> </body> </xsql-script>
Returns:
Copy
+---------------+----------------+------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |distance_meters|distance_seconds|status|error_message|polyline | +---------------+----------------+------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | 11.976,00| 1.042,00|OK | |off{FkswK`EjWAD?BsAn@wCrAeBz@]DACA?CCA?I?MJAB?@WL[RaCn@yDnAqAVi@NAAECIEK@KDCBi@COGUIkA[WAe@JwCzAq@PKCK@KDGJUx@QVYJO?MAUOc@s@aAsBGEUo@g@}AIMMG{BiJiBoIyDaPoBaIs@kC}A{D{@eBg@aAoAoBmAkBuTw[uMsRiNsSyQ}WmKs| | | | | |O{BuDqAgCw@wAsAyBcCkDmGgJwBwC_CmDcBeC}BiDcD{EqEoGwBaDqByCo@u@m@_Ac@y@qEsG_D_EuBiCg@s@mAcBKi@sCkE{A{BDWAc@Ka@QWWMUAUHURKTADAJeCzAyDbCkDrBsAv@cBx@iBn@q@PkKtCeCn@yDfAqBj@cFtAgFrAsE`A{@TaAZiFtAoDp@cFlAcLt| | | | | |CgFpAsDn@{B\aAJuADqABkBC]AiBU]Im@MoE}@{Bg@gEsAsDkB{@m@q@{@OWiByEyAgDm@wAi@cAq@kAu@_AmBsBiAkAUWQE[G_@De@Nu@f@kCjCg@^[Ja@Fo@?m@AsA_AqCaCgA_A@Y?eAA{GAiGeC@uGA?|EEh@M^KXWZOLGLaAjAdAnB | +---------------+----------------+------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Example
Calculate the distance in car between two points avoiding tolls:
Copy
<xsql-script name=''> <body> <set name="lat1">41.324748</set> <set name="lng1">2.092209</set> <set name="lat2">41.9794</set> <set name="lng2">2.8214</set> <println> <google.route.getRoute avoid="tolls"> <lat1 /> <lng1 /> <lat2 /> <lng2 /> </google.route.getRoute> </println> </body> </xsql-script>
Returns:
Copy
+---------------+----------------+------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |distance_meters|distance_seconds|status|error_message|polyline | +---------------+----------------+------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | 127.096,00| 6.516,00|OK | |off{FkswK~DpWsJdE]FkOdEiF]aFjBiC|AcRmp@}HoVgR}Y{N{Un@}FhBXwAlt@}R|g@eCnTSf]{FvdAwAbM}Mri@mTxb@}PlW}PbIsWlBsKvCiLrIwLnVeJj\mJjH_SzG}HvRcRpRaPxHad@xMoUvLqOvDoPrGuWrSwj@fY}aAdd@gg@~Moi@nIid@zTuMnE_GSuNCg| | | | | |ObGuQqBsUiQwQsTeRu\wHue@~A}v@{Kg_@oNkLiRaFsN{HsY{a@eNmSkNyK}Y}TkJgOeJcYyD_n@|I}gAOw`@kJ}l@aKoa@cFej@iFya@}H{WcTu^_QmUe^mu@kPio@kMm\iUk]wTee@yN_r@gQ{a@qN}N_WcLgXuEiLwGgIwJgL{^qM{t@q\ofAaJ}`@oCyp@pDig@x| | | | | |BmnAoAwQwI{QkP{K_Ny@oQhCuPxGaGf@aCoA_Zk[e\g]mUkO_iAyr@wZkOaMo]gWcn@gD{G|IqXfIiaAlAyRlK_ZCyVkHy^wGcLy@wAxG{IlH}QlAsIqFoD_Nwc@iFkXlAuNnHmO`DkSbDkWfH{KmAyDaN}MgVwIiVoO{NwQ}PcBeOlAcIqBqU_Kk`@ml@kHg\{Giz@a| | | | | |EyRyLiVcMiZkEk\@ma@sFcS}Wqp@kOo\mR_XoMcSsN_Ha[iSyHcJuCoK\oTfIcj@y@yOeI{Twd@q|@}Fqe@yGuQaQeOiQqPcBiJsA{O{IaOwDiNgGmHeJaFqDyGkIsNmN_DmOkTqgA}eBg@_Ac~@_dAar@auAgB{IwCeB}MsXyBk[a@}JwE}N{DmOwTqtAsYqhBsa@mh| | | | | |CiFq\qPsh@gTio@_J{MmK_DiJaKwHq^_Ewi@dDiRrMy^tAiF^EGgAoDyZ{FgS_C{C}W_^{HqEsHs@aP{P}OoM}IaEcEcHwNeCaKxBuNUwEGaGvCiFfF_G^{Kd@{IkLiC{LcZad@{JcJiEy@yFkGaLeHcGiBkC_AqEyG}D}I_HcQiCwP?sUsCyMmG{TYcOuDgLmMmSoMa| | | | | |^kGsSsQuYkNcKgFyHkF{KgNsEeKoD}DiH}SwXwi@s|@ee@uaA[mHLgKwAvAyFnAcYoDcWeFaPwLwMkc@oKkQkKaGqPcDaPgC}WwEm{@cOomBo\w}As_@idBuYa[wEuIaJsEmP{KeU{RuNiNqQ}Es[yBqKkJgLeG{KsBkPyCkRaKoHwR_EyFcFq^qi@eIqQkMqJuF_K_D| | | | | |_PqJmVtCzAwP|RiB`BoJtJoCdK{AlFYjAFbBwFbIuIt@sF~BiFjQwAzEgAzZoC`KJ`HkDrZkYaMDg@ | +---------------+----------------+------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+