# Prepare geo data (with basemap)

## Introduction

In order to create a [mapchart](/visualizations-and-layouts/creating-visualizations/viz-gallery/legacy-viz-designs/mapchart.md), the dataset used to create the chart must include a geographical column that give information about the polygon corresponding to a zone. So within this page, we will see more in detail the pre-requisite in term of data preparation that will allow the creation of a mapchart.

{% hint style="info" %}
When building a mapchart, the geographical column will be **automatically used** in order to build the chart. There is no need to specify it, but it's **mandatory** to have this geographical column.
{% endhint %}

Generally, for a mapchart building purpose, you will need:

* 1 **basemap** file (**geojson** format): file contaning the geographical polygon of a label (for example regions, countries, ...)
* 1 datasource / dataset containing your measure and dimension
* Depending on the need in term of data preparation, there are some **YouPrep** **steps** that are dedicated for geographical data.

The overall process is simple:

* Import the basemap file (it should have the extension **geojson**)
* Create a dataset containing your measure and dimension
  * Join the basemap dataset
* (Make some data transformation)
* Create a mapchart using the dataset containing your measure, dimensions, and geographical column

## Example of a complete process

* Import the basemap file in Toucan.

Generally the file will contains a list of geographical label (e.g Country, Region, ...) with associated geographical polygons (column geometry in the example below).

<figure><img src="/files/VFDKi5R4OqZs38VbxM1N" alt="" width="563"><figcaption></figcaption></figure>

* Create a new dataset containing all the measures & dimensions, and JOIN the basemap dataset to your dataset with YouPrep. In the example below, we join the dataset containing geographical column (`basemap_france`) to our dataset, by using the key `Departement`

  <figure><img src="/files/1j2hdLqQxEExKxBU0kjd" alt="" width="563"><figcaption></figcaption></figure>
* After having join the basemap dataset, you should see new column coming from the joined dataset, and most importantly you should find your column contaning the geographical data (`geometry` in the example) that has the **correct column type (geo)**.

  <figure><img src="/files/hms5VlutYhyyYG6bAmYC" alt="" width="563"><figcaption></figcaption></figure>
* You can also make some data transformation that are specific to geographical data

  <figure><img src="/files/Hb27JU5uLwGRE3iFwHW0" alt="" width="563"><figcaption></figcaption></figure>
* Then, save the dataset.

{% hint style="success" %}
The dataset is now ready to be used in order to create a mapchart.
{% endhint %}

So, you can now easily create a mapchart (look at the [mapchart documentation](/visualizations-and-layouts/creating-visualizations/viz-gallery/legacy-viz-designs/mapchart.md) more detail) using the dataset you just created.

<figure><img src="/files/ZFOhEcmIIYfGu0aR6iGb" alt=""><figcaption></figcaption></figure>


---

# 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://docs-v3.toucantoco.com/data-management-in-datahub/datasets-in-toucan/preparing-data/overview-of-youprep-tm/geo/prepare-geo-data-with-basemap.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.
