> For the complete documentation index, see [llms.txt](https://academy.vambe.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.vambe.ai/asistentes-ia/funciones/como-calcular-costos-de-envio-y-distancias-con-google-maps.md).

# ¿Cómo calcular costos de envío y distancias con Google Maps?

Automatiza tu logística. Configura a tu IA para calcular costos de envío y distancias exactas entre tu tienda y el cliente usando Google Maps.

La función de **Google Maps** permite que tu Asistente tenga noción espacial. Puede calcular qué tan lejos está un cliente de tu local y, lo más importante, cuánto **cobrarle por el despacho automáticamente.**

Existen dos formas de usar esta herramienta según lo que necesites:

1. **Desde un Punto Fijo (Fixed Start):** Ideal para Delivery (Tienda -> Cliente).
2. **Puntos Dinámicos (Dynamic Points)**: Para medir distancias entre varios puntos variables (Punto A -> Punto B).

***

#### Configuración Paso a Paso

Sigue estos pasos para conectar la conversación con tu automatización:

**Paso 1: Ingresar al Asistente**

1. Ve al menú [Asistente](https://academy.vambe.ai/asistentes-ia/asistentes-con-bloques-v2/como-ingresar-al-asistente-de-inteligencia-artificial.md).
2. Entra a Pasos a Seguir (recomendado) o Casos Posibles.

**Paso 2: La Instrucción (El Gatillo)**

Debes decirle a la IA en qué momento exacto debe calcular la ruta.

* *Fórmula:* `Una vez tengas [La dirección], ejecuta la función [Calcular Envío]`.

{% hint style="success" %}
**Ejemplo Real:** "Una vez tienes el rut del cliente, su nombre completo y dirección debes: 1. Ejecutar la función calcular el precio de envío".
{% endhint %}

**Paso 3: Crear la Función**

Haz clic en **+ Agregar Función** y selecciona **Google Maps.**

<figure><img src="https://1176996256-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZ46rFloLOG1hJ2JQGi0%2Fuploads%2FThYuULHlAum6zALtqr3q%2Fimage.png?alt=media&amp;token=fb374ab3-c0a1-4579-ac5d-2ea4296e336a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1176996256-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZ46rFloLOG1hJ2JQGi0%2Fuploads%2FL05Il0eoviVt2p7kcsbp%2Fimage.png?alt=media&amp;token=09da5323-a11b-42ed-860e-7d715cd6db23" alt=""><figcaption></figcaption></figure>

Aquí debes elegir cuál de las dos opciones usarás:

**Opción A:** Calculadora de Delivery (Fixed Start) Ideal si tienes una dirección fija (tu bodega) y quieres calcular el envío al cliente.

1. Selecciona **Get distance from fixed start directions.**

   <figure><img src="https://1176996256-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZ46rFloLOG1hJ2JQGi0%2Fuploads%2FG2gXSMFPNBd9qElsP0Hh%2Fimage.png?alt=media&amp;token=5cb50eb4-4635-4aae-80fa-7fa8fa85cf90" alt=""><figcaption></figcaption></figure>
2. Campos de Entrada del Usuario (Tus datos fijos):

   * **Directions (Required)**: Escribe **TU dirección fija** (Ej: "Av. Providencia 1234, Santiago")
   * **Max distance (mts):** Define el radio máximo de atención en metros (Ej: `5000` para 5km).
   * **Cost per meter:** Coloca cuánto cobras por cada metro de viaje. La IA multiplicará la distancia por este valor para dar el precio final.

   <figure><img src="https://1176996256-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZ46rFloLOG1hJ2JQGi0%2Fuploads%2FxYDfMs3P3N9Q1EBwycGx%2Fimage.png?alt=media&amp;token=7f5bfa49-e038-46cd-aa21-ae0ba64ec5ec" alt=""><figcaption></figcaption></figure>
3. **Contenido Generado por IA:**
   * **User Destination:** Dale la instrucción para buscar la dirección del cliente (Ej: "Obtén la dirección de destino del usuario en formato calle, comuna, ciudad").

**Opción B:** Distancia entre **Puntos Dinámicos** Ideal para medir distancias entre dos puntos variables (A y B) sin una base fija.

1. Selecciona Get distance from dynamic points.

   <figure><img src="https://1176996256-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZ46rFloLOG1hJ2JQGi0%2Fuploads%2FmPR2zj37uIFOewVkzlBB%2Fimage.png?alt=media&amp;token=df25b1fb-a2d2-4f28-ab30-061804364eb5" alt=""><figcaption></figcaption></figure>
2. Contenido Generado por IA (recomendado no editar):

   * **List Description:** Explica el formato de las direcciones.
   * **Item Description:** Dile a la IA qué puntos debe buscar y comparar.

   <figure><img src="https://1176996256-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZ46rFloLOG1hJ2JQGi0%2Fuploads%2FbiXFqJEZdTdHHLczGdl0%2Fimage.png?alt=media&amp;token=7f4a31e3-5ffc-4916-865c-99c138fa2806" alt=""><figcaption></figcaption></figure>

**Paso 4: Verificación Visual**

Asegúrate de ver la tarjeta de la función "🗺️ Get distance..." justo debajo de tu texto de instrucción. Si la tarjeta está ahí, tu IA ya está lista para calcular rutas.

<figure><img src="https://1176996256-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FjZ46rFloLOG1hJ2JQGi0%2Fuploads%2FxNIolK7hxBfAzPwvs1nM%2Fimage.png?alt=media&amp;token=a56daa97-0b64-4717-90bd-3b1b07c11e80" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://academy.vambe.ai/asistentes-ia/funciones/como-calcular-costos-de-envio-y-distancias-con-google-maps.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
