Returns the distance in meters and in seconds between two points according to the directions service of google maps.

<lat_p1 /> +
<lng_p1 /> +
<lat_p2 /> +
<lng_p2 /> +

#### Ver tambien

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>
<lat1 />
<lng1 />
<lat2 />
<lng2 />
</println>
</body>
</xsql-script>

Returns:

Copy
+---------------+----------------+------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|distance_meters|distance_seconds|status|error_message|polyline                                                                                                                                                                                                |
+---------------+----------------+------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|      11.976,00|        1.042,00|OK    |             |off{FkswKEjWAD?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|
+---------------+----------------+------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
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>
<lat1 />
<lng1 />
<lat2 />
<lng2 />
</println>
</body>
</xsql-script>

Returns:

Copy
+---------------+----------------+------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|distance_meters|distance_seconds|status|error_message|polyline                                                                                                                                                                                                |
+---------------+----------------+------+-------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|               |                |      |             |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@iFkXlAuNnHmODkSbDkWfH{KmAyDaN}MgVwIiVoO{NwQ}PcBeOlAcIqBqU_Kk@ml@kHg\{Giz@a|
|               |                |      |             |_PqJmVtCzAwP|RiBBoJtJoCdK{AlFYjAFbBwFbIuIt@sF~BiFjQwAzEgAzZoCKJ`HkDrZkYaMDg@                                                                                                                          |