MapTiler Countries dataset makes it easy to build a choropleth map where you connect geographically related data to countries, administrative or postal units, e.g. election maps, census data, and other statistical data.
There are two ways how to do it:
- For simple use-cases, we recommend using our Edit tool. The tool is part of your account in MapTiler Cloud. This article is about this method.
Prepare MapTiler Countries for the Edit tool
MapTiler Countries is available in MapTiler Cloud in the Tiles section. To be able to visually edit this dataset, we need to create a style. It can be done by clicking on Create Style button located under the dataset preview. The map style will open. Under the map preview, you can see the Edit style button.
The advanced edit tool has multiple sections. On the left, you can find the Layers tab. The layer listed on the top is the background, the layer that is lowest on the list is in the front. Next to it, there is a column with attributes of the layer. Here we can style the layer.
If you want to change the style of a specific country or region, you have to filter it. Let's change the color of France to violet. Choose a layer with Administrative polygons, add a filter saying that we want to color geometry with an attribute name equal to France. name == France. If we want to color more areas in the same color, we can add the same filter where the value is the country's name. In the Paint properties section, we can define the color of element(s), its opacity, and even add a pattern.
To color Spain with a different color, we need to copy the layer with Administrative polygons and set the filter and color. This way, we may add as many layers and filters as we need to. We can do the same also with lines visualizing borders of areas.
In the following picture, we set the color of all countries with attribute continent == Europe to violet, and we excluded two countries by adding filters name != Spain and name != Austria, and countries' color was set in a new layer.
Visit MapTiler Countries schema to discover all attributes of the dataset or use Inspect mode. Inspect mode can be switched on in the upper right corner of the Advanced edit tool in the View tab.
Choose background map
Now is time to add nice background. We can either edit the color of the background or choose a basemap to give our data more context, e.g. satellite map. To activate a satellite map, we need to add a new data source to our map. This data source has to be added as a new layer - a type is Raster, and the source is Satellite-mediumres_2018. Now we have to add it as a background - the top layer. The original background can be deleted or switched to invisibled.
Insert the map in website
After saving and publishing this map in your account, you can add it to your web page. All needed info is available in MapTiler Cloud account on the page with your map. Read how to insert maps in websites with a simple iframe.