# Coordinates

With Voyager you are able to store coordinates and select them from a map.\
To do so, you first need to make sure that the column in your table is either `GEOMETRY` or `POINT`.

After that you have to include the Spatial-Trait in your Model and define the column:

```php
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use TCG\Voyager\Traits\Spatial;

class Category extends Model
{
    use Spatial;

    protected $spatial = ['your_column'];
}
```

Now you can go to the tables BREAD-settings and set your field to be `Coordinates`.

After that you will get a Map where you can select your Coordinates.

{% hint style="info" %}
Make sure to set the Google Maps API-Key in your [configuration](/voyager-2/1.4/getting-started/configurations.md#google-maps).\
This is also the place where you can define the default location of your map.
{% endhint %}

## Getting the coordinates

You can get the coordinates from your model by calling

```php
$model->getCoordinates();
```

This will return an array of coordinates with `lat` as the latitude and `lng` as the longitude.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://tcg.gitbook.io/voyager-2/1.4/customization/coordinates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
