---
title: "Prepare GeoJSON with attributes for choropleth map and upload it to MapTiler | Guides | Maps apis | Maps platform"
description: "Prepare and upload GeoJSON data with attributes for choropleth maps."
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Prepare GeoJSON with attributes for choropleth map and upload it to MapTiler

This article describes how to join country geometry from GISCO with attribute data from EUROSTAT and save it as GeoJSON. This type of GeoJSON is great for creating choropleth maps. We will also cover how to upload GeoJSON to MapTiler.

_In this tutorial, we cover just data preparation for web choropleth map. If you want to create such a map we recommend you to read also tutorials that shows how to add GoJSON to a map with Maplibre, leaflet, or OpenLayers library._

## Prepare the data

We will work with data from EUROSTAT. First, we will need the [geometry of European countries](https://ec.europa.eu/eurostat/web/gisco/geodata/administrative-units/countries). (The geometry layer doesn’t have to be in GeoJSON format. The GeoJSON format will be created by export of geometry joined with attribute data. However, in the following lines we work with GeoJSON geometry).

**PRO TIP:** Whole Europe is visible approximately on zoom 3, which corresponds to 1:73,957,338.86 map scale in 96 dpi. You can read more about map scales and zoom levels [here](https://www.maptiler.com/google-maps-coordinates-tile-bounds-projection/). The best scale for our choropleth map is 1:1 000 000. Of course, it is possible to change geometry generalization as you go through zoom levels.

Then we need categorical or quantitative data, which will be displayed in the choropleth map. Remember that **you should have relative values** such as population density for the choropleth map, not the number of people. We will use categorical data of the **mean age of women at first marriage** **in 2019,** which can be filtered from the [Marriage indicators dataset](https://ec.europa.eu/eurostat/databrowser/view/demo_nind/default/table?lang=en). (Filters - Time: 2019, Geopolitical entity: countries, Demographic indicator: mean age at first marriage - females)

**PRO TIP:** In the format tab, select codes instead of labels. These codes are better suited for connection with a geographical representation.

![](./4410423287825_9873a970b9.png)

After download, it’s necessary to remove the header and footer of the spreadsheet and rename the headers of each column ideally to one word without spatial characters. The final document should have just one sheet with two columns named GEO\_code and Age.

![](./4410423288081_c31d6f3a5d.webp)

### Join of spatial and attribute data

**Open QGIS**. **Open** edited table with a **mean age of women at first marriage** as a layer and select **CNTR\_RG\_10M\_2020\_4326.geojson** from GeoJSON countries. Right-click on CNTR\_RG\_10M\_2020\_4326.geojson layer and select **properties → joins → green plus sign**

![](./4410415658641_06f2f2a1d5.webp)

Well done! You just joined spatial data with attributes. However, this is just a temporary connection, which will become permanent after export. CNTR\_RG\_10M\_2020\_4326.geojson layer contents countries of the whole world, but we want to have final GeoJSON only with countries that have values.  
**Right-click** on CNTR\_RG\_10M\_2020\_4326.geojson **→ open attribute table → select feature using an expression**: _“Age” is NOT Null and “Age” is NOT ‘:’_ This expression will select just countries with some value.

![](./4410415659409_f0bba34b8e.webp)

Now it’s good to check if our Age column is a number. If it’s a number, the numbers will be alight to the right. If age is not a number, create a new field (decimal number (real) size 3 precision 1) and save values to it with the expression “Age”.  
Now we can export: **right-click** on CNTR\_RG\_10M\_2020\_4326.geojson layer → **export** → **Save Selected Features As** and name it. In this phase, it is also possible to remove unnecessary attributes such as FID, CNTR\_ID Age, or ISO3\_CODE.

![](./4410415661073_b00dc4b570.webp)

## Upload GeoJSON to MapTiler

Go to [MapTiler - maps](https://cloud.maptiler.com/maps/) in the Left Menu, select **Data,** and then select **NEW DATASET.**

![](./4410408150929_731f0ebbe6.webp)

Choose **upload file** under Upload dataset. Click on **upload.** Name and describe your dataset and click on **Create**. And that is all, you have successfully joined spatial data with attributes in QGIS.

![](./4410423289617_6e97515743.webp)

## Useful links

[Zoomable choropleth map from GeoJSON with MapLibre](https://docs.maptiler.com/sdk-js/examples/choropleth-geojson/)  
[Zoomable choropleth map from GeoJSON in Leaflet](https://docs.maptiler.com/leaflet/examples/choropleth-geojson/)  
[Countries’ geometries from EUROSTAT](https://ec.europa.eu/eurostat/web/gisco/geodata/administrative-units/countries)  
[Marriage indicators dataset](https://ec.europa.eu/eurostat/databrowser/view/demo_nind/default/table?lang=en)
